Wednesday, August 14, 2019

How to detect two buttons pressed at the same time on EFR32 EmberZnet

The following code show you how to detect two buttons pressed at the same time on EFR32 EmberZnet.

void emberAfHalButtonIsrCallback(uint8_t button, uint8_t state)
{
  if (state == BUTTON_RELEASED) {
    emberEventControlSetActive(findingAndBindingEventControl);
  }
  if( (halButtonPinState(BSP_BUTTON0_PIN)==BUTTON_PRESSED) && (halButtonPinState(BSP_BUTTON1_PIN)==BUTTON_PRESSED) )
    emberAfCorePrintln("Both btn pressed!!!");

}

No comments:

Post a Comment