6#define LCD_SHOW_BLINK 0x0F
7#define LCD_SHOW_SOLID 0x0E
9#define LCD_CURSOR_L 0x10
10#define LCD_CURSOR_R 0x14
11#define LCD_SHIFT_L 0x18
12#define LCD_SHIFT_R 0x1C
14PololuHD44780Base::PololuHD44780Base()
19void PololuHD44780Base::init2()
37 sendCommand4Bit(0b0010);
38 sendCommand(0b00101000);
40 setDisplayControl(0b000);
43 setDisplayControl(0b100);
46void PololuHD44780Base::sendAndDelay(uint8_t data,
bool rsValue,
bool only4bit)
50 send(data, rsValue, only4bit);
80 sendCommand(LCD_CLEAR);
92 const uint8_t line_mem[] = {0x80, 0xC0, 0x94, 0xD4};
97 sendCommand(line_mem[y] + x);
105 uint8_t address = number * 8;
107 for(uint8_t i = 0; i < 8; i++)
110 sendCommand(0b01000000 | (address + i));
113 sendData(pgm_read_byte(picture + i));
119 uint8_t address = number * 8;
121 for(uint8_t i = 0; i < 8; i++)
124 sendCommand(0b01000000 | (address + i));
127 sendData(picture[i]);
131void PololuHD44780Base::setDisplayControl(uint8_t displayControl)
133 sendCommand(0b00001000 | displayControl);
134 this->displayControl = displayControl;
139 setDisplayControl((displayControl | 0b010) & ~0b001);
144 setDisplayControl((displayControl | 0b001) & ~0b010);
149 setDisplayControl(displayControl & ~0b011);
154 setDisplayControl(displayControl & ~0b100);
159 setDisplayControl(displayControl | 0b100);
164 setDisplayControl(displayControl & ~0b010);
169 setDisplayControl(displayControl | 0b010);
174 setDisplayControl(displayControl & ~0b001);
179 setDisplayControl(displayControl | 0b001);
184 sendCommand(0b00011000);
189 sendCommand(0b00011100);
194 sendCommand(0b00000010);
198void PololuHD44780Base::setEntryMode(uint8_t entryMode)
200 sendCommand(0b00000100 | entryMode);
201 this->entryMode = entryMode;
206 setEntryMode(entryMode | 0b10);
211 setEntryMode(entryMode & ~0b10);
216 setEntryMode(entryMode | 0b01);
221 setEntryMode(entryMode & ~0b01);
virtual void send(uint8_t data, bool rsValue, bool only4bits)=0
virtual size_t write(uint8_t c)
void scrollDisplayRight()
void gotoXY(uint8_t x, uint8_t y)
void loadCustomCharacterFromRam(const uint8_t *picture, uint8_t number)
void loadCustomCharacter(const uint8_t *picture, uint8_t number)
virtual void initPins()=0