/** * @Author: 李建 * @Date: 2024/8/13 11:20 * Description: 拨码开关 * Copyright: Copyright (©) 2024 永续绿建. All rights reserved. */ #ifndef FFX_BOARD_DIP_SWITCH_H #define FFX_BOARD_DIP_SWITCH_H #include "main.h" #define DIP_GPIO_PORT GPIOB // 定义4位拨码开关的引脚 #define DIP_4_1_PIN GPIO_PIN_4 #define DIP_4_2_PIN GPIO_PIN_5 #define DIP_4_3_PIN GPIO_PIN_8 #define DIP_4_4_PIN GPIO_PIN_9 // 读取拨码开关状态 #define DIP_4_1_State HAL_GPIO_ReadPin(DIP_GPIO_PORT, DIP_4_1_PIN) #define DIP_4_2_State HAL_GPIO_ReadPin(DIP_GPIO_PORT, DIP_4_2_PIN) #define DIP_4_3_State HAL_GPIO_ReadPin(DIP_GPIO_PORT, DIP_4_3_PIN) #define DIP_4_4_State HAL_GPIO_ReadPin(DIP_GPIO_PORT, DIP_4_4_PIN) /** * 读取4位拨码开关的数字 * @return */ uint8_t read_dip_4_number(void); /** * 读取2位拨码开关的数字 * @return */ uint8_t read_dip_2_number(void); #endif //FFX_BOARD_DIP_SWITCH_H