lcd now supports 2 extra commands
This commit is contained in:
@@ -19,6 +19,8 @@ struct lcd_t {
|
|||||||
typedef uint8_t lcd_glyph_t[8];
|
typedef uint8_t lcd_glyph_t[8];
|
||||||
|
|
||||||
void lcd_close(struct lcd_t *lcd);
|
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_clear(struct lcd_t *lcd);
|
||||||
void lcd_set_contrast(struct lcd_t *lcd, uint8_t contrast);
|
void lcd_set_contrast(struct lcd_t *lcd, uint8_t contrast);
|
||||||
void lcd_set_backlight(struct lcd_t *lcd, bool enabled);
|
void lcd_set_backlight(struct lcd_t *lcd, bool enabled);
|
||||||
|
|||||||
13
src/lcd.c
13
src/lcd.c
@@ -3,12 +3,11 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
static int lcd_open(struct lcd_t *lcd, const bool reopen) {
|
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) {
|
void lcd_clear(struct lcd_t *lcd) {
|
||||||
constexpr uint8_t cmdbuf[] = {0xFE, 88};
|
constexpr uint8_t cmdbuf[] = {0xFE, 88};
|
||||||
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
|
lcd_write(lcd, cmdbuf, sizeof(cmdbuf));
|
||||||
|
|||||||
Reference in New Issue
Block a user