Nuvoton
/
NuMaker-mbed-tickless-example
NuMaker tickless example
Diff: wakeup_i2c.cpp
- Revision:
- 16:ed2c228cbc9c
- Parent:
- 10:d2e2c79389e1
diff -r 580010922451 -r ed2c228cbc9c wakeup_i2c.cpp --- a/wakeup_i2c.cpp Fri Feb 21 11:16:49 2020 +0800 +++ b/wakeup_i2c.cpp Fri Feb 21 11:19:30 2020 +0800 @@ -57,11 +57,8 @@ i2c_slave.address(I2C_ADDR); while (true) { - int32_t sem_tokens = sem_i2c.wait(osWaitForever); - if (sem_tokens < 1) { - continue; - } - + sem_i2c.acquire(); + bool has_notified_wakeup = false; /* This timer is to check if there is I2C traffic remaining. */ Timer timer; @@ -92,15 +89,14 @@ break; } } - - /* Clear wake-up events by I2C traffic which would have been handled above */ - sem_i2c.wait(0); } } void nu_i2c_wakeup_handler(I2C_T *i2c_base) { (void) i2c_base; - + + /* FIXME: Clear wake-up event to enable re-entering Power-down mode */ + sem_i2c.release(); }