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.

cc2530 push button keychange function is not entering

Other Parts Discussed in Thread: Z-STACK

Hello sir

For my application , the key is pressed in coordinator and send the data to the enddevice, I am using sample application in z stack, but the KEYCHANGE function is not activated. Please tell me, how to activate that. and also we need three more switch is included that. how to add this. How to activate the key interrupt and how to write the routine.

  • Hello Saravanan,

    The Home Automation -1.2.1 Sample Application for example SampleSwitch registers for the Key Press events,  (That happen when a key is pressed on the SmartRF06EM for the out of Box sample Application) by calling the function RegisterForKeys() in the application initialization function - zclSampleSw_Init(). 

    // Register for all key events - This app will handle all key events
    RegisterForKeys( zclSampleSw_TaskID );

    Then when a key is pressed the application gets a notification via the global system message (SYS_EVENT_MSG) see section 2.1.7.1 of the Z-Stack Home Developers Guide in the documents folder of the Z-Stack Home Install. 

    This is then processed in the zclSampleSw_event_loop() for the event KEY_CHANGE. The sample switch application provides an example of how to handle different key events which is done in the function zclSampleSw_HandleKeys().

    Please refer to the Z-Stack Home Developers Guide which explains this and other details on the Sample Application. 

    You can then check if you application is registering for the key events, if not you can add the registration and then refer to the sample implementation on how different key presses are distinguished. 

    Hope this helps. 

    Regards

  • Would you please elaborate on how and where the 'shift' state is being changed? As far as I understand, the 'keys' value is updated by the 'halGetJoyKeyInput()' and 'HalKeyRead()' functions defined in the 'hal_key.c' file, but where is the 'shift' state being defined? In the home automation sample switch/samplelight demo, if I want to use push button 1 as an additional key, why doesn't the code

    if(keys & HAL_KEY_SW_6 )

    {

    ..................

    }

    work?