2017-02-24 20:47:35 +00:00
|
|
|
#include "MyLcd.h"
|
|
|
|
#include "Hardware.h"
|
|
|
|
|
2017-03-02 07:18:07 +00:00
|
|
|
void MyLcd::execute(uint8_t data, bool RS)
|
2017-02-24 20:47:35 +00:00
|
|
|
{
|
|
|
|
static const uint8_t eMask = 0b00000010;
|
|
|
|
static const uint8_t rsMask = 0b01000000;
|
|
|
|
|
2017-03-02 07:18:07 +00:00
|
|
|
if (RS)
|
2017-02-24 20:47:35 +00:00
|
|
|
{
|
2017-03-02 07:18:07 +00:00
|
|
|
data |= rsMask;
|
2017-02-24 20:47:35 +00:00
|
|
|
}
|
|
|
|
|
2017-03-02 07:18:07 +00:00
|
|
|
m_lcdShiftReg.set(data | eMask);
|
|
|
|
m_lcdShiftReg.set(data);
|
|
|
|
}
|
2017-02-24 20:47:35 +00:00
|
|
|
|
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);
|
2017-02-24 20:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|