Distancer/MyLcd.cpp

27 lines
436 B
C++
Raw Permalink Normal View History

#include "MyLcd.h"
#include "Hardware.h"
2017-03-02 07:18:07 +00:00
void MyLcd::execute(uint8_t data, bool RS)
{
static const uint8_t eMask = 0b00000010;
static const uint8_t rsMask = 0b01000000;
2017-03-02 07:18:07 +00:00
if (RS)
{
2017-03-02 07:18:07 +00:00
data |= rsMask;
}
2017-03-02 07:18:07 +00:00
m_lcdShiftReg.set(data | eMask);
m_lcdShiftReg.set(data);
}
2017-03-02 07:18:07 +00:00
void MyLcd::execute(const Command &cmd, bool RS, uint16_t delay)
{
execute((cmd.data & 0xf0) >> 2, RS);
execute((cmd.data & 0x0f) << 2, RS);
delay_us(delay);
}