Files
linuxSmartie/include/lcd.h
2026-05-11 10:26:30 +00:00

34 lines
1.1 KiB
C

#ifndef LCDDISPLAY_HPP
#define LCDDISPLAY_HPP
#define LCD_LINES 4
#define LCD_COLS 40
#include <stdbool.h>
#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);
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