hal_board_cfg.h
/* 1 - Green */
#define LED1_BV BV(0)#define LED1_SBIT P1_0
#define LED1_DDR P1DIR
#define LED1_POLARITY ACTIVE_HIGH//说明高电平点亮
//LED1灯接的管脚是P1-0
#if defined (HAL_BOARD_CC2530EB_REV17)
/* 2 - Red */
#define LED2_BV BV(1)
#define LED2_SBIT P1_1
#define LED2_DDR P1DIR
#define LED2_POLARITY ACTIVE_HIGH
/* 3 - Yellow */
#define LED3_BV BV(4)
#define LED3_SBIT P1_4
#define LED3_DDR P1DIR
#define LED3_POLARITY ACTIVE_HIGH
#endif
找到上述的代码我们就可以随意的修改LED灯的引脚了。
hal_board_cfg.h
#define HAL_TURN_OFF_LED1() st( LED1_SBIT = LED1_POLARITY (0); )
#define HAL_TURN_OFF_LED2() st( LED2_SBIT = LED2_POLARITY (0); )
#define HAL_TURN_OFF_LED3() st( LED3_SBIT = LED3_POLARITY (0); )
#define HAL_TURN_OFF_LED4() HAL_TURN_OFF_LED1()
hal_led.h
/* Modes */
#define HAL_LED_MODE_OFF 0x00
#define HAL_LED_MODE_ON 0x01//打开灯
#define HAL_LED_MODE_BLINK 0x02//瞬间闪烁
#define HAL_LED_MODE_FLASH 0x04//一直闪烁
#define HAL_LED_MODE_TOGGLE 0x08//灯的翻转