consistent w the other thing
This commit is contained in:
14
src/lcd.c
14
src/lcd.c
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user