123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #ifndef __LED_H
- #define __LED_H
- #include "stm32f2xx.h"
- //引脚定义
- /*******************************************************/
- #define LED_PIN GPIO_Pin_6
- #define LED_GPIO_PORT GPIOF
- #define LED_GPIO_CLK RCC_AHB1Periph_GPIOF
- #define NET_STATUS_LED_PIN GPIO_Pin_8
- #define NET_STATUS_LED_GPIO_PORT GPIOF
- #define NET_STATUS_LED_GPIO_CLK RCC_AHB1Periph_GPIOF
- #define STATUS_LED_PIN GPIO_Pin_7
- #define STATUS_LED_GPIO_PORT GPIOF
- #define STATUS_LED_GPIO_CLK RCC_AHB1Periph_GPIOF
- /************************************************************/
- /** 控制LED灯亮灭的宏,
- * LED低电平亮,设置ON=0,OFF=1
- * 若LED高电平亮,把宏设置成ON=1 ,OFF=0 即可
- */
- #define ON 1
- #define OFF 0
- /* 带参宏,可以像内联函数一样使用 */
- #define LED(a) if (a) \
- GPIO_SetBits(LED_GPIO_PORT,LED_PIN);\
- else \
- GPIO_ResetBits(LED_GPIO_PORT,LED_PIN)
- #define NET_STATUS_LED(a) if (a) \
- GPIO_SetBits(NET_STATUS_LED_GPIO_PORT,NET_STATUS_LED_PIN);\
- else \
- GPIO_ResetBits(NET_STATUS_LED_GPIO_PORT,NET_STATUS_LED_PIN)
-
- #define STATUS_LED(a) if (a) \
- GPIO_SetBits(STATUS_LED_GPIO_PORT,STATUS_LED_PIN);\
- else \
- GPIO_ResetBits(STATUS_LED_GPIO_PORT,STATUS_LED_PIN)
- void LED_GPIO_Config(void);
- void NET_STATUS_LED_Config(void);
- void STATUS_LED_Config(void);
-
- int hd_netledOpen(void);
- int hd_netledClose(void);
- void hd_netledSetOpenTime(int tms);
-
- #endif
|