14 #include <util/delay.h>
102 virtual void send(uint8_t data,
bool rsValue,
bool only4bits) = 0;
106 void sendAndDelay(uint8_t data,
bool rsValue,
bool only4bit);
109 void sendCommand(uint8_t cmd)
111 sendAndDelay(cmd,
false,
false);
115 void sendCommand4Bit(uint8_t cmd)
117 sendAndDelay(cmd,
false,
true);
121 void sendData(uint8_t data)
123 sendAndDelay(data,
true,
false);
166 void gotoXY(uint8_t x, uint8_t y);
300 virtual size_t write(uint8_t c);
308 virtual size_t write(
const uint8_t * buffer,
size_t size);
322 uint8_t displayControl;
331 void setEntryMode(uint8_t entryMode);
332 void setDisplayControl(uint8_t displayControl);
379 uint8_t db6, uint8_t db7)
391 digitalWrite(e, LOW);
395 virtual void send(uint8_t data,
bool rsValue,
bool only4bits)
397 digitalWrite(rs, rsValue);
400 pinMode(db4, OUTPUT);
401 pinMode(db5, OUTPUT);
402 pinMode(db6, OUTPUT);
403 pinMode(db7, OUTPUT);
405 if (!only4bits) { sendNibble(data >> 4); }
406 sendNibble(data & 0x0F);
411 void sendNibble(uint8_t data)
413 digitalWrite(db4, data >> 0 & 1);
414 digitalWrite(db5, data >> 1 & 1);
415 digitalWrite(db6, data >> 2 & 1);
416 digitalWrite(db7, data >> 3 & 1);
418 digitalWrite(e, HIGH);
420 digitalWrite(e, LOW);
424 uint8_t rs, e, db4, db5, db6, db7;