#include "port.h" static void led_gpio_init(void) { GPIO_InitSettingType x; x.Signal = GPIO_Pin_Signal_Digital; x.Dir = GPIO_Direction_Output; x.Func = GPIO_Reuse_Func0; x.ODE = GPIO_ODE_Output_Disable; x.DS = GPIO_DS_Output_Normal; x.PUE = GPIO_PUE_Input_Disable; x.PDE = GPIO_PDE_Input_Disable; GPIO_Init(GPIO_Pin_A3, &x); GPIO_Init(GPIO_Pin_B13, &x); GPIO_Init(GPIO_Pin_A5, &x); GPIO_Init(GPIO_Pin_A6, &x); GPIO_Init(GPIO_Pin_A7, &x); GPIO_Init(GPIO_Pin_A8, &x); GPIO_Init(GPIO_Pin_A9, &x); GPIO_Init(GPIO_Pin_B1, &x); GPIO_Init(GPIO_Pin_A28, &x); // GPIO_Init(GPIO_Pin_A2, &x); // GPIO_WriteBit(GPIO_Pin_A2,1); } static void key_gpio_init(void) { /** * @brief PA11~PA13?????? ????? ?????? * */ GPIO_InitSettingType x; x.Signal = GPIO_Pin_Signal_Digital; x.Dir = GPIO_Direction_Input; x.Func = GPIO_Reuse_Func0; x.PUE = GPIO_PUE_Input_Disable; x.PDE = GPIO_PDE_Input_Enable; GPIO_Init(GPIO_Pin_A11, &x); //??H GPIO_Init(GPIO_Pin_A16, &x); //??M GPIO_Init(GPIO_Pin_A13, &x); GPIO_Init(GPIO_Pin_A12, &x); } void gpio_init(void) { led_gpio_init(); key_gpio_init(); } void port_debug_set(bool state) { GPIO_SET(A, 28, !, state); } void port_fan_set(bool state) { GPIO_SET(B, 1, !!, state); } void port_led0_set(bool state) { GPIO_SET(A, 3, !, state); } void port_led1_set(bool state) { GPIO_SET(B, 13, !, state); } void port_led2_set(bool state) { GPIO_SET(A, 5, !, state); } void port_led3_set(bool state) { GPIO_SET(A, 6, !, state); } void port_led_r_set(bool state) { GPIO_SET(A, 7, !, state); } void port_led_g_set(bool state) { GPIO_SET(A, 8, !, state); } void port_led_b_set(bool state) { GPIO_SET(A, 9, !, state); } bool port_gpio_get_timer_key_state(void) { return GPIO_GET(A, 11, !!); } //??H bool port_gpio_get_gears_key_state(void) { return GPIO_GET(A, 16, !!); } //??M bool port_gpio_get_switch_key_state(void) { return GPIO_GET(A, 12, !!); } bool port_gpio_get_interval_key_state(void) { return GPIO_GET(A, 13, !!); } bool port_led0_get_state(void) { return GPIO_GET(A, 3, !); } //??H bool port_led1_get_state(void) { return GPIO_GET(B, 13,!); } //??M bool port_led2_get_state(void) { return GPIO_GET(A, 5, !); } bool port_led3_get_state(void) { return GPIO_GET(A, 6, !); }