Other Parts Discussed in Thread: CC2592, CC2590
Hi Guys,
I working on my custom board (Zstack 1.2 based on light switch project) and I have several doubts about the LEDs configuration, I thinking that I have wrong configuration on the LED1 and LED3. At this moment only LED2 (Attaching Status) is working very well. I have tree LEDs as I describing bellow:
1 - D1 - Circuit status (ON/OFF)
2 - D2 - Circuit Status (ON/OFF)
3 - D3 - Attaching Status, it´s working according ZDapp.c
I using the LED1 and LED3 on my App file to represent the zclMyAPP_OnOffC1 == LIGHT_ON /LIGHT_OFF or zclMyAPP_OnOffC2 == LIGHT_ON or /LIGHT_OFF, I made an working around using the P0 ports directly.
Please, anybody can help to configure it?
I have setting those configuration on hal_board_cfg.h:
LED1 (P0_0) - D1,
LED2 (P1_1) - D3
LED3 (P0_5) - D2
My Electrical LED Interface Circuit:
I have setting UP those configurations on my custom board as I describing bellow:
In my App I have setting up P0 SEL and P0 DIR for ports P0_0 and P0_5:
Profile 1 (EP 1) P0SEL &= (~BV(0)); // LED GREEN CIRC. 1 P0DIR |= (BV(0)); Profie 2 (EP 2) P0SEL &= (~BV(5)); // LED GREEN CIRC 2 P0DIR |= (BV(5));
On_board_cfg.h Ports definitions:
/* 1 - Green D1 - Circuit 1 */ #define LED1_BV BV(0) #define LED1_SBIT P0_0 #define LED1_DDR P0DIR #define LED1_POLARITY ACTIVE_LOW /* 2 - Green D2 - Circuit 2 */ #define LED3_BV BV(5) #define LED3_SBIT P0_5 #define LED3_DDR P0DIR #define LED3_POLARITY ACTIVE_LOW /* 3 - Red - D3 - Attaching Status LED*/ #define LED2_BV BV(1) #define LED2_SBIT P1_1 #define LED2_DDR P1DIR #define LED2_POLARITY ACTIVE_HIGH
On_bord_cfg.h LED configuration:
/* ----------- LED's ---------- */ #if defined (HAL_BOARD_CC2530EB_REV17) && !defined (HAL_PA_LNA) && \ !defined (HAL_PA_LNA_CC2590) && !defined (HAL_PA_LNA_SE2431L) && \ !defined (HAL_PA_LNA_CC2592) #define HAL_TURN_OFF_LED1() st( LED1_SBIT = LED1_POLARITY (1); ) #define HAL_TURN_OFF_LED2() st( LED2_SBIT = LED2_POLARITY (0); ) #define HAL_TURN_OFF_LED3() st( LED3_SBIT = LED3_POLARITY (1); ) #define HAL_TURN_ON_LED1() st( LED1_SBIT = LED1_POLARITY (0); ) #define HAL_TURN_ON_LED2() st( LED2_SBIT = LED2_POLARITY (1); ) #define HAL_TURN_ON_LED3() st( LED3_SBIT = LED3_POLARITY (0); ) #define HAL_TOGGLE_LED1() st( if (LED1_SBIT) { LED1_SBIT = 0; } else { LED1_SBIT = 1;} ) #define HAL_TOGGLE_LED2() st( if (LED2_SBIT) { LED2_SBIT = 0; } else { LED2_SBIT = 1;} ) #define HAL_TOGGLE_LED3() st( if (LED3_SBIT) { LED3_SBIT = 0; } else { LED3_SBIT = 1;} ) #define HAL_STATE_LED1() (LED1_POLARITY (LED1_SBIT)) #define HAL_STATE_LED2() (LED2_POLARITY (LED2_SBIT)) #define HAL_STATE_LED3() (LED3_POLARITY (LED3_SBIT)) #elif defined (HAL_PA_LNA_SE2431L) || defined (HAL_PA_LNA_CC2592) #elif defined (HAL_BOARD_CC2530EB_REV13) || defined (HAL_PA_LNA) || \ defined (HAL_PA_LNA_CC2590) #define HAL_TURN_OFF_LED1() st( LED1_SBIT = LED1_POLARITY (1); ) #define HAL_TURN_OFF_LED2() st( LED2_SBIT = LED2_POLARITY (0); ) #define HAL_TURN_OFF_LED3() st( LED3_SBIT = LED3_POLARITY (1); ) #define HAL_TURN_ON_LED1() st( LED1_SBIT = LED1_POLARITY (0); ) #define HAL_TURN_ON_LED2() st( LED2_SBIT = LED2_POLARITY (1); ) #define HAL_TURN_ON_LED3() st( LED3_SBIT = LED3_POLARITY (0); ) #define HAL_TOGGLE_LED1() st( if (LED1_SBIT) { LED1_SBIT = 0; } else { LED1_SBIT = 1;} ) #define HAL_TOGGLE_LED2() st( if (LED2_SBIT) { LED2_SBIT = 0; } else { LED2_SBIT = 1;} ) #define HAL_TOGGLE_LED3() st( if (LED3_SBIT) { LED3_SBIT = 0; } else { LED3_SBIT = 1;} ) #define HAL_STATE_LED1() (LED1_POLARITY (LED1_SBIT)) #define HAL_STATE_LED2() (LED2_POLARITY (LED2_SBIT)) #define HAL_STATE_LED3() (LED3_POLARITY (LED3_SBIT)) #endif
Could you see attached my on_board_cfg.h