36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
#ifndef LCDDISPLAY_HPP
|
|
#define LCDDISPLAY_HPP
|
|
|
|
#define LCD_LINES 4
|
|
#define LCD_COLS 40
|
|
|
|
#include <stdint.h>
|
|
|
|
struct lcd_t {
|
|
int fd;
|
|
uint32_t baud;
|
|
char writebuf[LCD_LINES * LCD_COLS + 8];
|
|
char port[128];
|
|
};
|
|
|
|
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_str(struct lcd_t* lcd, const char* str, uint8_t len);
|
|
void lcd_write_str_pos(struct lcd_t* lcd, const char* str, uint8_t len, uint8_t posX, uint8_t posY);
|
|
void lcd_write_buf(struct lcd_t* lcd, uint8_t row, uint8_t col, const char* str);
|
|
int lcd_writef(struct lcd_t *lcd, uint8_t offset, const char *fmt, ...);
|
|
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);
|
|
|
|
inline char cc(const uint8_t c) { return (char)(c % 8); }
|
|
|
|
|
|
#endif |