this locks like shit

Dependencies:   MenuLCD mbed

Fork of MenuLCD_copy by Vinícius Alves

menbed/menbedRefresher.cpp

Committer:
LucasMatBorges
Date:
2017-05-19
Revision:
1:f105b690aeb7
Parent:
0:92357d1220f3

File content as of revision 1:f105b690aeb7:

#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);
}