代码贴上来,新增了一个led反转接口函数。
- #include "bsp_led.h"
- void BSP_Led_Init(void)
- {
- stc_port_init_t stcPortInit;
- /* configuration structure initialization */
- MEM_ZERO_STRUCT(stcPortInit);
- stcPortInit.enPinMode = Pin_Mode_Out;
- stcPortInit.enPinDrv = Pin_Drv_H;
- stcPortInit.enPinOType = Pin_OType_Cmos;
- stcPortInit.enPullUp = Enable;
- /* LED0 Port/Pin initialization */
- PORT_Init(LED0_PORT, LED0_PIN, &stcPortInit);
- /* LED1 Port/Pin initialization */
- PORT_Init(LED1_PORT, LED1_PIN, &stcPortInit);
- /* LED2 Port/Pin initialization */
- PORT_Init(LED2_PORT, LED2_PIN, &stcPortInit);
- /* LED3 Port/Pin initialization */
- PORT_Init(LED3_PORT, LED3_PIN, &stcPortInit);
-
- ///< LED关闭
- PORT_ResetBits(LED0_PORT, LED0_PIN);
- PORT_ResetBits(LED1_PORT, LED1_PIN);
- PORT_ResetBits(LED2_PORT, LED2_PIN);
- PORT_ResetBits(LED3_PORT, LED3_PIN);
- }
- void BSP_led_blink(en_led_t LED)
- {
- if(LED == LED_RED)
- {
- PORT_Toggle(LED0_PORT, LED0_PIN);
- }
- if(LED == LED_GREEN )
- {
- PORT_Toggle(LED1_PORT, LED1_PIN);;
- }
- if(LED == LED_YELLOW)
- {
- PORT_Toggle(LED2_PORT, LED2_PIN);
- }
- if(LED == LED_BLUE)
- {
- PORT_Toggle(LED3_PORT, LED3_PIN);
- }
- return;
- }
|