This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
Distancer/MyLcd.cpp

27 lines
436 B
C++
Raw 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);
}