Hi Guys, I'am working with my device, running over ZStack 2.4.0, and i used Project Reference as SampleLight.
My Board have connected two key switches, SW1 as P0_4 and SW2 as P0_5.
The main Idea is to turn on or turn off my light switch according to the keys SW1 or SW2 pressed.
Initially i changed some code lines to support my New Ports (P0_4 and P0_5) in those files to provide my board to interact with my code:
on hal_borad_cfg.h
/* ------------------------------------------------------------------------------------------------
* Push Button Configuration
* ------------------------------------------------------------------------------------------------
*/
#define ACTIVE_LOW !
#define ACTIVE_HIGH !! /* double negation forces result to be '1' */
/* S1 */
#define PUSH1_BV BV(4) // Written by ASA the original value is 1
#define PUSH1_SBIT P0_4 // Written by ASA the original value is P0_1
#if defined (HAL_BOARD_CC2530EB_REV17)
#define PUSH1_POLARITY ACTIVE_HIGH
#elif defined (HAL_BOARD_CC2530EB_REV13)
#define PUSH1_POLARITY ACTIVE_LOW
#else
#error Unknown Board Indentifier
#endif
/* S2 */
#define PUSH2_BV BV(5) // Written by ASA the original value is 0
#define PUSH2_SBIT P0_5 // Written by ASA the original value is P2_0
#define PUSH2_POLARITY ACTIVE_HIGH
on onboard.c:
void InitBoard( uint8 level )
{
if ( level == OB_COLD )
{
// IAR does not zero-out this byte below the XSTACK.
*(uint8 *)0x0 = 0;
// Interrupts off
osal_int_disable( INTS_ALL );
// Check for Brown-Out reset
ChkReset();
}
else // !OB_COLD
{
/* Initialize Key stuff */
//HalKeyConfig(HAL_KEY_INTERRUPT_DISABLE, OnBoard_KeyCallback); written by ASA
HalKeyConfig( HAL_KEY_INTERRUPT_ENABLE, OnBoard_KeyCallback);
}
on zcl_sampleLight.c (HandleKeys):
static void zclSampleLight_HandleKeys( byte shift, byte keys )
{
//zAddrType_t dstAddr;
(void)shift; // Intentionally unreferenced parameter
if (shift)
if (keys & HAL_KEY_SW_1 )
{
HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF ); // Written by ASA
P1_4 = 0;
}
if ( keys & HAL_KEY_SW_2 )
{
HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF ); // Written by ASA
P1_4 = 0;
}
if ( keys & HAL_KEY_SW_3 )
{
HalLedSet( HAL_LED_3, HAL_LED_MODE_OFF ); // Written by ASA
}
if ( keys & HAL_KEY_SW_4 )
{
HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF );// Written by ASA
}
}
I double checked with fisical port (P0_4) with a basic test, inside a incoming message loop, to verify it my hardware works, and i checked that is was ok.
if (!P0_4)
{ P1_4 = 0;
}
But nothing happens, when i using handlekeys in zcl_samplelight.c. Somebody can help me, how to starting to working it?
BR
Alex
BR
Alex