PER Firmware
Loading...
Searching...
No Matches
nextion.h
Go to the documentation of this file.
1
12#ifndef NEXTION_H
13#define NEXTION_H
14
15#include <stdint.h>
16#include <strbuf.h>
17
18// Serial insturcitons must be terminated with 3 bytes 0xFF
19#define NXT_CMD_TERM "\xFF\xFF\xFF"
20#define ASCII_OFFSET 48
21
22// Nextion Command Strings
23#define NXT_BACKGROUND_COLOR ".bco="
24#define NXT_FONT_COLOR ".pco="
25#define NXT_VALUE ".val="
26#define NXT_TEXT ".txt="
27#define NXT_BORDERW ".borderw="
28#define NXT_BORDER_COLOR ".borderc="
29#define NXT_PAGE "page "
30#define NXT_BRIGHTNESS "dims="
31#define NXT_BAUD "bauds="
32
33// Function Prototypes
34void NXT_setFloat(char* obj_name, char* param, float num, uint8_t precision);
35void NXT_setValue(char* obj_name, uint16_t val);
36void NXT_setBackground(char* obj_name, uint16_t val);
37void NXT_setFontColor(char* obj_name, uint16_t val);
38void NXT_setBorderWidth(char* obj_name, uint16_t val);
39void NXT_setBorderColor(char* obj_name, uint16_t val);
40void NXT_setText(char* obj_name, char* text);
41void NXT_setTextFormatted(char* obj_name, const char* format, ...);
42void NXT_setPage(char* page_name);
43
44// Configuration Functions
45void NXT_setBrightness(uint8_t brightness);
46void NXT_setBaud(uint32_t baud);
47
48#endif // NEXTION_H
void NXT_setFloat(char *obj_name, char *param, float num, uint8_t precision)
Sets a float value to a specified object parameter on the Nextion display.
Definition nextion.c:28
void NXT_setBackground(char *obj_name, uint16_t val)
Sets the background color of a specified object on the Nextion display.
Definition nextion.c:50
void NXT_setBrightness(uint8_t brightness)
Sets the brightness of the Nextion display.
Definition nextion.c:134
void NXT_setBorderColor(char *obj_name, uint16_t val)
Sets the border color of a specified object on the Nextion display.
Definition nextion.c:83
void NXT_setTextFormatted(char *obj_name, const char *format,...)
Sets the text of a Nextion display object using printf-style formatting.
Definition nextion.c:107
void NXT_setText(char *obj_name, char *text)
Sets the text of a Nextion display object.
Definition nextion.c:94
void NXT_setPage(char *page_name)
Sets the current page on the Nextion display.
Definition nextion.c:124
void NXT_setValue(char *obj_name, uint16_t val)
Sets a value to a specified object on the Nextion display.
Definition nextion.c:39
void NXT_setBaud(uint32_t baud)
Sets the baud rate for the Nextion display.
Definition nextion.c:146
void NXT_setBorderWidth(char *obj_name, uint16_t val)
Sets the border width of a specified object on the Nextion display.
Definition nextion.c:72
void NXT_setFontColor(char *obj_name, uint16_t val)
Sets the font color of a specified object on the Nextion display.
Definition nextion.c:61
Fixed-size string builder. Useful for building large CMD strings before transmission.