peroper backlight set func

This commit is contained in:
2026-09-28 21:25:21 +02:00
parent ab4674f6f4
commit 84b8207531
2 changed files with 10 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
#include "log.h"
#include <fcntl.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
@@ -58,6 +59,12 @@ void lcd_set_backlight(struct lcd_t *lcd, const bool enabled) {
lcd_write(lcd, cmdbuf, enabled ? 3 : 2);
}
void lcd_set_brightness(struct lcd_t *lcd, const uint8_t brightness) {
applog(LOG_INF, "Set backlight brightness to %d", brightness);
const uint8_t cmdbuf[] = {0xFE, 152, brightness};
lcd_write(lcd, cmdbuf, 3);
}
void lcd_set_cursor(struct lcd_t *lcd, const uint8_t row, const uint8_t col) {
const uint8_t cmdbuf[] = {0xFE, 71, col + 1, row + 1};
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
@@ -138,4 +145,4 @@ int lcd_init(struct lcd_t *lcd) {
lcd_clear(lcd);
return 0;
}
}