3 #ifndef __NEONEXTION_NEXTION
4 #define __NEONEXTION_NEXTION
6 #if defined(SPARK) || defined(PLATFORM_ID)
7 #include "application.h"
8 extern char *itoa(
int a,
char *buffer,
unsigned char radix);
34 Nextion(Stream &stream,
bool flushSerialBeforeTx =
true);
40 bool refresh(
const char *objectName);
50 bool clear(uint32_t colour = NEX_COL_WHITE);
51 bool drawPicture(uint16_t x, uint16_t y, uint8_t
id);
52 bool drawPicture(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t
id);
53 bool drawStr(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t fontID,
54 char *str, uint32_t bgColour = NEX_COL_BLACK,
55 uint32_t fgColour = NEX_COL_WHITE,
59 bool drawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
61 bool drawRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h,
bool filled,
63 bool drawCircle(uint16_t x, uint16_t y, uint16_t r, uint32_t colour);
74 bool m_flushSerialBeforeTx;
bool checkCommandComplete()
Checks if the last command was successful.
Definition: Nextion.cpp:356
Centre.
Definition: NextionTypes.h:39
bool sleep()
Puts the device into sleep mode.
Definition: Nextion.cpp:102
bool drawPicture(uint16_t x, uint16_t y, uint8_t id)
Draws a pre uploaded picture on the display.
Definition: Nextion.cpp:191
bool drawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t colour)
Draws a line on the display.
Definition: Nextion.cpp:258
bool drawRect(uint16_t x, uint16_t y, uint16_t w, uint16_t h, bool filled, uint32_t colour)
Draws a rectangle on the display.
Definition: Nextion.cpp:279
bool drawCircle(uint16_t x, uint16_t y, uint16_t r, uint32_t colour)
Draws a circle on the display.
Definition: Nextion.cpp:302
bool clear(uint32_t colour=NEX_COL_WHITE)
Clears the current display.
Definition: Nextion.cpp:175
bool init()
Initialises the device.
Definition: Nextion.cpp:24
void poll()
Polls for new messages and touch events.
Definition: Nextion.cpp:40
bool setBrightness(uint16_t val, bool persist=false)
Sets the backlight brightness.
Definition: Nextion.cpp:138
Solid colour.
Definition: NextionTypes.h:51
ITouchableListItem * next
Pointer to next list node.
Definition: Nextion.h:24
void registerTouchable(INextionTouchable *touchable)
Adds a INextionTouchable to the list of registered touchable elements.
Definition: Nextion.cpp:320
uint8_t getCurrentPage()
Gets the ID of the current displayed page.
Definition: Nextion.cpp:154
size_t receiveString(char *buffer, size_t len)
Receive a string from the device.
Definition: Nextion.cpp:402
Interface for widgets that can be touched.
Definition: INextionTouchable.h:15
void sendCommand(char *command)
Sends a command to the device.
Definition: Nextion.cpp:341
bool drawStr(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t fontID, char *str, uint32_t bgColour=NEX_COL_BLACK, uint32_t fgColour=NEX_COL_WHITE, uint8_t bgType=NEX_BG_SOLIDCOLOUR, NextionFontAlignment xCentre=NEX_FA_CENTRE, NextionFontAlignment yCentre=NEX_FA_CENTRE)
Draws a string on the display.
Definition: Nextion.cpp:234
bool receiveNumber(uint32_t *number)
Receive a number from the device.
Definition: Nextion.cpp:376
Nextion(Stream &stream, bool flushSerialBeforeTx=true)
Creates a new device driver.
Definition: Nextion.cpp:12
bool wake()
Wakes the device from sleep mode.
Definition: Nextion.cpp:112
bool refresh()
Refreshes the entire page.
Definition: Nextion.cpp:78
uint16_t getBrightness()
Gets the current backlight brightness.
Definition: Nextion.cpp:122
INextionTouchable * item
Pointer to stored INextionTouchable.
Definition: Nextion.h:23
Linked list node for INextionTouchable objects.
Definition: Nextion.h:21
Driver for a physical Nextion device.
Definition: Nextion.h:31
NextionFontAlignment
Font alignment modes.
Definition: NextionTypes.h:35