Tuesday, December 22, 2020

How to create a delay event in Simplicity Studio v5 and EmberZnet 6.9.0.0

You can use the following steps to create a delay event in Simplicity Studio v5 and EmberZnet 6.9.0.0 when press PB0 on BRD4001A to trigger a delay event.

1. New eventYKDelay as Command and eventYKDelayHandler as Callback in Event Configuration of Includes tab in isc file to generate related codes.

2. Add the following code in button-interface.c

EmberEventControl eventYKDelay;

void eventYKDelayHandler(void){
  emberEventControlSetInactive(eventYKDelay);
  emberSerialPrintfLine(APP_SERIAL, "2000ms delay event");
}

3. Add the the following line in emberAfPluginButtonInterfaceButton0PressedEventHandler to trigger eventYKDelayHandler after 2000 ms.

emberEventControlSetDelayMS(eventYKDelay, 2000);

4. Build and download code into EFR32 radio board.

5. Run the application and press PB0. You will see "2000ms delay event" printed on console 2 seconds later, which shows delay event works.




No comments:

Post a Comment