mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
tap-v1/tap_pwr.c: make sure to invoke the button notification on registering the cb
This commit is contained in:
@@ -59,6 +59,9 @@
|
||||
extern void led_on(int led);
|
||||
extern void led_off(int led);
|
||||
|
||||
static struct timespec time_down;
|
||||
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
@@ -80,6 +83,12 @@ static power_button_state_notification_t power_state_notification = default_powe
|
||||
int board_register_power_state_notification_cb(power_button_state_notification_t cb)
|
||||
{
|
||||
power_state_notification = cb;
|
||||
|
||||
if (board_pwr_button_down() && (time_down.tv_nsec != 0 || time_down.tv_sec != 0)) {
|
||||
// make sure we don't miss the first event
|
||||
power_state_notification(PWR_BUTTON_DOWN);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -99,8 +108,6 @@ int board_shutdown()
|
||||
|
||||
static int board_button_irq(int irq, FAR void *context)
|
||||
{
|
||||
static struct timespec time_down;
|
||||
|
||||
if (board_pwr_button_down()) {
|
||||
|
||||
led_on(BOARD_LED_RED);
|
||||
|
||||
Reference in New Issue
Block a user