Add example timer code to HD4470.cpp and .h

This commit is contained in:
Jonathan Naylor 2016-05-23 18:43:44 +01:00
parent d474328c58
commit 628490097e
2 changed files with 12 additions and 1 deletions

View file

@ -50,7 +50,8 @@ m_pwmDim(pwmDim),
m_duplex(duplex),
//m_duplex(true), // uncomment to force duplex display for testing!
m_fd(-1),
m_dmr(false)
m_dmr(false),
m_timer(1000U, 0U, 250U) // 250ms
{
assert(rows > 1U);
assert(cols > 15U);
@ -679,6 +680,14 @@ void CHD44780::clearFusionInt()
void CHD44780::clockInt(unsigned int ms)
{
m_timer.clock(ms);
if (m_timer.isRunning() && m_timer.hasExpired()) {
// Do work every 250ms here
// Start the timer with m_timer.start();
// and stop it with m_timer.stop();
m_timer.start();
}
}
void CHD44780::close()

View file

@ -20,6 +20,7 @@
#define HD44780_H
#include "Display.h"
#include "Timer.h"
#include <string>
#include <vector>
@ -93,6 +94,7 @@ private:
bool m_duplex;
int m_fd;
bool m_dmr;
CTimer m_timer;
#ifdef ADAFRUIT_DISPLAY
void adafruitLCDSetup();