Compare commits

...

3 Commits

Author SHA1 Message Date
252e146576 linuxsmartie used SPLASH 2026-09-30 13:52:39 +02:00
5fe9c57b6e hw handles most of the init sequence now, also reinits whole lcd for
good measure
2026-09-30 13:52:14 +02:00
c764ce9367 lcd now supports 2 extra commands 2026-09-30 13:51:05 +02:00
3 changed files with 15 additions and 8 deletions

View File

@@ -19,6 +19,8 @@ struct lcd_t {
typedef uint8_t lcd_glyph_t[8];
void lcd_close(struct lcd_t *lcd);
void lcd_reinit(struct lcd_t *lcd);
void lcd_splash(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);

View File

@@ -3,12 +3,11 @@
#include <fcntl.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static int lcd_open(struct lcd_t *lcd, const bool reopen) {
@@ -42,6 +41,16 @@ static void lcd_write(struct lcd_t *lcd, const uint8_t *cmdbuf, const uint16_t l
}
}
void lcd_reinit(struct lcd_t *lcd) {
constexpr uint8_t cmdbuf[] = {0xFE, 63};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
}
void lcd_splash(struct lcd_t *lcd) {
constexpr uint8_t cmdbuf[] = {0xFE, 65};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
}
void lcd_clear(struct lcd_t *lcd) {
constexpr uint8_t cmdbuf[] = {0xFE, 88};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
@@ -140,9 +149,6 @@ int lcd_init(struct lcd_t *lcd) {
}
lcd_clear_buf(lcd);
constexpr uint8_t cmdbuf[] = {0xFE, 75, 0xFE, 84};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
lcd_clear(lcd);
lcd_reinit(lcd);
return 0;
}

View File

@@ -175,8 +175,7 @@ static void *display_thread(void *arg) {
lcd_clear_buf(&lcd);
}
lcd_write_buf(&lcd, 2, 16, "Goodbye"); // center
lcd_flush_buf(&lcd);
lcd_splash(&lcd);
lcd_close(&lcd);
applog(LOG_WRN, "display thread stopped");
return nullptr;