Added a DEM16101 lcd display to the shift register

This commit is contained in:
Michael Mandl 2017-02-24 21:47:35 +01:00
parent 38b63ddbdd
commit 86df456b0f
3 changed files with 52 additions and 1 deletions

@ -1 +1 @@
Subproject commit 9f8ad3372382536275926cd95d5e5343235faf21 Subproject commit d9ac375268cb6bfa03a16b803b4d11ef9531dd3a

38
MyLcd.cpp Normal file
View file

@ -0,0 +1,38 @@
#include "MyLcd.h"
#include "Hardware.h"
void MyLcd::execute(const Command &cmd, bool RS, double delay)
{
static const uint8_t eMask = 0b00000010;
static const uint8_t rsMask = 0b01000000;
//static const double pulseLength = 0.5;
{
uint8_t output = (cmd.data & 0xf0) >> 2;
if (RS)
{
output |= rsMask;
}
m_lcdShiftReg.set(output | eMask);
//delay_us(pulseLength);
m_lcdShiftReg.set(output);
}
{
uint8_t output = (cmd.data & 0x0f) << 2;
if (RS)
{
output |= rsMask;
}
m_lcdShiftReg.set(output | eMask);
//delay_us(pulseLength);
m_lcdShiftReg.set(output);
}
delay_ms(delay);
}

13
MyLcd.h Normal file
View file

@ -0,0 +1,13 @@
#pragma once
#include "LcdShiftReg.h"
#include "DeviceLib/Lcd.h"
class MyLcd : public Lcd
{
private:
LcdShiftReg m_lcdShiftReg;
private:
virtual void execute(const Command &cmd, bool RS, double delay) override;
};