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.

how to set external interruption of Z-stack

Other Parts Discussed in Thread: Z-STACK

recently i'm try to use a smoke sensor to report to the coordinator when there is smoke. i mean to use IO external interruption to make the sensor report data to coordinator. So i wonder how to add an external interruption in z-stack?

do i need to modify the code of hal_drive.c ?

  • You can refer to hal_key.c In Z-Stack. It show you how to register GPI as interrupt source.

  • thank you I have read the hal_key.c and hal_ drive.c and i also set enable the interruption in onboard.c, and the port i want to have interrupt is P2_0 which is already defined in hal_key.c for joystick. so i try to repalce the function for  Hal_Key_Event  in Hal_ProcessEvent, but the i mean to set a Event defined in the App LAYER to send alarm information to the coordinator, so how can i do it?

  • After you revise hal_key.c for P2_0 interrupt, you should receive KEY_CHANGE event in your zclXXX_event_loop. Please make sure of this first.

  • thank you this problem is solve by adding RegisterForKeys( GenericApp_TaskID ) in my GenericApp.c and put the sending message to coordinator function in the case:KEY CHANGE in the GenericApp_ProcessEvent( byte task_id, UINT16 events ), now it can process the interruption correctly. thank you again