update key

This commit is contained in:
不吃油炸鸡
2025-08-12 18:44:02 +08:00
parent 12b5d9e142
commit dd2176335c
2 changed files with 67 additions and 20 deletions

View File

@@ -7,21 +7,42 @@ extern "C" {
#include "main.h"
//KEY1
#define KEY1_PORT GPIOA
#define KEY1_PIN GPIO_PIN_0
#define KEY1 HAL_GPIO_ReadPin(KEY1_PORT,KEY1_PIN)
// boot, yes, right, left, no
#define KEYB_NUM 1
#define KEYY_NUM 2
#define KEYL_NUM 3
#define KEYR_NUM 4
#define KEYN_NUM 5
//KEY2
#define KEY2 0
//KEYB
#define KEYB_PORT GPIOA
#define KEYB_PIN GPIO_PIN_0
#define KEYB HAL_GPIO_ReadPin(KEYB_PORT,KEYB_PIN)
//KEYY
#define KEYY_PORT GPIOA
#define KEYY_PIN GPIO_PIN_1
#define KEYY HAL_GPIO_ReadPin(KEYY_PORT,KEYY_PIN)
//KEYL
#define KEYL_PORT GPIOA
#define KEYL_PIN GPIO_PIN_2
#define KEYL HAL_GPIO_ReadPin(KEYL_PORT,KEYL_PIN)
//KEYR
#define KEYR_PORT GPIOA
#define KEYR_PIN GPIO_PIN_3
#define KEYR HAL_GPIO_ReadPin(KEYR_PORT,KEYR_PIN)
//KEYN
#define KEYN_PORT GPIOA
#define KEYN_PIN GPIO_PIN_4
#define KEYN HAL_GPIO_ReadPin(KEYN_PORT,KEYN_PIN)
void Key_Port_Init(void);
void Key_Interrupt_Callback(void);
uint8_t KeyScan(uint8_t mode);
#ifdef __cplusplus
}
#endif