#ifndef LINUXSMARTIE_LCD_H #define LINUXSMARTIE_LCD_H #define LCD_LINES 4 #define LCD_COLS 40 #include #include struct lcd_t { int fd; uint32_t baud; char ccharbuf[8][11]; // 8 custom chars, each 11 bytes (3 byte command + 8 byte glyph) char writebuf[LCD_LINES * LCD_COLS + 8]; // number of chars on the lcd + 2*4 byte set cursor commands char port[96]; }; typedef uint8_t lcd_glyph_t[8]; void lcd_close(struct lcd_t *lcd); void lcd_clear(struct lcd_t *lcd); void lcd_set_contrast(struct lcd_t *lcd, uint8_t contrast); void lcd_set_backlight(struct lcd_t *lcd, bool enabled); void lcd_set_cursor(struct lcd_t *lcd, uint8_t row, uint8_t col); void lcd_set_custom_char(struct lcd_t *lcd, uint8_t index, const lcd_glyph_t *glyph); void lcd_write_buf(struct lcd_t *lcd, uint8_t row, uint8_t col, const char *str); void lcd_writef(struct lcd_t *lcd, uint8_t x, uint8_t y, const char *fmt, ...) __attribute__((format(printf, 4, 5))); void lcd_clear_buf(struct lcd_t *lcd); void lcd_flush_buf(struct lcd_t *lcd); char lcd_bar(struct lcd_t *lcd, uint8_t char_id, double value); int lcd_init(struct lcd_t *lcd); #endif