This commit is contained in:
2026-07-01 01:50:02 +02:00
parent 86da8434bd
commit 29c14dc56f
11 changed files with 48 additions and 52 deletions

View File

@@ -1,6 +1,7 @@
#include "lcd.h"
#include "log.h"
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
@@ -37,7 +38,7 @@ void lcd_write(struct lcd_t *lcd, const uint8_t *cmdbuf, const uint16_t len) {
}
void lcd_clear(struct lcd_t *lcd) {
const uint8_t cmdbuf[] = {254, 88};
constexpr uint8_t cmdbuf[] = {254, 88};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
}
@@ -98,7 +99,7 @@ inline void lcd_clear_buf(struct lcd_t *lcd) {
/* flushes writebuffer to lcd, hyperoptmized, flushes buffer and commands in a single write operation */
inline void lcd_flush_buf(struct lcd_t *lcd) {
const uint8_t set_disp[] = {254, 71, 1, 1}; // set cursor to char 1, line 1
constexpr uint8_t set_disp[] = {254, 71, 1, 1}; // set cursor to char 1, line 1
memcpy(&lcd->writebuf.text[0], set_disp, 4);
memcpy(&lcd->writebuf.text[2 * LCD_COLS + 4], set_disp, 4);
lcd->writebuf.text[2 * LCD_COLS + 7] = 3; // overwrite set cursor c1 l1 to c1 l3
@@ -136,7 +137,7 @@ int lcd_init(struct lcd_t *lcd) {
}
lcd_clear_buf(lcd);
const uint8_t cmdbuf[] = {254, 75, 254, 84};
constexpr uint8_t cmdbuf[] = {254, 75, 254, 84};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
lcd_clear(lcd);