Skip to content

Commit e4f7ea7

Browse files
committed
add reset back
1 parent fdbd029 commit e4f7ea7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

examples/valve/silabs/include/AppTask.h

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class AppTask : public BaseApplication
6868
static void AppTaskMain(void * pvParameter);
6969

7070
CHIP_ERROR StartAppTask();
71+
static void ButtonEventHandler(uint8_t button, uint8_t btnAction);
7172

7273
private:
7374
static AppTask sAppTask;

examples/valve/silabs/src/AppTask.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ void AppTask::AppTaskMain(void * pvParameter)
199199
AppEvent event;
200200

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

203204
CHIP_ERROR err = sAppTask.Init();
204205
if (err != CHIP_NO_ERROR)
@@ -223,3 +224,12 @@ void AppTask::AppTaskMain(void * pvParameter)
223224
}
224225
}
225226
}
227+
228+
void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction)
229+
{
230+
AppEvent button_event = {};
231+
button_event.Type = AppEvent::kEventType_Button;
232+
button_event.ButtonEvent.Action = btnAction;
233+
button_event.Handler = BaseApplication::ButtonHandler;
234+
sAppTask.PostEvent(&button_event);
235+
}

0 commit comments

Comments
 (0)