Skip to content

Commit

Permalink
add reset back
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille committed Oct 24, 2024
1 parent fdbd029 commit e4f7ea7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/valve/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class AppTask : public BaseApplication
static void AppTaskMain(void * pvParameter);

CHIP_ERROR StartAppTask();
static void ButtonEventHandler(uint8_t button, uint8_t btnAction);

private:
static AppTask sAppTask;
Expand Down
10 changes: 10 additions & 0 deletions examples/valve/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ void AppTask::AppTaskMain(void * pvParameter)
AppEvent event;

osMessageQueueId_t sAppEventQueue = *(static_cast<osMessageQueueId_t *>(pvParameter));
chip::DeviceLayer::Silabs::GetPlatform().SetButtonsCb(ButtonEventHandler);

CHIP_ERROR err = sAppTask.Init();
if (err != CHIP_NO_ERROR)
Expand All @@ -223,3 +224,12 @@ void AppTask::AppTaskMain(void * pvParameter)
}
}
}

void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction)
{
AppEvent button_event = {};
button_event.Type = AppEvent::kEventType_Button;
button_event.ButtonEvent.Action = btnAction;
button_event.Handler = BaseApplication::ButtonHandler;
sAppTask.PostEvent(&button_event);
}

0 comments on commit e4f7ea7

Please sign in to comment.