This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Guys!
I working with my device (based on Sample Light w Zstack Z-Stack Home 1.2.2a.44539), w/ a SimpleDescriptionFormat as ZCL Basic On/off, to use 4 GPIO ports (P1_4, P1_5, P0_5 and P0_4), all those have eletric pin avaiable for use. My idea is that when my device received ZCL cmd On/off all those GPIO ports answer (High-1 or Low Level-0, on or off).
To do that i wrote those code in onoffCB funcition:
// Turn on the light
if ( cmd == COMMAND_ON )
{
zclTeha0002_OnOff = LIGHT_ON;
P1_4 = 1;
P1_5 = 1;
P0_5 = 1;
P0_4 = 1;
P0_3 = 1;
P0_2 = 1;
}
// Turn off the light
else if ( cmd == COMMAND_OFF )
{
zclTeha0002_OnOff = LIGHT_OFF;
P1_4 = 0;
P1_5 = 0;
P0_5 = 0;
P0_4 = 0;
P0_3 = 0;
P0_2 = 0;
}
After my device received the cmd on/off, from the gateway, just P0_5 responds to the commad and changs its level stats ( on-1 and 0ff-0). I didnt not find any code that blocked the another ports (p1_4, P1_5, P0_4, P0_3 and P0_2).
Anybody have any idea?
BR
Alex
Hi Mr Yikai, thanks a lot for your assistance!
I´m using the default DMA configuration (_hal_uart_dma.c) as you can see bellow:
#if (HAL_UART_DMA == 1)
#define PxOUT P0
#define PxIN P0
#define PxDIR P0DIR
#define PxSEL P0SEL
.
.
.
#else
#define PxOUT P1
#define PxIN P1
#define PxDIR P1DIR
#define PxSEL P1SEL
.
.
.
Is this configuration you mentioned?
Hi Mr. Yikai.
void zclTeha0002_Init( byte task_id )
{
zclTeha0002_TaskID = task_id;
P0SEL &= (~(BV(4)|BV(5)));
P1SEL &= (~(BV(4)|BV(5)));
P0DIR |= (BV(4)|BV(5));
P1DIR |= (BV(4)|BV(5));
.....
Now is running very well!
You are the BEST!
Thanks a lot!!!!
BR
Alex