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