9 class HD44780_LCD_Bus {
10 volatile uint8_t bus[2];
13 volatile uint8_t * lcd;
15 reg(uint8_t addr,
volatile uint8_t * lcd) : addr(addr), lcd(lcd) {}
16 operator uint8_t() {
return read(); }
17 uint8_t operator=(uint8_t val) {
write(val);
return val; }
19 uint8_t
read() {
return lcd[addr]; }
20 void write(uint8_t val)
22 while (lcd[0] & 0x80) {
asm(
"dsb"); }
29 void init(uint8_t cols, uint8_t rows);
31 void putstr(
const char *str);
32 void setCursor(
int row,
int col);
35 reg operator[] (
int i) {
return reg(i & 0x1, bus); }
36 friend class HD44780_LCD;
51 cursorDisp_t cursorDisp;
54 HD44780_LCD(HD44780_LCD_Bus &bus, uint8_t cols, uint8_t rows);
56 void init() { bus.init(cols, rows); }
57 void putchar(
char c) { bus.putchar(c); }
58 void putstr(
const char *str) { bus.putstr(str); }
59 void setCursor(
int row,
int col) { bus.setCursor(row, col); }
60 void enableCursor(cursorDisp_t disp);
61 void enableDisplay(
bool enable);
64 HD44780_LCD_Bus::reg operator[] (
int i) {
return bus[i]; }
void init()
System initialization. Normally called at the beginning of all applications.
Definition: init.cpp:22
int write(int fd, const char *buf, int nbytes)
This function writes data to the stream associated with a file descriptor (fd).
Definition: fileio.cpp:152
int read(int fd, char *buf, int nbytes)
This function reads data from a file descriptor (fd), and will block forever until at least one byte ...
Definition: fileio.cpp:288