Vinícius Alves
/
MenuLCD_copy
Então PARA...
Diff: menbed/menbedRefresher.cpp
- Revision:
- 0:92357d1220f3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/menbed/menbedRefresher.cpp Fri May 19 13:07:52 2017 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +#include "include/menbedRefresher.h" +#include "include/menbedNavigator.h" + +MenbedRefresher::MenbedRefresher (MenbedNavigator *navigator) : + navigator(navigator), refreshPeriod_us(50000) +{ + ticker.attach_us (navigator, &MenbedNavigator::updateDisplay, refreshPeriod_us); +} + +MenbedRefresher::MenbedRefresher (MenbedNavigator *navigator, uint32_t refreshPeriod_us) : + navigator(navigator), refreshPeriod_us(refreshPeriod_us) +{ + ticker.attach_us (navigator, &MenbedNavigator::updateDisplay, refreshPeriod_us); +} + +void MenbedRefresher::refreshed (void) +{ + // Detatch and then re-attached the ticker to reset it + ticker.detach(); + ticker.attach_us (navigator, &MenbedNavigator::updateDisplay, refreshPeriod_us); +} \ No newline at end of file