Compare commits
3 Commits
106de77287
...
252e146576
| Author | SHA1 | Date | |
|---|---|---|---|
| 252e146576 | |||
| 5fe9c57b6e | |||
| c764ce9367 |
@@ -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);
|
||||
|
||||
18
src/lcd.c
18
src/lcd.c
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user