Hi All,
Presently Whenever i press the key and release the key, im calculating the how much time the key was pressed.
I am calculating that using the function zllSampleLight_HandleKeys();
static void zllSampleLight_HandleKeys( byte shift, byte keys )
{
static uint32 keyPressTime_panic = 0;
if ( keys ){
if(key == HAL_PANIC_SWITCH )
keyPressTime_panic = osal_getClock();
}
}
else {
if(key == HAL_PANIC_SWITCH ) {
if (keyPressTime_panic) {
keyPressTime_panic = ( osal_getClock() - keyPressTime_panic );
if ( (keyPressTime_panic <= KEY_HOLD_SHORT_INTERVAL))
{
//Operation 1;
}
if((keyPressTime_panic <= KEY_HOLD_LONG_INTERVAL))
{
Operation 2;
}
-----------------------
#define PSWITCH_BV BV(BIT_1)
#define PSWITCH_SBIT_DDR P1DIR
#define PSWITCH_SBIT P0_1 //change to p0_1 (panic_switch_in) for panic button
#define PSWITCH_POLARITY ACTIVE_LOW
This HAL_PANIC_SWITCH assigned to port 0 and i have a requirement that now, i need to use this HAL_PANIC_SWITCH as interrupt to cc2530 and should do the above operations depending on the time, how much that key is pressed.
How can i achieve this by considering the HAL_PANIC_SWITCH as interrupt.