Compare commits

...

2 Commits

Author SHA1 Message Date
764dd1a4a9 consistent w the other thing 2026-09-24 10:36:20 +02:00
244213f396 HARDWARE UPDATE 2026-09-24 10:32:32 +02:00
2 changed files with 8 additions and 8 deletions

View File

@@ -42,24 +42,24 @@ static void lcd_write(struct lcd_t *lcd, const uint8_t *cmdbuf, const uint16_t l
}
void lcd_clear(struct lcd_t *lcd) {
constexpr uint8_t cmdbuf[] = {254, 88};
constexpr uint8_t cmdbuf[] = {0xFE, 88};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
}
void lcd_set_contrast(struct lcd_t *lcd, const uint8_t contrast) {
applog(LOG_INF, "Set contrast to %d", contrast);
const uint8_t cmdbuf[] = {254, 80, contrast};
const uint8_t cmdbuf[] = {0xFE, 80, contrast};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
}
void lcd_set_backlight(struct lcd_t *lcd, const bool enabled) {
applog(LOG_INF, "Set backlight to %s", enabled ? "true" : "false");
const uint8_t cmdbuf[] = {254, (enabled ? 66 : 70), 255};
const uint8_t cmdbuf[] = {0xFE, (enabled ? 66 : 70), 255};
lcd_write(lcd, cmdbuf, enabled ? 3 : 2);
}
void lcd_set_cursor(struct lcd_t *lcd, const uint8_t row, const uint8_t col) {
const uint8_t cmdbuf[] = {254, 71, col + 1, row + 1};
const uint8_t cmdbuf[] = {0xFE, 71, col + 1, row + 1};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
}
@@ -99,7 +99,7 @@ inline void lcd_clear_buf(struct lcd_t *lcd) {
memset(lcd->writebuf.text, ' ', sizeof(lcd->writebuf.text));
// prepare commands for custom chars
for (uint8_t i = 0; i < 8; i++) {
const uint8_t charbuf[] = {254, 78, i};
const uint8_t charbuf[] = {0xFE, 78, i};
memcpy(lcd->writebuf.cchar[i], charbuf, sizeof(charbuf));
}
}
@@ -107,7 +107,7 @@ inline void lcd_clear_buf(struct lcd_t *lcd) {
/* flushes writebuffer to lcd, hyperoptmized, flushes buffer and commands in a single write operation */
void lcd_flush_buf(struct lcd_t *lcd) {
constexpr uint8_t set_disp[] = {254, 71, 1, 1}; // set cursor to char 1, line 1
constexpr uint8_t set_disp[] = {0xFE, 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
@@ -133,7 +133,7 @@ int lcd_init(struct lcd_t *lcd) {
}
lcd_clear_buf(lcd);
constexpr uint8_t cmdbuf[] = {254, 75, 254, 84};
constexpr uint8_t cmdbuf[] = {0xFE, 75, 0xFE, 84};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
lcd_clear(lcd);

View File

@@ -95,7 +95,7 @@ static void *display_thread(void *arg) {
/* lcd setup */
struct lcd_t lcd = {
.port = "/dev/serial/by-id/usb-Raspberry_Pi_Pico_E6616407E37AA12F-if00",
.port = "/dev/serial/by-id/usb-Drath_Technologies_Serial_Display_Controller_00002-if00",
.baud = 0010002, // from termios-baud.h, B115200
};
lcd_init(&lcd);