API: readme

API
For Arduino developers
  • Main Page
  • Related Pages
  • Classes
  • Files
  • Examples
readme
Generated on Thu Jul 30 2015 11:21:33 for API by doxygen 1.8.7


API: Class List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
C NexButton | NexButton,subclass of NexTouch,provides simple methods to control button component
C NexCrop | NexCrop,subclass of NexTouch,provides simple methods to control crop component
C NexHotspot | NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component
C NexPage | NexPage,subclass of NexTouch,provides simple methods to control page component
C NexPicture | NexPicture,subclass of NexTouch,provides simple methods to control picture component
C NexPointer | NexPointer,subclass of NexTouch,provides simple methods to control pointer component
C NexProgressBar | NexProgressBar,subclass of NexTouch,provides simple methods to control progress bar component
C NexText | NexText,subclass of NexTouch,provides simple methods to control text component
C NexTouch | Root Class of Nextion Components


API: NexButton Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexButton Class Reference

NexButton,subclass of NexTouch,provides simple methods to control button component. More...

#include <NexButton.h>

Inheritance diagram for NexButton:
NexTouch

Public Member Functions

NexButton (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
void | attachPop (NexTouchEventCb pop, void *ptr=NULL)
Register button pop callback function. More...
void | detachPop (void)
Unload button pop callback function.
uint16_t | getText (char *buffer, uint16_t len)
Get text value from button component. More...
bool | setText (const char *buffer)
Set text value of button component. More...
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexButton,subclass of NexTouch,provides simple methods to control button component.

Examples:
CompButton.ino, CompPointer.ino, CompProgressBar.ino, and CompText.ino.

Definition at line 25 of file NexButton.h.

Member Function Documentation

void NexButton::attachPop | ( | NexTouchEventCb | pop,
 |  | void * | ptr = NULL
 | ) |  |

Register button pop callback function.

Parameters
pop | - the pointer to button pop callback function.
ptr | - the parameter to be transmitted to button pop callback function.
Examples:
CompButton.ino, CompPointer.ino, and CompProgressBar.ino.

Definition at line 70 of file NexButton.cpp.

uint16_t NexButton::getText | ( | char * | buffer,
 |  | uint16_t | len
 | ) |  |

Get text value from button component.

Parameters
buffer | - text buffer.
len | - text buffer length.
Returns
the text buffer length
Examples:
CompButton.ino.

Definition at line 35 of file NexButton.cpp.

bool NexButton::setText ( const char * buffer )

Set text value of button component.

Parameters
buffer - text buffer.
Return values
true | - success.
false | - failed.
Examples:
CompButton.ino.

Definition at line 53 of file NexButton.cpp.

The documentation for this class was generated from the following files:
  • NexButton.h
  • NexButton.cpp


API: NexCrop Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexCrop Class Reference

NexCrop,subclass of NexTouch,provides simple methods to control crop component. More...

#include <NexCrop.h>

Inheritance diagram for NexCrop:
NexTouch

Public Member Functions

NexCrop (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
void | attachPop (NexTouchEventCb pop, void *ptr=NULL)
Register crop pop callback function. More...
void | detachPop (void)
Unload crop pop callback function.
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexCrop,subclass of NexTouch,provides simple methods to control crop component.

Examples:
CompCrop.ino.

Definition at line 25 of file NexCrop.h.

Member Function Documentation

void NexCrop::attachPop | ( | NexTouchEventCb | pop,
 |  | void * | ptr = NULL
 | ) |  |

Register crop pop callback function.

Parameters
pop | - the pointer to crop pop callback function.
ptr | - the parameter to be transmitted to crop pop callback function.
Examples:
CompCrop.ino.

Definition at line 72 of file NexCrop.cpp.

The documentation for this class was generated from the following files:
  • NexCrop.h
  • NexCrop.cpp


API: NexHotspot Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexHotspot Class Reference

NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component. More...

#include <NexHotspot.h>

Inheritance diagram for NexHotspot:
NexTouch

Public Member Functions

NexHotspot (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
void | attachPush (NexTouchEventCb push, void *ptr=NULL)
Register hotspot push callback function. More...
void | detachPush (void)
Unload hotsopt push callback function.
void | attachPop (NexTouchEventCb pop, void *ptr=NULL)
Register hotspot pop callback function. More...
void | detachPop (void)
Unload hotsopt pop callback function.
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component.

Examples:
CompHotspot.ino.

Definition at line 25 of file NexHotspot.h.

Member Function Documentation

void NexHotspot::attachPop | ( | NexTouchEventCb | pop,
 |  | void * | ptr = NULL
 | ) |  |

Register hotspot pop callback function.

Parameters
pop | - the pointer to hotspot pot callback function.
ptr | - the parameter to be transmitted to hotspot pop callback function.
Examples:
CompHotspot.ino.

Definition at line 55 of file NexHotspot.cpp.

void NexHotspot::attachPush | ( | NexTouchEventCb | push,
 |  | void * | ptr = NULL
 | ) |  |

Register hotspot push callback function.

Parameters
push | - the pointer to hotspot push callback function.
ptr | - the parameter to be transmitted to hotspot push callback function.
Examples:
CompHotspot.ino.

Definition at line 35 of file NexHotspot.cpp.

The documentation for this class was generated from the following files:
  • NexHotspot.h
  • NexHotspot.cpp


API: NexPage Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexPage Class Reference

NexPage,subclass of NexTouch,provides simple methods to control page component. More...

#include <NexPage.h>

Inheritance diagram for NexPage:
NexTouch

Public Member Functions

NexPage (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
bool | show (void)
Change page. More...
void | attachPop (NexTouchEventCb pop, void *ptr=NULL)
Register page pop callback function. More...
void | detachPop (void)
Unload page pop callback function.
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexPage,subclass of NexTouch,provides simple methods to control page component.

Examples:
CompPage.ino.

Definition at line 25 of file NexPage.h.

Member Function Documentation

void NexPage::attachPop | ( | NexTouchEventCb | pop,
 |  | void * | ptr = NULL
 | ) |  |

Register page pop callback function.

Parameters
pop | - the pointer to page pop callback function.
ptr | - the parameter to be transmitted to page pop callback function.
Examples:
CompPage.ino.

Definition at line 55 of file NexPage.cpp.

bool NexPage::show ( void )

Change page.

Return values
true | - success.
false | - failed.
Examples:
CompPage.ino.

Definition at line 33 of file NexPage.cpp.

The documentation for this class was generated from the following files:
  • NexPage.h
  • NexPage.cpp


API: NexPicture Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexPicture Class Reference

NexPicture,subclass of NexTouch,provides simple methods to control picture component. More...

#include <NexPicture.h>

Inheritance diagram for NexPicture:
NexTouch

Public Member Functions

NexPicture (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
void | attachPop (NexTouchEventCb pop, void *ptr=NULL)
Register picture pop callback function. More...
void | detachPop (void)
Unload picture pop callback function.
bool | getPic (uint32_t *number)
Get picture's number. More...
bool | setPic (uint32_t number)
Set picture's number. More...
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexPicture,subclass of NexTouch,provides simple methods to control picture component.

Examples:
CompPicture.ino.

Definition at line 25 of file NexPicture.h.

Member Function Documentation

void NexPicture::attachPop | ( | NexTouchEventCb | pop,
 |  | void * | ptr = NULL
 | ) |  |

Register picture pop callback function.

Parameters
pop | - the pointer to picture pop callback function.
ptr | - the parameter to be transmitted to picture pop callback function.
Examples:
CompPicture.ino.

Definition at line 72 of file NexPicture.cpp.

bool NexPicture::getPic ( uint32_t * number )

Get picture's number.

Parameters
number - an output parameter to save picture number.
Return values
true | - success.
false | - failed.
Examples:
CompPicture.ino.

Definition at line 35 of file NexPicture.cpp.

bool NexPicture::setPic ( uint32_t number )

Set picture's number.

Parameters
number -the picture number.
Return values
true | - success.
false | - failed.
Examples:
CompPicture.ino.

Definition at line 52 of file NexPicture.cpp.

The documentation for this class was generated from the following files:
  • NexPicture.h
  • NexPicture.cpp


API: NexPointer Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexPointer Class Reference

NexPointer,subclass of NexTouch,provides simple methods to control pointer component. More...

#include <NexPointer.h>

Inheritance diagram for NexPointer:
NexTouch

Public Member Functions

NexPointer (NexPid pid, NexCid cid, char *name)
Constructor,inherited NexTouch's constructor function.
bool | getValue (uint32_t *number)
Get the value of pointer. More...
bool | setValue (uint32_t number)
Set the value of pointer. More...
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexPointer,subclass of NexTouch,provides simple methods to control pointer component.

Examples:
CompPointer.ino.

Definition at line 25 of file NexPointer.h.

Member Function Documentation

bool NexPointer::getValue ( uint32_t * number )

Get the value of pointer.

Parameters
number - an output parameter to save pointer's value.
Return values
true | - success.
false | - failed.
Examples:
CompPointer.ino.

Definition at line 35 of file NexPointer.cpp.

bool NexPointer::setValue ( uint32_t number )

Set the value of pointer.

Parameters
number - the value of pointer.
Return values
true | - success.
false | - failed.
Examples:
CompPointer.ino.

Definition at line 52 of file NexPointer.cpp.

The documentation for this class was generated from the following files:
  • NexPointer.h
  • NexPointer.cpp


API: NexProgressBar Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexProgressBar Class Reference

NexProgressBar,subclass of NexTouch,provides simple methods to control progress bar component. More...

#include <NexProgressBar.h>

Inheritance diagram for NexProgressBar:
NexTouch

Public Member Functions

NexProgressBar (NexPid pid, NexCid cid, char *name)
Constructor,inherited NexTouch's constructor function.
bool | getValue (uint32_t *number)
Get the value of progress bar. More...
bool | setValue (uint32_t number)
Set the value of progress bar. More...
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexProgressBar,subclass of NexTouch,provides simple methods to control progress bar component.

Examples:
CompProgressBar.ino.

Definition at line 25 of file NexProgressBar.h.

Member Function Documentation

bool NexProgressBar::getValue ( uint32_t * number )

Get the value of progress bar.

Parameters
number - an output parameter to save the value of porgress bar.
Return values
true | - success.
false | - failed.
Examples:
CompProgressBar.ino.

Definition at line 35 of file NexProgressBar.cpp.

bool NexProgressBar::setValue ( uint32_t number )

Set the value of progress bar.

Parameters
number - the value of progress bar.
Return values
true | - success.
false | - failed.
Examples:
CompProgressBar.ino.

Definition at line 52 of file NexProgressBar.cpp.

The documentation for this class was generated from the following files:
  • NexProgressBar.h
  • NexProgressBar.cpp


API: NexText Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | List of all members
NexText Class Reference

NexText,subclass of NexTouch,provides simple methods to control text component. More...

#include <NexText.h>

Inheritance diagram for NexText:
NexTouch

Public Member Functions

NexText (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
void | attachPop (NexTouchEventCb pop, void *ptr=NULL)
Register text pop callback function. More...
void | detachPop (void)
Unload text pop callback function.
uint16_t | getText (char *buffer, uint16_t len)
Get the value of text. More...
bool | setText (const char *buffer)
Set the value of text. More...
- Public Member Functions inherited from NexTouch
NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Additional Inherited Members

- Static Public Member Functions inherited from NexTouch
static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

NexText,subclass of NexTouch,provides simple methods to control text component.

Examples:
CompText.ino.

Definition at line 25 of file NexText.h.

Member Function Documentation

void NexText::attachPop | ( | NexTouchEventCb | pop,
 |  | void * | ptr = NULL
 | ) |  |

Register text pop callback function.

Parameters
pop | - the pointer to text pop callback function.
ptr | - the parameter to be transmitted to text pop callback function.

Definition at line 70 of file NexText.cpp.

uint16_t NexText::getText | ( | char * | buffer,
 |  | uint16_t | len
 | ) |  |

Get the value of text.

Parameters
buffer | - text value buffer.
len | - the length of text value buffer.
Returns
the length of text value buffer.
Examples:
CompText.ino.

Definition at line 35 of file NexText.cpp.

bool NexText::setText ( const char * buffer )

Set the value of text.

Parameters
buffer - text value buffer.
Return values
true | - success.
false | - failed.
Examples:
CompText.ino.

Definition at line 53 of file NexText.cpp.

The documentation for this class was generated from the following files:
  • NexText.h
  • NexText.cpp


API: NexTouch Class Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Public Member Functions | Static Public Member Functions | List of all members
NexTouch Class Reference

Root Class of Nextion Components. More...

#include <NexTouch.h>

Inheritance diagram for NexTouch:
NexButton NexCrop NexHotspot NexPage NexPicture NexPointer NexProgressBar NexText

Public Member Functions

NexTouch (NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch. More...
NexPid | getPid (void)
Get page id. More...
NexCid | getCid (void)
Get component id. More...
const char * | getObjName (void)
Get component name. More...
void | print (void)
Print current object address,page id,component id, component name,pop event function address,push event function address.

Static Public Member Functions

static uint8_t | mainEventLoop (NexTouch **list)
Watting for Nextion's touch event. More...
static void | sendCommand (const char *cmd)
Send command to Nextion. More...
static bool | recvRetCommandFinished (uint32_t timeout=100)
Command is executed successfully. More...
static uint16_t | recvRetString (char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data. More...
static bool | recvRetNumber (uint32_t *number, uint32_t timeout=500)
Receive uint32_t data. More...

Detailed Description

Root Class of Nextion Components.

Examples:
CompButton.ino, CompCrop.ino, CompHotspot.ino, CompPage.ino, CompPicture.ino, CompPointer.ino, CompProgressBar.ino, and CompText.ino.

Definition at line 57 of file NexTouch.h.

Constructor & Destructor Documentation

NexTouch::NexTouch | ( | NexPid | pid,
 |  | NexCid | cid,
 |  | char * | name,
 |  | NexTouchEventCb | pop = NULL,
 |  | void * | pop_ptr = NULL,
 |  | NexTouchEventCb | push = NULL,
 |  | void * | push_ptr = NULL
 | ) |  |

Constructor of Nextouch.

Parameters
pid | - page id.
cid | - component id.
name | - component name.
pop | - pop event function pointer.
pop_ptr | - the parameter was transmitted to pop event function pointer.
push | - push event function pointer.
push_ptr | - the parameter was transmitted to push event function pointer.

Definition at line 69 of file NexTouch.cpp.

Member Function Documentation

NexCid NexTouch::getCid ( void )

Get component id.

Returns
the id of component.

Definition at line 97 of file NexTouch.cpp.

const char * NexTouch::getObjName ( void )

Get component name.

Returns
the name of component.

Definition at line 107 of file NexTouch.cpp.

NexPid NexTouch::getPid ( void )

Get page id.

Returns
the id of page.

Definition at line 87 of file NexTouch.cpp.

uint8_t NexTouch::mainEventLoop ( NexTouch ** list )
static

Watting for Nextion's touch event.

Parameters
list - index to Nextion Components list.

Definition at line 26 of file NexTouch.cpp.

bool NexTouch::recvRetCommandFinished ( uint32_t timeout = 100 )
static

Command is executed successfully.

Parameters
timeout - set timeout time.
Return values
true | - success.
false | - failed.

Definition at line 219 of file NexTouch.cpp.

bool NexTouch::recvRetNumber | ( | uint32_t * | number,
 |  | uint32_t | timeout = 500
 | ) |  |
static

Receive uint32_t data.

Parameters
number | - save uint32_t data.
timeout | - set timeout time.
Return values
true | - success.
false | - failed.

Definition at line 351 of file NexTouch.cpp.

uint16_t NexTouch::recvRetString | ( | char * | buffer,
 |  | uint16_t | len,
 |  | uint32_t | timeout = 500
 | ) |  |
static

Receive string data.

Parameters
buffer | - save string data.
len | - string buffer length.
timeout | - set timeout time.
Returns
the length of string buffer.

Definition at line 279 of file NexTouch.cpp.

void NexTouch::sendCommand ( const char * cmd )
static

Send command to Nextion.

Parameters
cmd - the string of command.

Definition at line 256 of file NexTouch.cpp.

The documentation for this class was generated from the following files:
  • NexTouch.h
  • NexTouch.cpp


API: Class Index

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Class Index
N
N
NexCrop NexPicture NexText
NexHotspot NexPointer NexTouch
NexButton NexPage NexProgressBar
N


API: Class Hierarchy

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
[detail level 12]
▼C NexTouch | Root Class of Nextion Components
C NexButton | NexButton,subclass of NexTouch,provides simple methods to control button component
C NexCrop | NexCrop,subclass of NexTouch,provides simple methods to control crop component
C NexHotspot | NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component
C NexPage | NexPage,subclass of NexTouch,provides simple methods to control page component
C NexPicture | NexPicture,subclass of NexTouch,provides simple methods to control picture component
C NexPointer | NexPointer,subclass of NexTouch,provides simple methods to control pointer component
C NexProgressBar | NexProgressBar,subclass of NexTouch,provides simple methods to control progress bar component
C NexText | NexText,subclass of NexTouch,provides simple methods to control text component


API: Class Members

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • a
  • d
  • g
  • m
  • n
  • p
  • r
  • s
Here is a list of all documented class members with links to the class documentation for each member:

- a -

  • attachPop() : NexButton , NexCrop , NexHotspot , NexPage , NexPicture , NexText
  • attachPush() : NexHotspot

- d -

  • detachPop() : NexButton , NexCrop , NexHotspot , NexPage , NexPicture , NexText
  • detachPush() : NexHotspot

- g -

  • getCid() : NexTouch
  • getObjName() : NexTouch
  • getPic() : NexPicture
  • getPid() : NexTouch
  • getText() : NexButton , NexText
  • getValue() : NexPointer , NexProgressBar

- m -

  • mainEventLoop() : NexTouch

- n -

  • NexButton() : NexButton
  • NexCrop() : NexCrop
  • NexHotspot() : NexHotspot
  • NexPage() : NexPage
  • NexPicture() : NexPicture
  • NexPointer() : NexPointer
  • NexProgressBar() : NexProgressBar
  • NexText() : NexText
  • NexTouch() : NexTouch

- p -

  • print() : NexTouch

- r -

  • recvRetCommandFinished() : NexTouch
  • recvRetNumber() : NexTouch
  • recvRetString() : NexTouch

- s -

  • sendCommand() : NexTouch
  • setPic() : NexPicture
  • setText() : NexButton , NexText
  • setValue() : NexPointer , NexProgressBar
  • show() : NexPage


API: Class Members - Functions

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • All
  • Functions
  • a
  • d
  • g
  • m
  • n
  • p
  • r
  • s

- a -

  • attachPop() : NexButton , NexCrop , NexHotspot , NexPage , NexPicture , NexText
  • attachPush() : NexHotspot

- d -

  • detachPop() : NexButton , NexCrop , NexHotspot , NexPage , NexPicture , NexText
  • detachPush() : NexHotspot

- g -

  • getCid() : NexTouch
  • getObjName() : NexTouch
  • getPic() : NexPicture
  • getPid() : NexTouch
  • getText() : NexButton , NexText
  • getValue() : NexPointer , NexProgressBar

- m -

  • mainEventLoop() : NexTouch

- n -

  • NexButton() : NexButton
  • NexCrop() : NexCrop
  • NexHotspot() : NexHotspot
  • NexPage() : NexPage
  • NexPicture() : NexPicture
  • NexPointer() : NexPointer
  • NexProgressBar() : NexProgressBar
  • NexText() : NexText
  • NexTouch() : NexTouch

- p -

  • print() : NexTouch

- r -

  • recvRetCommandFinished() : NexTouch
  • recvRetNumber() : NexTouch
  • recvRetString() : NexTouch

- s -

  • sendCommand() : NexTouch
  • setPic() : NexPicture
  • setText() : NexButton , NexText
  • setValue() : NexPointer , NexProgressBar
  • show() : NexPage


API: File List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
File List
Here is a list of all documented files with brief descriptions:
[detail level 123]
▼ examples |
▼ CompButton |
CompButton.ino |
▼ CompCrop |
CompCrop.ino |
▼ CompHotspot |
CompHotspot.ino |
▼ CompPage |
CompPage.ino |
▼ CompPicture |
CompPicture.ino |
▼ CompPointer |
CompPointer.ino |
▼ CompProgressBar |
CompProgressBar.ino |
▼ CompText |
CompText.ino |
NexButton.cpp | API of NexButton
NexButton.h | API of NexButton
NexCrop.cpp | API of NexCrop
NexCrop.h | API of NexCrop
NexHotspot.cpp | API of NexHotspot
NexHotspot.h | API of NexHotspot
NexPage.cpp | API of NexPage
NexPage.h | API of NexPage
NexPicture.cpp | API of NexPicture
NexPicture.h | API of NexPicture
NexPointer.cpp | API of Nexpointer
NexPointer.h | API of NexPointer
NexProgressBar.cpp | API of NexProgressBar
NexProgressBar.h | API of NexProgressBar
NexSerialConfig.h | Serial configure
NexText.cpp | API of NexText
NexText.h | API of NexText
NexTouch.cpp | API of Nextion
NexTouch.h | API of Nextion


API: examples Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
examples Directory Reference

Directories

directory | CompButton
directory | CompCrop
directory | CompHotspot
directory | CompPage
directory | CompPicture
directory | CompPointer
directory | CompProgressBar
directory | CompText


API: examples/CompButton Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompButton
CompButton Directory Reference

Files

file CompButton.ino [code]


API: examples/CompButton/CompButton.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompButton
CompButton.ino
1
16 #include "NexButton.h"
17
18 NexButton b0 = NexButton(0, 1, "b0");
19 char buffer[100] = {0};
20
21 NexTouch *nex_listen_list[] =
22 {
23 &b0,
24 NULL
25 };
26
27 void b0PopCallback(void *ptr)
28 {
29 uint16_t len;
30 uint16_t number;
31 NexButton *btn = (NexButton *)ptr;
32 dbSerialPrintln("b0PopCallback");
33 dbSerialPrint("ptr=");
34 dbSerialPrintln((uint32_t)ptr);
35 memset(buffer, 0, sizeof(buffer));
36 btn->getText(buffer, sizeof(buffer));
37
38 number = atoi(buffer);
39 number += 1;
40
41 memset(buffer, 0, sizeof(buffer));
42 itoa(number, buffer, 10);
43
44 btn->setText(buffer);
45 }
46
47 void setup(void)
48 {
49 nexInit();
50 b0.attachPop(b0PopCallback, &b0);
51 dbSerialPrintln("setup done");
52 }
53
54 void loop(void)
55 {
56 nexLoop(nex_listen_list);
57 }
NexButton::getText
uint16_t getText(char *buffer, uint16_t len)
Get text value from button component.
Definition: NexButton.cpp:35
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexButton.h
API of NexButton.
NexButton::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register button pop callback function.
Definition: NexButton.cpp:70
NexButton
NexButton,subclass of NexTouch,provides simple methods to control button component.
Definition: NexButton.h:25
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexButton::setText
bool setText(const char *buffer)
Set text value of button component.
Definition: NexButton.cpp:53
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: examples/CompCrop Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompCrop
CompCrop Directory Reference

Files

file CompCrop.ino [code]


API: examples/CompCrop/CompCrop.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompCrop
CompCrop.ino
1
16 #include "NexCrop.h"
17
18 NexCrop q0 = NexCrop(0, 1, "q0");
19
20 NexTouch *nex_listen_list[] =
21 {
22 &q0,
23 NULL
24 };
25
26 void q0PopCallback(void *ptr)
27 {
28 uint32_t number = 0;
29 dbSerialPrintln("q0PopCallback");
30
31 q0.getPic(&number);
32
33 number += 1;
34 number %= 2;
35
36 q0.setPic(number);
37 }
38
39
40 void setup(void)
41 {
42 nexInit();
43 q0.attachPop(q0PopCallback);
44 dbSerialPrintln("setup done");
45 }
46
47 void loop(void)
48 {
49 nexLoop(nex_listen_list);
50 }
51
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexCrop.h
API of NexCrop.
NexCrop::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register crop pop callback function.
Definition: NexCrop.cpp:72
NexCrop
NexCrop,subclass of NexTouch,provides simple methods to control crop component.
Definition: NexCrop.h:25
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: examples/CompHotspot Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompHotspot
CompHotspot Directory Reference

Files

file CompHotspot.ino [code]


API: examples/CompHotspot/CompHotspot.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompHotspot
CompHotspot.ino
1
16 #include "NexHotspot.h"
17
18 NexHotspot hot0 = NexHotspot(0, 1, "hot0");
19 NexHotspot hot1 = NexHotspot(0, 2, "hot1");
20
21 NexTouch *nex_listen_list[] =
22 {
23 &hot0,
24 &hot1,
25 NULL
26 };
27
28 void hot0PushCallback(void *ptr)
29 {
30 dbSerialPrintln("hot0PushCallback");
31 dbSerialPrint("ptr=");
32 dbSerialPrintln((uint32_t)ptr);
33 }
34
35 void hot1PushCallback(void *ptr)
36 {
37 dbSerialPrintln("hot1PushCallback");
38 dbSerialPrint("ptr=");
39 dbSerialPrintln((uint32_t)ptr);
40 }
41
42 void hot0PopCallback(void *ptr)
43 {
44 dbSerialPrintln("hot0PopCallback");
45 dbSerialPrint("ptr=");
46 dbSerialPrintln((uint32_t)ptr);
47 }
48
49 void hot1PopCallback(void *ptr)
50 {
51 dbSerialPrintln("hot1PopCallback");
52 dbSerialPrint("ptr=");
53 dbSerialPrintln((uint32_t)ptr);
54 }
55
56 void setup(void)
57 {
58 nexInit();
59 hot0.attachPush(hot0PushCallback, &hot0);
60 hot0.attachPop(hot0PopCallback, &hot0);
61 hot1.attachPush(hot1PushCallback, &hot1);
62 hot1.attachPop(hot1PopCallback, &hot1);
63 dbSerialPrintln("setup done");
64 }
65
66 void loop(void)
67 {
68 nexLoop(nex_listen_list);
69 }
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexHotspot.h
API of NexHotspot.
NexHotspot
NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component.
Definition: NexHotspot.h:25
NexHotspot::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register hotspot pop callback function.
Definition: NexHotspot.cpp:55
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexHotspot::attachPush
void attachPush(NexTouchEventCb push, void *ptr=NULL)
Register hotspot push callback function.
Definition: NexHotspot.cpp:35


API: examples/CompPage Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompPage
CompPage Directory Reference

Files

file CompPage.ino [code]


API: examples/CompPage/CompPage.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompPage
CompPage.ino
1
16 #include "NexPage.h"
17
18 NexPage page0 = NexPage(0, 0, "page0");
19 NexPage page1 = NexPage(1, 0, "page1");
20 NexPage page2 = NexPage(2, 0, "page2");
21 NexPage page3 = NexPage(3, 0, "page3");
22
23 NexTouch *nex_listen_list[] =
24 {
25 &page0,
26 &page1,
27 &page2,
28 &page3,
29 NULL
30 };
31
32 void page0PopCallback(void *ptr)
33 {
34 dbSerialPrintln("page0PopCallback");
35 page1.show();
36 }
37
38 void page1PopCallback(void *ptr)
39 {
40 dbSerialPrintln("page1PopCallback");
41 page2.show();
42 }
43
44 void page2PopCallback(void *ptr)
45 {
46 dbSerialPrintln("page2PopCallback");
47 page3.show();
48 }
49
50 void page3PopCallback(void *ptr)
51 {
52 dbSerialPrintln("page3PopCallback");
53 page0.show();
54 }
55
56 void setup(void)
57 {
58 nexInit();
59 dbSerialPrintln("setup begin");
60
61 page0.attachPop(page0PopCallback);
62 page1.attachPop(page1PopCallback);
63 page2.attachPop(page2PopCallback);
64 page3.attachPop(page3PopCallback);
65
66 dbSerialPrintln("setup end");
67 }
68
69 void loop(void)
70 {
71 nexLoop(nex_listen_list);
72 }
NexPage::show
bool show(void)
Change page.
Definition: NexPage.cpp:33
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexPage.h
API of NexPage.
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexPage
NexPage,subclass of NexTouch,provides simple methods to control page component.
Definition: NexPage.h:25
NexPage::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register page pop callback function.
Definition: NexPage.cpp:55
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: examples/CompPicture Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompPicture
CompPicture Directory Reference

Files

file CompPicture.ino [code]


API: examples/CompPicture/CompPicture.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompPicture
CompPicture.ino
1
16 #include "NexPicture.h"
17
18 NexPicture p0 = NexPicture(0, 1, "p0");
19
20 NexTouch *nex_listen_list[] =
21 {
22 &p0,
23 NULL
24 };
25
26 void p0PopCallback(void *ptr)
27 {
28 uint32_t number = 0;
29 dbSerialPrintln("p0PopCallback");
30
31 p0.getPic(&number);
32
33 if (number == 1)
34 {
35 number = 2;
36 }
37 else
38 {
39 number = 1;
40 }
41
42 p0.setPic(number);
43 }
44
45
46 void setup(void)
47 {
48 nexInit();
49 p0.attachPop(p0PopCallback);
50 dbSerialPrintln("setup done");
51 }
52
53 void loop(void)
54 {
55 nexLoop(nex_listen_list);
56 }
57
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexPicture::setPic
bool setPic(uint32_t number)
Set picture's number.
Definition: NexPicture.cpp:52
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexPicture
NexPicture,subclass of NexTouch,provides simple methods to control picture component.
Definition: NexPicture.h:25
NexPicture::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register picture pop callback function.
Definition: NexPicture.cpp:72
NexPicture::getPic
bool getPic(uint32_t *number)
Get picture's number.
Definition: NexPicture.cpp:35
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexPicture.h
API of NexPicture.


API: examples/CompPointer Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompPointer
CompPointer Directory Reference

Files

file CompPointer.ino [code]


API: examples/CompPointer/CompPointer.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompPointer
CompPointer.ino
1
16 #include "NexPointer.h"
17 #include "NexButton.h"
18
19 NexPointer pointer = NexPointer(0, 1, "pointer");
20 NexButton btn_up = NexButton(0, 2, "btn_up");
21 NexButton btn_down = NexButton(0, 3, "btn_down");
22
23 NexTouch *nex_listen_list[] =
24 {
25 &btn_up,
26 &btn_down,
27 NULL
28 };
29
30 void buttonUpPopCallback(void *ptr)
31 {
32 uint32_t number = 0;
33 dbSerialPrintln("buttonUpPopCallback");
34
35 pointer.getValue(&number);
36
37 number += 5;
38 if (number >= 360)
39 {
40 number = 0;
41 }
42
43 pointer.setValue(number);
44 }
45 void buttonDownPopCallback(void *ptr)
46 {
47 uint32_t number = 0;
48 dbSerialPrintln("buttonDownPopCallback");
49
50 pointer.getValue(&number);
51
52 if (number >= 5)
53 {
54 number -= 5;
55 }
56
57 pointer.setValue(number);
58 }
59
60
61
62 void setup(void)
63 {
64 nexInit();
65 btn_up.attachPop(buttonUpPopCallback);
66 btn_down.attachPop(buttonDownPopCallback);
67 dbSerialPrintln("setup done");
68 }
69
70 void loop(void)
71 {
72 nexLoop(nex_listen_list);
73 }
74
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexButton.h
API of NexButton.
NexButton::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register button pop callback function.
Definition: NexButton.cpp:70
NexPointer::getValue
bool getValue(uint32_t *number)
Get the value of pointer.
Definition: NexPointer.cpp:35
NexPointer
NexPointer,subclass of NexTouch,provides simple methods to control pointer component.
Definition: NexPointer.h:25
NexButton
NexButton,subclass of NexTouch,provides simple methods to control button component.
Definition: NexButton.h:25
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexPointer::setValue
bool setValue(uint32_t number)
Set the value of pointer.
Definition: NexPointer.cpp:52
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexPointer.h
API of NexPointer.


API: examples/CompProgressBar Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompProgressBar
CompProgressBar Directory Reference

Files

file CompProgressBar.ino [code]


API: examples/CompProgressBar/CompProgressBar.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompProgressBar
CompProgressBar.ino
1
16 #include "NexProgressBar.h"
17 #include "NexButton.h"
18
19 NexProgressBar j0 = NexProgressBar(0, 3, "j0");
20 NexButton btn_up = NexButton(0, 1, "btn_up");
21 NexButton btn_down = NexButton(0, 2, "btn_down");
22
23 NexTouch *nex_listen_list[] =
24 {
25 &btn_up,
26 &btn_down,
27 NULL
28 };
29
30 void buttonUpPopCallback(void *ptr)
31 {
32 uint32_t number = 0;
33 dbSerialPrintln("buttonUpPopCallback");
34
35 j0.getValue(&number);
36
37 number += 5;
38 if (number >= 100)
39 {
40 number = 100;
41 }
42
43 j0.setValue(number);
44 }
45 void buttonDownPopCallback(void *ptr)
46 {
47 uint32_t number = 0;
48 dbSerialPrintln("buttonDownPopCallback");
49
50 j0.getValue(&number);
51
52 if (number >= 5)
53 {
54 number -= 5;
55 }
56
57 j0.setValue(number);
58 }
59
60
61
62 void setup(void)
63 {
64 nexInit();
65 btn_up.attachPop(buttonUpPopCallback);
66 btn_down.attachPop(buttonDownPopCallback);
67 dbSerialPrintln("setup done");
68 }
69
70 void loop(void)
71 {
72 nexLoop(nex_listen_list);
73 }
74
NexProgressBar::setValue
bool setValue(uint32_t number)
Set the value of progress bar.
Definition: NexProgressBar.cpp:52
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexButton.h
API of NexButton.
NexButton::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register button pop callback function.
Definition: NexButton.cpp:70
NexButton
NexButton,subclass of NexTouch,provides simple methods to control button component.
Definition: NexButton.h:25
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexProgressBar::getValue
bool getValue(uint32_t *number)
Get the value of progress bar.
Definition: NexProgressBar.cpp:35
NexProgressBar.h
API of NexProgressBar.
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexProgressBar
NexProgressBar,subclass of NexTouch,provides simple methods to control progress bar component...
Definition: NexProgressBar.h:25


API: examples/CompText Directory Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • examples
  • CompText
CompText Directory Reference

Files

file CompText.ino [code]


API: examples/CompText/CompText.ino Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • examples
  • CompText
CompText.ino
1
16 #include "NexButton.h"
17 #include "NexText.h"
18
19 void t0PopCallback(void *ptr);
20 void b0PopCallback(void *ptr);
21 void b1PopCallback(void *ptr);
22
23 NexText t0 = NexText(0, 1, "t0", t0PopCallback);
24 NexButton b0 = NexButton(0, 2, "b0", b0PopCallback);
25 NexButton b1 = NexButton(0, 3, "b1", b1PopCallback);
26
27 char buffer[100] = {0};
28
29 NexTouch *nex_listen_list[] =
30 {
31 &t0,
32 &b0,
33 &b1,
34 NULL
35 };
36
37 void t0PopCallback(void *ptr)
38 {
39 dbSerialPrintln("t0PopCallback");
40 t0.setText("50");
41 }
42
43 void b0PopCallback(void *ptr)
44 {
45 uint16_t len;
46 uint16_t number;
47
48 dbSerialPrintln("b0PopCallback");
49
50 memset(buffer, 0, sizeof(buffer));
51 t0.getText(buffer, sizeof(buffer));
52
53 number = atoi(buffer);
54 number += 1;
55
56 memset(buffer, 0, sizeof(buffer));
57 itoa(number, buffer, 10);
58
59 t0.setText(buffer);
60 }
61
62 void b1PopCallback(void *ptr)
63 {
64 uint16_t len;
65 uint16_t number;
66
67 dbSerialPrintln("b1PopCallback");
68
69 memset(buffer, 0, sizeof(buffer));
70 t0.getText(buffer, sizeof(buffer));
71
72 number = atoi(buffer);
73 number -= 1;
74
75 memset(buffer, 0, sizeof(buffer));
76 itoa(number, buffer, 10);
77
78 t0.setText(buffer);
79 }
80
81 void setup(void)
82 {
83 nexInit();
84 dbSerialPrintln("setup done");
85 }
86
87 void loop(void)
88 {
89 nexLoop(nex_listen_list);
90 }
91
NexText::setText
bool setText(const char *buffer)
Set the value of text.
Definition: NexText.cpp:53
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexText.h
API of NexText.
NexButton.h
API of NexButton.
NexButton
NexButton,subclass of NexTouch,provides simple methods to control button component.
Definition: NexButton.h:25
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexText::getText
uint16_t getText(char *buffer, uint16_t len)
Get the value of text.
Definition: NexText.cpp:35
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexText
NexText,subclass of NexTouch,provides simple methods to control text component.
Definition: NexText.h:25


API: NexButton.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexButton.cpp File Reference

API of NexButton. More...

#include "NexButton.h"

Go to the source code of this file.

Detailed Description

API of NexButton.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexButton.cpp.


API: NexButton.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexButton.h File Reference

API of NexButton. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexButton
NexButton,subclass of NexTouch,provides simple methods to control button component. More...

Detailed Description

API of NexButton.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexButton.h.


API: NexCrop.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexCrop.cpp File Reference

API of NexCrop. More...

#include "NexCrop.h"

Go to the source code of this file.

Detailed Description

API of NexCrop.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexCrop.cpp.


API: NexCrop.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexCrop.h File Reference

API of NexCrop. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexCrop
NexCrop,subclass of NexTouch,provides simple methods to control crop component. More...

Detailed Description

API of NexCrop.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexCrop.h.


API: NexHotspot.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexHotspot.cpp File Reference

API of NexHotspot. More...

#include "NexHotspot.h"

Go to the source code of this file.

Detailed Description

API of NexHotspot.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexHotspot.cpp.


API: NexHotspot.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexHotspot.h File Reference

API of NexHotspot. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexHotspot
NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component. More...

Detailed Description

API of NexHotspot.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexHotspot.h.


API: NexPage.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPage.cpp File Reference

API of NexPage. More...

#include "NexPage.h"

Go to the source code of this file.

Detailed Description

API of NexPage.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexPage.cpp.


API: NexPage.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexPage.h File Reference

API of NexPage. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexPage
NexPage,subclass of NexTouch,provides simple methods to control page component. More...

Detailed Description

API of NexPage.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexPage.h.


API: NexPicture.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPicture.cpp File Reference

API of NexPicture. More...

#include "NexPicture.h"

Go to the source code of this file.

Detailed Description

API of NexPicture.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexPicture.cpp.


API: NexPicture.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexPicture.h File Reference

API of NexPicture. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexPicture
NexPicture,subclass of NexTouch,provides simple methods to control picture component. More...

Detailed Description

API of NexPicture.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexPicture.h.


API: NexPointer.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPointer.cpp File Reference

API of Nexpointer. More...

#include "NexPointer.h"

Go to the source code of this file.

Detailed Description

API of Nexpointer.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexPointer.cpp.


API: NexPointer.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexPointer.h File Reference

API of NexPointer. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexPointer
NexPointer,subclass of NexTouch,provides simple methods to control pointer component. More...

Detailed Description

API of NexPointer.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexPointer.h.


API: NexProgressBar.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexProgressBar.cpp File Reference

API of NexProgressBar. More...

#include "NexProgressBar.h"

Go to the source code of this file.

Detailed Description

API of NexProgressBar.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexProgressBar.cpp.


API: NexProgressBar.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexProgressBar.h File Reference

API of NexProgressBar. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexProgressBar
NexProgressBar,subclass of NexTouch,provides simple methods to control progress bar component. More...

Detailed Description

API of NexProgressBar.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexProgressBar.h.


API: NexSerialConfig.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexSerialConfig.h File Reference

Serial configure. More...

Go to the source code of this file.

Detailed Description

Serial configure.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexSerialConfig.h.


API: NexText.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexText.cpp File Reference

API of NexText. More...

#include "NexText.h"

Go to the source code of this file.

Detailed Description

API of NexText.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexText.cpp.


API: NexText.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes
NexText.h File Reference

API of NexText. More...

#include "NexTouch.h"

Go to the source code of this file.

Classes

class NexText
NexText,subclass of NexTouch,provides simple methods to control text component. More...

Detailed Description

API of NexText.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexText.h.


API: NexTouch.cpp File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Functions
NexTouch.cpp File Reference

API of Nextion. More...

#include "NexTouch.h"

Go to the source code of this file.

Functions

bool | nexInit (void)
Init Nextion's baudrate,page id. More...
bool | nexLoop (NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event. More...

Detailed Description

API of Nextion.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexTouch.cpp.

Function Documentation

bool nexInit ( void )

Init Nextion's baudrate,page id.

Return values
true | - success.
false | - failed.
Examples:
CompButton.ino, CompCrop.ino, CompHotspot.ino, CompPage.ino, CompPicture.ino, CompPointer.ino, CompProgressBar.ino, and CompText.ino.

Definition at line 398 of file NexTouch.cpp.

bool nexLoop ( NexTouch ** nex_listen_list )

Call mainEventLoop,watting for Nextion's touch event.

Parameters
nex_listen_list - index to Nextion Components list.
Return values
false - failed.
Examples:
CompButton.ino, CompCrop.ino, CompHotspot.ino, CompPage.ino, CompPicture.ino, CompPointer.ino, CompProgressBar.ino, and CompText.ino.

Definition at line 415 of file NexTouch.cpp.


API: NexTouch.h File Reference

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
Classes | Functions
NexTouch.h File Reference

API of Nextion. More...

#include <Arduino.h>
#include "NexSerialConfig.h"

Go to the source code of this file.

Classes

class NexTouch
Root Class of Nextion Components. More...

Functions

bool | nexInit (void)
Init Nextion's baudrate,page id. More...
bool | nexLoop (NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event. More...

Detailed Description

API of Nextion.

Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Definition in file NexTouch.h.

Function Documentation

bool nexInit ( void )

Init Nextion's baudrate,page id.

Return values
true | - success.
false | - failed.

Definition at line 398 of file NexTouch.cpp.

bool nexLoop ( NexTouch ** nex_listen_list )

Call mainEventLoop,watting for Nextion's touch event.

Parameters
nex_listen_list - index to Nextion Components list.
Return values
false - failed.

Definition at line 415 of file NexTouch.cpp.


API: File Members

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • All
  • Functions
Here is a list of all documented file members with links to the documentation:
  • nexInit() : NexTouch.cpp , NexTouch.h
  • nexLoop() : NexTouch.cpp , NexTouch.h


API: File Members

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
  • All
  • Functions
  • nexInit() : NexTouch.cpp , NexTouch.h
  • nexLoop() : NexTouch.cpp , NexTouch.h


API: Examples

API
  • Related Pages
  • Classes
  • Files
  • Examples
Examples
Here is a list of all examples:
  • CompButton.ino
  • CompCrop.ino
  • CompHotspot.ino
  • CompPage.ino
  • CompPicture.ino
  • CompPointer.ino
  • CompProgressBar.ino
  • CompText.ino


API: CompButton.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompButton.ino
Show how to use API of class NexButton.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexButton.h"
NexButton b0 = NexButton(0, 1, "b0");
char buffer[100] = {0};
NexTouch *nex_listen_list[] =
{
&b0,
NULL
};
void b0PopCallback(void *ptr)
{
uint16_t len;
uint16_t number;
NexButton *btn = (NexButton *)ptr;
dbSerialPrintln("b0PopCallback");
dbSerialPrint("ptr=");
dbSerialPrintln((uint32_t)ptr);
memset(buffer, 0, sizeof(buffer));
btn->getText(buffer, sizeof(buffer));
number = atoi(buffer);
number += 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
btn->setText(buffer);
}
void setup(void)
{
nexInit();
b0.attachPop(b0PopCallback, &b0);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: CompCrop.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompCrop.ino
Show how to use API of class NexCrop.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexCrop.h"
NexCrop q0 = NexCrop(0, 1, "q0");
NexTouch *nex_listen_list[] =
{
&q0,
NULL
};
void q0PopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("q0PopCallback");
q0.getPic(&number);
number += 1;
number %= 2;
q0.setPic(number);
}
void setup(void)
{
nexInit();
q0.attachPop(q0PopCallback);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: CompHotspot.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompHotspot.ino
Show how to use API of class NexHotspot.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexHotspot.h"
NexHotspot hot0 = NexHotspot(0, 1, "hot0");
NexHotspot hot1 = NexHotspot(0, 2, "hot1");
NexTouch *nex_listen_list[] =
{
&hot0,
&hot1,
NULL
};
void hot0PushCallback(void *ptr)
{
dbSerialPrintln("hot0PushCallback");
dbSerialPrint("ptr=");
dbSerialPrintln((uint32_t)ptr);
}
void hot1PushCallback(void *ptr)
{
dbSerialPrintln("hot1PushCallback");
dbSerialPrint("ptr=");
dbSerialPrintln((uint32_t)ptr);
}
void hot0PopCallback(void *ptr)
{
dbSerialPrintln("hot0PopCallback");
dbSerialPrint("ptr=");
dbSerialPrintln((uint32_t)ptr);
}
void hot1PopCallback(void *ptr)
{
dbSerialPrintln("hot1PopCallback");
dbSerialPrint("ptr=");
dbSerialPrintln((uint32_t)ptr);
}
void setup(void)
{
nexInit();
hot0.attachPush(hot0PushCallback, &hot0);
hot0.attachPop(hot0PopCallback, &hot0);
hot1.attachPush(hot1PushCallback, &hot1);
hot1.attachPop(hot1PopCallback, &hot1);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: CompPage.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompPage.ino
Show how to use API of class NexPage.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexPage.h"
NexPage page0 = NexPage(0, 0, "page0");
NexPage page1 = NexPage(1, 0, "page1");
NexPage page2 = NexPage(2, 0, "page2");
NexPage page3 = NexPage(3, 0, "page3");
NexTouch *nex_listen_list[] =
{
&page0,
&page1,
&page2,
&page3,
NULL
};
void page0PopCallback(void *ptr)
{
dbSerialPrintln("page0PopCallback");
page1.show();
}
void page1PopCallback(void *ptr)
{
dbSerialPrintln("page1PopCallback");
page2.show();
}
void page2PopCallback(void *ptr)
{
dbSerialPrintln("page2PopCallback");
page3.show();
}
void page3PopCallback(void *ptr)
{
dbSerialPrintln("page3PopCallback");
page0.show();
}
void setup(void)
{
nexInit();
dbSerialPrintln("setup begin");
page0.attachPop(page0PopCallback);
page1.attachPop(page1PopCallback);
page2.attachPop(page2PopCallback);
page3.attachPop(page3PopCallback);
dbSerialPrintln("setup end");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: CompPicture.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompPicture.ino
Show how to use API of class NexPicture.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexPicture.h"
NexPicture p0 = NexPicture(0, 1, "p0");
NexTouch *nex_listen_list[] =
{
&p0,
NULL
};
void p0PopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("p0PopCallback");
p0.getPic(&number);
if (number == 1)
{
number = 2;
}
else
{
number = 1;
}
p0.setPic(number);
}
void setup(void)
{
nexInit();
p0.attachPop(p0PopCallback);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: CompPointer.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompPointer.ino
Show how to use API of class NexPointer.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexPointer.h"
#include "NexButton.h"
NexPointer pointer = NexPointer(0, 1, "pointer");
NexButton btn_up = NexButton(0, 2, "btn_up");
NexButton btn_down = NexButton(0, 3, "btn_down");
NexTouch *nex_listen_list[] =
{
&btn_up,
&btn_down,
NULL
};
void buttonUpPopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("buttonUpPopCallback");
pointer.getValue(&number);
number += 5;
if (number >= 360)
{
number = 0;
}
pointer.setValue(number);
}
void buttonDownPopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("buttonDownPopCallback");
pointer.getValue(&number);
if (number >= 5)
{
number -= 5;
}
pointer.setValue(number);
}
void setup(void)
{
nexInit();
btn_up.attachPop(buttonUpPopCallback);
btn_down.attachPop(buttonDownPopCallback);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: CompProgressBar.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompProgressBar.ino
Show how to use API of class NexProgressBar.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexProgressBar.h"
#include "NexButton.h"
NexProgressBar j0 = NexProgressBar(0, 3, "j0");
NexButton btn_up = NexButton(0, 1, "btn_up");
NexButton btn_down = NexButton(0, 2, "btn_down");
NexTouch *nex_listen_list[] =
{
&btn_up,
&btn_down,
NULL
};
void buttonUpPopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("buttonUpPopCallback");
j0.getValue(&number);
number += 5;
if (number >= 100)
{
number = 100;
}
j0.setValue(number);
}
void buttonDownPopCallback(void *ptr)
{
uint32_t number = 0;
dbSerialPrintln("buttonDownPopCallback");
j0.getValue(&number);
if (number >= 5)
{
number -= 5;
}
j0.setValue(number);
}
void setup(void)
{
nexInit();
btn_up.attachPop(buttonUpPopCallback);
btn_down.attachPop(buttonDownPopCallback);
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: CompText.ino

API
  • Related Pages
  • Classes
  • Files
  • Examples
CompText.ino
Show how to use API of class NexText.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
Copyright
Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
#include "NexButton.h"
#include "NexText.h"
void t0PopCallback(void *ptr);
void b0PopCallback(void *ptr);
void b1PopCallback(void *ptr);
NexText t0 = NexText(0, 1, "t0", t0PopCallback);
NexButton b0 = NexButton(0, 2, "b0", b0PopCallback);
NexButton b1 = NexButton(0, 3, "b1", b1PopCallback);
char buffer[100] = {0};
NexTouch *nex_listen_list[] =
{
&t0,
&b0,
&b1,
NULL
};
void t0PopCallback(void *ptr)
{
dbSerialPrintln("t0PopCallback");
t0.setText("50");
}
void b0PopCallback(void *ptr)
{
uint16_t len;
uint16_t number;
dbSerialPrintln("b0PopCallback");
memset(buffer, 0, sizeof(buffer));
t0.getText(buffer, sizeof(buffer));
number = atoi(buffer);
number += 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
t0.setText(buffer);
}
void b1PopCallback(void *ptr)
{
uint16_t len;
uint16_t number;
dbSerialPrintln("b1PopCallback");
memset(buffer, 0, sizeof(buffer));
t0.getText(buffer, sizeof(buffer));
number = atoi(buffer);
number -= 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
t0.setText(buffer);
}
void setup(void)
{
nexInit();
dbSerialPrintln("setup done");
}
void loop(void)
{
nexLoop(nex_listen_list);
}


API: NexButton.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexButton.cpp
Go to the documentation of this file.
1
16 #include "NexButton.h"
17
22 NexButton::NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr)
23 :NexTouch(pid, cid, name, pop, pop_ptr)
24 {
25 }
26
35 uint16_t NexButton::getText(char *buffer, uint16_t len)
36 {
37 String cmd;
38 cmd += "get ";
39 cmd += getObjName();
40 cmd += ".txt";
41 sendCommand(cmd.c_str());
42 return recvRetString(buffer,len);
43 }
44
53 bool NexButton::setText(const char *buffer)
54 {
55 String cmd;
56 cmd += getObjName();
57 cmd += ".txt=\"";
58 cmd += buffer;
59 cmd += "\"";
60 sendCommand(cmd.c_str());
61 return recvRetCommandFinished();
62 }
63
70 void NexButton::attachPop(NexTouchEventCb pop, void *ptr)
71 {
72 NexTouch::attachPop(pop, ptr);
73 }
74
79 void NexButton::detachPop(void)
80 {
81 NexTouch::detachPop();
82 }
83
84
NexButton::NexButton
NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexButton.cpp:22
NexButton::getText
uint16_t getText(char *buffer, uint16_t len)
Get text value from button component.
Definition: NexButton.cpp:35
NexButton.h
API of NexButton.
NexButton::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register button pop callback function.
Definition: NexButton.cpp:70
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexButton::setText
bool setText(const char *buffer)
Set text value of button component.
Definition: NexButton.cpp:53
NexTouch::recvRetString
static uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data.
Definition: NexTouch.cpp:279
NexButton::detachPop
void detachPop(void)
Unload button pop callback function.
Definition: NexButton.cpp:79
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexButton.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexButton.h
Go to the documentation of this file.
1
16 #ifndef __NEXBUTTON_H__
17 #define __NEXBUTTON_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexButton: public NexTouch
26 {
27 public: /* methods */
28 NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop = NULL, void *pop_ptr = NULL);
29
30 void attachPop(NexTouchEventCb pop, void *ptr = NULL);
31 void detachPop(void);
32
33 uint16_t getText(char *buffer, uint16_t len);
34 bool setText(const char *buffer);
35 };
36
37 #endif /* #ifdef __cplusplus */
38 #endif /* #ifndef __NEXBUTTON_H__ */
NexButton::NexButton
NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexButton.cpp:22
NexButton::getText
uint16_t getText(char *buffer, uint16_t len)
Get text value from button component.
Definition: NexButton.cpp:35
NexButton::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register button pop callback function.
Definition: NexButton.cpp:70
NexButton
NexButton,subclass of NexTouch,provides simple methods to control button component.
Definition: NexButton.h:25
NexButton::setText
bool setText(const char *buffer)
Set text value of button component.
Definition: NexButton.cpp:53
NexTouch.h
API of Nextion.
NexButton::detachPop
void detachPop(void)
Unload button pop callback function.
Definition: NexButton.cpp:79
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexCrop.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexCrop.cpp
Go to the documentation of this file.
1
16 #include "NexCrop.h"
17
22 NexCrop::NexCrop(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr)
23 :NexTouch(pid, cid, name, pop, pop_ptr)
24 {
25 }
26
27 /*
28 * Get the number of picture.
29 *
30 * @param number - an output parameter to save the number of picture.
31 *
32 * @retval true - success.
33 * @retval false - failed.
34 */
35 bool NexCrop::getPic(uint32_t *number)
36 {
37 String cmd = String("get ");
38 cmd += getObjName();
39 cmd += ".picc";
40 sendCommand(cmd.c_str());
41 return recvRetNumber(number);
42 }
43
44 /*
45 * Set the number of picture.
46 *
47 * @param number - the number of picture.
48 *
49 * @retval true - success.
50 * @retval false - failed.
51 */
52 bool NexCrop::setPic(uint32_t number)
53 {
54 char buf[10] = {0};
55 String cmd;
56
57 utoa(number, buf, 10);
58 cmd += getObjName();
59 cmd += ".picc=";
60 cmd += buf;
61
62 sendCommand(cmd.c_str());
63 return recvRetCommandFinished();
64 }
65
72 void NexCrop::attachPop(NexTouchEventCb pop, void *ptr)
73 {
74 NexTouch::attachPop(pop, ptr);
75 }
76
81 void NexCrop::detachPop(void)
82 {
83 NexTouch::detachPop();
84 }
85
NexCrop::NexCrop
NexCrop(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexCrop.cpp:22
NexCrop::detachPop
void detachPop(void)
Unload crop pop callback function.
Definition: NexCrop.cpp:81
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexCrop.h
API of NexCrop.
NexCrop::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register crop pop callback function.
Definition: NexCrop.cpp:72
NexTouch::recvRetNumber
static bool recvRetNumber(uint32_t *number, uint32_t timeout=500)
Receive uint32_t data.
Definition: NexTouch.cpp:351
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexCrop.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexCrop.h
Go to the documentation of this file.
1
16 #ifndef __NEXCROP_H__
17 #define __NEXCROP_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexCrop: public NexTouch
26 {
27 public: /* methods */
28 NexCrop(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop = NULL, void *pop_ptr = NULL);
29
30 void attachPop(NexTouchEventCb pop, void *ptr = NULL);
31 void detachPop(void);
32
33 bool getPic(uint32_t *number);
34 bool setPic(uint32_t number);
35 };
36
37 #endif /* #ifdef __cplusplus */
38 #endif /* #ifndef __NEXCROP_H__ */
NexCrop::NexCrop
NexCrop(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexCrop.cpp:22
NexCrop::detachPop
void detachPop(void)
Unload crop pop callback function.
Definition: NexCrop.cpp:81
NexCrop::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register crop pop callback function.
Definition: NexCrop.cpp:72
NexTouch.h
API of Nextion.
NexCrop
NexCrop,subclass of NexTouch,provides simple methods to control crop component.
Definition: NexCrop.h:25
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexHotspot.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexHotspot.cpp
Go to the documentation of this file.
1
16 #include "NexHotspot.h"
17
22 NexHotspot::NexHotspot(NexPid pid, NexCid cid, char *name,
23 NexTouchEventCb pop, void *pop_ptr,
24 NexTouchEventCb push, void *push_ptr)
25 :NexTouch(pid, cid, name, pop, pop_ptr, push, push_ptr)
26 {
27 }
28
35 void NexHotspot::attachPush(NexTouchEventCb push, void *ptr)
36 {
37 NexTouch::attachPush(push, ptr);
38 }
39
44 void NexHotspot::detachPush(void)
45 {
46 NexTouch::detachPush();
47 }
48
55 void NexHotspot::attachPop(NexTouchEventCb pop, void *ptr)
56 {
57 NexTouch::attachPop(pop, ptr);
58 }
59
64 void NexHotspot::detachPop(void)
65 {
66 NexTouch::detachPop();
67 }
NexHotspot::detachPop
void detachPop(void)
Unload hotsopt pop callback function.
Definition: NexHotspot.cpp:64
NexHotspot::detachPush
void detachPush(void)
Unload hotsopt push callback function.
Definition: NexHotspot.cpp:44
NexHotspot::NexHotspot
NexHotspot(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexHotspot.cpp:22
NexHotspot.h
API of NexHotspot.
NexHotspot::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register hotspot pop callback function.
Definition: NexHotspot.cpp:55
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexHotspot::attachPush
void attachPush(NexTouchEventCb push, void *ptr=NULL)
Register hotspot push callback function.
Definition: NexHotspot.cpp:35


API: NexHotspot.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexHotspot.h
Go to the documentation of this file.
1
16 #ifndef __NEXHOTSPOT_H__
17 #define __NEXHOTSPOT_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexHotspot: public NexTouch
26 {
27 public: /* methods */
28 NexHotspot(NexPid pid, NexCid cid, char *name,
29 NexTouchEventCb pop = NULL, void *pop_ptr = NULL,
30 NexTouchEventCb push = NULL, void *push_ptr = NULL);
31
32 void attachPush(NexTouchEventCb push, void *ptr = NULL);
33 void detachPush(void);
34 void attachPop(NexTouchEventCb pop, void *ptr = NULL);
35 void detachPop(void);
36
37 };
38
39 #endif /* #ifdef __cplusplus */
40 #endif /* #ifndef __NEXHOTSPOT_H__ */
NexHotspot::detachPop
void detachPop(void)
Unload hotsopt pop callback function.
Definition: NexHotspot.cpp:64
NexHotspot::detachPush
void detachPush(void)
Unload hotsopt push callback function.
Definition: NexHotspot.cpp:44
NexTouch.h
API of Nextion.
NexHotspot::NexHotspot
NexHotspot(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexHotspot.cpp:22
NexHotspot
NexHotspot,subclass of NexTouch,provides simple methods to control hotspot component.
Definition: NexHotspot.h:25
NexHotspot::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register hotspot pop callback function.
Definition: NexHotspot.cpp:55
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexHotspot::attachPush
void attachPush(NexTouchEventCb push, void *ptr=NULL)
Register hotspot push callback function.
Definition: NexHotspot.cpp:35


API: NexPage.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPage.cpp
Go to the documentation of this file.
1
16 #include "NexPage.h"
17
22 NexPage::NexPage(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr)
23 :NexTouch(pid, cid, name, pop, pop_ptr)
24 {
25 }
26
33 bool NexPage::show(void)
34 {
35 uint8_t buffer[4] = {0};
36
37 const char *name = getObjName();
38 if (!name)
39 {
40 return false;
41 }
42
43 String cmd = String("page ");
44 cmd += name;
45 sendCommand(cmd.c_str());
46 return recvRetCommandFinished();
47 }
48
55 void NexPage::attachPop(NexTouchEventCb pop, void *ptr)
56 {
57 NexTouch::attachPop(pop, ptr);
58 }
59
64 void NexPage::detachPop(void)
65 {
66 NexTouch::detachPop();
67 }
NexPage::detachPop
void detachPop(void)
Unload page pop callback function.
Definition: NexPage.cpp:64
NexPage::show
bool show(void)
Change page.
Definition: NexPage.cpp:33
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexPage.h
API of NexPage.
NexPage::NexPage
NexPage(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexPage.cpp:22
NexPage::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register page pop callback function.
Definition: NexPage.cpp:55
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexPage.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPage.h
Go to the documentation of this file.
1
16 #ifndef __NEXPAGE_H__
17 #define __NEXPAGE_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexPage: public NexTouch
26 {
27 public: /* methods */
28 NexPage(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop = NULL, void *pop_ptr = NULL);
29 bool show(void);
30
31 void attachPop(NexTouchEventCb pop, void *ptr = NULL);
32 void detachPop(void);
33
34 };
35
36 #endif /* #ifdef __cplusplus */
37 #endif /* #ifndef __NEXPAGE_H__ */
NexPage::detachPop
void detachPop(void)
Unload page pop callback function.
Definition: NexPage.cpp:64
NexPage::show
bool show(void)
Change page.
Definition: NexPage.cpp:33
NexPage
NexPage,subclass of NexTouch,provides simple methods to control page component.
Definition: NexPage.h:25
NexTouch.h
API of Nextion.
NexPage::NexPage
NexPage(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexPage.cpp:22
NexPage::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register page pop callback function.
Definition: NexPage.cpp:55
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexPicture.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPicture.cpp
Go to the documentation of this file.
1
16 #include "NexPicture.h"
17
22 NexPicture::NexPicture(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr)
23 :NexTouch(pid, cid, name, pop, pop_ptr)
24 {
25 }
26
35 bool NexPicture::getPic(uint32_t *number)
36 {
37 String cmd = String("get ");
38 cmd += getObjName();
39 cmd += ".pic";
40 sendCommand(cmd.c_str());
41 return recvRetNumber(number);
42 }
43
52 bool NexPicture::setPic(uint32_t number)
53 {
54 char buf[10] = {0};
55 String cmd;
56
57 utoa(number, buf, 10);
58 cmd += getObjName();
59 cmd += ".pic=";
60 cmd += buf;
61
62 sendCommand(cmd.c_str());
63 return recvRetCommandFinished();
64 }
65
72 void NexPicture::attachPop(NexTouchEventCb pop, void *ptr)
73 {
74 NexTouch::attachPop(pop, ptr);
75 }
76
81 void NexPicture::detachPop(void)
82 {
83 NexTouch::detachPop();
84 }
85
NexPicture::detachPop
void detachPop(void)
Unload picture pop callback function.
Definition: NexPicture.cpp:81
NexPicture::setPic
bool setPic(uint32_t number)
Set picture's number.
Definition: NexPicture.cpp:52
NexPicture::NexPicture
NexPicture(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexPicture.cpp:22
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexPicture::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register picture pop callback function.
Definition: NexPicture.cpp:72
NexTouch::recvRetNumber
static bool recvRetNumber(uint32_t *number, uint32_t timeout=500)
Receive uint32_t data.
Definition: NexTouch.cpp:351
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexPicture::getPic
bool getPic(uint32_t *number)
Get picture's number.
Definition: NexPicture.cpp:35
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexPicture.h
API of NexPicture.


API: NexPicture.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPicture.h
Go to the documentation of this file.
1
16 #ifndef __NEXPICTURE_H__
17 #define __NEXPICTURE_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexPicture: public NexTouch
26 {
27 public: /* methods */
28 NexPicture(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop = NULL, void *pop_ptr = NULL);
29
30 void attachPop(NexTouchEventCb pop, void *ptr = NULL);
31 void detachPop(void);
32
33 bool getPic(uint32_t *number);
34 bool setPic(uint32_t number);
35 };
36
37 #endif /* #ifdef __cplusplus */
38 #endif /* #ifndef __NEXPICTURE_H__ */
NexPicture::detachPop
void detachPop(void)
Unload picture pop callback function.
Definition: NexPicture.cpp:81
NexPicture::setPic
bool setPic(uint32_t number)
Set picture's number.
Definition: NexPicture.cpp:52
NexPicture::NexPicture
NexPicture(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexPicture.cpp:22
NexPicture
NexPicture,subclass of NexTouch,provides simple methods to control picture component.
Definition: NexPicture.h:25
NexTouch.h
API of Nextion.
NexPicture::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register picture pop callback function.
Definition: NexPicture.cpp:72
NexPicture::getPic
bool getPic(uint32_t *number)
Get picture's number.
Definition: NexPicture.cpp:35
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexPointer.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPointer.cpp
Go to the documentation of this file.
1
16 #include "NexPointer.h"
17
22 NexPointer::NexPointer(NexPid pid, NexCid cid, char *name)
23 :NexTouch(pid, cid, name)
24 {
25 }
26
35 bool NexPointer::getValue(uint32_t *number)
36 {
37 String cmd = String("get ");
38 cmd += getObjName();
39 cmd += ".val";
40 sendCommand(cmd.c_str());
41 return recvRetNumber(number);
42 }
43
52 bool NexPointer::setValue(uint32_t number)
53 {
54 char buf[10] = {0};
55 String cmd;
56
57 utoa(number, buf, 10);
58 cmd += getObjName();
59 cmd += ".val=";
60 cmd += buf;
61
62 sendCommand(cmd.c_str());
63 return recvRetCommandFinished();
64 }
65
NexPointer::getValue
bool getValue(uint32_t *number)
Get the value of pointer.
Definition: NexPointer.cpp:35
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexTouch::recvRetNumber
static bool recvRetNumber(uint32_t *number, uint32_t timeout=500)
Receive uint32_t data.
Definition: NexTouch.cpp:351
NexPointer::NexPointer
NexPointer(NexPid pid, NexCid cid, char *name)
Constructor,inherited NexTouch's constructor function.
Definition: NexPointer.cpp:22
NexPointer::setValue
bool setValue(uint32_t number)
Set the value of pointer.
Definition: NexPointer.cpp:52
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexPointer.h
API of NexPointer.


API: NexPointer.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexPointer.h
Go to the documentation of this file.
1
16 #ifndef __NEXPOINTER_H__
17 #define __NEXPOINTER_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexPointer: public NexTouch
26 {
27 public: /* methods */
28 NexPointer(NexPid pid, NexCid cid, char *name);
29
30 bool getValue(uint32_t *number);
31 bool setValue(uint32_t number);
32 };
33
34 #endif /* #ifdef __cplusplus */
35 #endif /* #ifndef __NEXPOINTER_H__ */
NexPointer::getValue
bool getValue(uint32_t *number)
Get the value of pointer.
Definition: NexPointer.cpp:35
NexPointer
NexPointer,subclass of NexTouch,provides simple methods to control pointer component.
Definition: NexPointer.h:25
NexTouch.h
API of Nextion.
NexPointer::NexPointer
NexPointer(NexPid pid, NexCid cid, char *name)
Constructor,inherited NexTouch's constructor function.
Definition: NexPointer.cpp:22
NexPointer::setValue
bool setValue(uint32_t number)
Set the value of pointer.
Definition: NexPointer.cpp:52
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexProgressBar.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexProgressBar.cpp
Go to the documentation of this file.
1
16 #include "NexProgressBar.h"
17
22 NexProgressBar::NexProgressBar(NexPid pid, NexCid cid, char *name)
23 :NexTouch(pid, cid, name)
24 {
25 }
26
35 bool NexProgressBar::getValue(uint32_t *number)
36 {
37 String cmd = String("get ");
38 cmd += getObjName();
39 cmd += ".val";
40 sendCommand(cmd.c_str());
41 return recvRetNumber(number);
42 }
43
52 bool NexProgressBar::setValue(uint32_t number)
53 {
54 char buf[10] = {0};
55 String cmd;
56
57 utoa(number, buf, 10);
58 cmd += getObjName();
59 cmd += ".val=";
60 cmd += buf;
61
62 sendCommand(cmd.c_str());
63 return recvRetCommandFinished();
64 }
65
NexProgressBar::setValue
bool setValue(uint32_t number)
Set the value of progress bar.
Definition: NexProgressBar.cpp:52
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexProgressBar::getValue
bool getValue(uint32_t *number)
Get the value of progress bar.
Definition: NexProgressBar.cpp:35
NexTouch::recvRetNumber
static bool recvRetNumber(uint32_t *number, uint32_t timeout=500)
Receive uint32_t data.
Definition: NexTouch.cpp:351
NexProgressBar::NexProgressBar
NexProgressBar(NexPid pid, NexCid cid, char *name)
Constructor,inherited NexTouch's constructor function.
Definition: NexProgressBar.cpp:22
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexProgressBar.h
API of NexProgressBar.
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexProgressBar.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexProgressBar.h
Go to the documentation of this file.
1
16 #ifndef __NEXPROGRESSBAR_H__
17 #define __NEXPROGRESSBAR_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexProgressBar: public NexTouch
26 {
27 public: /* methods */
28 NexProgressBar(NexPid pid, NexCid cid, char *name);
29
30 bool getValue(uint32_t *number);
31 bool setValue(uint32_t number);
32 };
33
34 #endif /* #ifdef __cplusplus */
35 #endif /* #ifndef __NEXPROGRESSBAR_H__ */
NexProgressBar::setValue
bool setValue(uint32_t number)
Set the value of progress bar.
Definition: NexProgressBar.cpp:52
NexTouch.h
API of Nextion.
NexProgressBar::getValue
bool getValue(uint32_t *number)
Get the value of progress bar.
Definition: NexProgressBar.cpp:35
NexProgressBar::NexProgressBar
NexProgressBar(NexPid pid, NexCid cid, char *name)
Constructor,inherited NexTouch's constructor function.
Definition: NexProgressBar.cpp:22
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexProgressBar
NexProgressBar,subclass of NexTouch,provides simple methods to control progress bar component...
Definition: NexProgressBar.h:25


API: NexSerialConfig.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexSerialConfig.h
Go to the documentation of this file.
1
16 #ifndef __NexSerialConfig_H__
17 #define __NexSerialConfig_H__
18
19 /* enable debug serial */
20 #define DEBUG_SERIAL_ENABLE
21
22 /* define serial for debug */
23 #define dbSerial Serial
24
25 /* define serial for communicate with Nextion screen */
26 #define nexSerial Serial2
27
28 #ifdef DEBUG_SERIAL_ENABLE
29 #define dbSerialPrint(a) dbSerial.print(a)
30 #define dbSerialPrintln(a) dbSerial.println(a)
31 #define dbSerialBegin(a) dbSerial.begin(a)
32 #else
33 #define dbSerialPrint(a)
34 #define dbSerialPrintln(a)
35 #define dbSerialBegin(a)
36 #endif
37
38 #endif


API: NexText.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexText.cpp
Go to the documentation of this file.
1
16 #include "NexText.h"
17
22 NexText::NexText(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop, void *pop_ptr)
23 :NexTouch(pid, cid, name, pop, pop_ptr)
24 {
25 }
26
35 uint16_t NexText::getText(char *buffer, uint16_t len)
36 {
37 String cmd;
38 cmd += "get ";
39 cmd += getObjName();
40 cmd += ".txt";
41 sendCommand(cmd.c_str());
42 return recvRetString(buffer,len);
43 }
44
53 bool NexText::setText(const char *buffer)
54 {
55 String cmd;
56 cmd += getObjName();
57 cmd += ".txt=\"";
58 cmd += buffer;
59 cmd += "\"";
60 sendCommand(cmd.c_str());
61 return recvRetCommandFinished();
62 }
63
70 void NexText::attachPop(NexTouchEventCb pop, void *ptr)
71 {
72 NexTouch::attachPop(pop, ptr);
73 }
74
79 void NexText::detachPop(void)
80 {
81 NexTouch::detachPop();
82 }
83
NexText::setText
bool setText(const char *buffer)
Set the value of text.
Definition: NexText.cpp:53
NexText::detachPop
void detachPop(void)
Unload text pop callback function.
Definition: NexText.cpp:79
NexText.h
API of NexText.
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexText::getText
uint16_t getText(char *buffer, uint16_t len)
Get the value of text.
Definition: NexText.cpp:35
NexText::NexText
NexText(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexText.cpp:22
NexTouch::recvRetString
static uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data.
Definition: NexTouch.cpp:279
NexText::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register text pop callback function.
Definition: NexText.cpp:70
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexText.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexText.h
Go to the documentation of this file.
1
16 #ifndef __NEXTEXT_H__
17 #define __NEXTEXT_H__
18 #ifdef __cplusplus
19 #include "NexTouch.h"
20
25 class NexText: public NexTouch
26 {
27 public: /* methods */
28 NexText(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop = NULL, void *pop_ptr = NULL);
29
30 void attachPop(NexTouchEventCb pop, void *ptr = NULL);
31 void detachPop(void);
32
33 uint16_t getText(char *buffer, uint16_t len);
34 bool setText(const char *buffer);
35 };
36
37 #endif /* #ifdef __cplusplus */
38 #endif /* #ifndef __NEXTEXT_H__ */
NexText::setText
bool setText(const char *buffer)
Set the value of text.
Definition: NexText.cpp:53
NexText::detachPop
void detachPop(void)
Unload text pop callback function.
Definition: NexText.cpp:79
NexText::getText
uint16_t getText(char *buffer, uint16_t len)
Get the value of text.
Definition: NexText.cpp:35
NexTouch.h
API of Nextion.
NexText::NexText
NexText(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL)
Constructor,inherited NexTouch's constructor function.
Definition: NexText.cpp:22
NexText::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Register text pop callback function.
Definition: NexText.cpp:70
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57
NexText
NexText,subclass of NexTouch,provides simple methods to control text component.
Definition: NexText.h:25


API: NexTouch.cpp Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexTouch.cpp
Go to the documentation of this file.
1
16 #include "NexTouch.h"
17
18 uint8_t NexTouch::__buffer[256] = {0};
19
26 uint8_t NexTouch::mainEventLoop(NexTouch **list)
27 {
28 uint16_t i;
29 uint8_t c;
30 while (nexSerial.available() > 0)
31 {
32 delay(10);
33 c = nexSerial.read();
34
35 if (NEX_RET_EVENT_TOUCH_HEAD == c)
36 {
37 if (nexSerial.available() >= 6)
38 {
39 __buffer[0] = c;
40 for (i = 1; i < 7; i++)
41 {
42 __buffer[i] = nexSerial.read();
43 }
44 __buffer[i] = 0x00;
45
46 if (0xFF == __buffer[4] && 0xFF == __buffer[5] && 0xFF == __buffer[6])
47 {
48 iterate(list, (NexPid)__buffer[1], (NexCid)__buffer[2], (NexEventType)__buffer[3]);
49 }
50
51 }
52 }
53 }
54 return 0;
55 }
56
69 NexTouch::NexTouch(NexPid pid, NexCid cid, char *name,
70 NexTouchEventCb pop, void *pop_ptr,
71 NexTouchEventCb push, void *push_ptr)
72 {
73 this->pid = pid;
74 this->cid = cid;
75 this->name = name;
76 this->cbPush = push;
77 this->cbPop = pop;
78 this->__cbpop_ptr = pop_ptr;
79 this->__cbpush_ptr = push_ptr;
80 }
81
87 NexPid NexTouch::getPid(void)
88 {
89 return pid;
90 }
91
97 NexCid NexTouch::getCid(void)
98 {
99 return cid;
100 }
101
107 const char* NexTouch::getObjName(void)
108 {
109 return name;
110 }
111
117 void NexTouch::print(void)
118 {
119 dbSerialPrint("[");
120 dbSerialPrint((uint32_t)this);
121 dbSerialPrint(":");
122 dbSerialPrint(pid);
123 dbSerialPrint(",");
124 dbSerialPrint(cid);
125 dbSerialPrint(",");
126 if (name)
127 {
128 dbSerialPrint(name);
129 }
130 else
131 {
132 dbSerialPrint("(null)");
133 }
134 dbSerialPrint(",");
135 dbSerialPrint((uint32_t)cbPush);
136 dbSerialPrint(",");
137 dbSerialPrint((uint32_t)cbPop);
138 dbSerialPrintln("]");
139 }
140
141 void NexTouch::attachPush(NexTouchEventCb push, void *ptr)
142 {
143 this->cbPush = push;
144 this->__cbpush_ptr = ptr;
145 }
146
147 void NexTouch::detachPush(void)
148 {
149 this->cbPush = NULL;
150 this->__cbpush_ptr = NULL;
151 }
152
153 void NexTouch::attachPop(NexTouchEventCb pop, void *ptr)
154 {
155 this->cbPop = pop;
156 this->__cbpop_ptr = ptr;
157 }
158
159 void NexTouch::detachPop(void)
160 {
161 this->cbPop = NULL;
162 this->__cbpop_ptr = NULL;
163 }
164
165 void NexTouch::iterate(NexTouch **list, NexPid pid, NexCid cid, NexEventType event)
166 {
167 NexTouch *e = NULL;
168 uint16_t i = 0;
169
170 if (NULL == list)
171 {
172 return;
173 }
174
175 for(i = 0; (e = list[i]) != NULL; i++)
176 {
177 if (e->getPid() == pid && e->getCid() == cid)
178 {
179 e->print();
180 if (NEX_EVENT_PUSH == event)
181 {
182 e->push();
183 }
184 else if (NEX_EVENT_POP == event)
185 {
186 e->pop();
187 }
188
189 break;
190 }
191 }
192 }
193
194 void NexTouch::push(void)
195 {
196 if (cbPush)
197 {
198 cbPush(__cbpush_ptr);
199 }
200 }
201
202 void NexTouch::pop(void)
203 {
204 if (cbPop)
205 {
206 cbPop(__cbpop_ptr);
207 }
208 }
209
219 bool NexTouch::recvRetCommandFinished(uint32_t timeout)
220 {
221 bool ret = false;
222 uint8_t temp[4] = {0};
223
224 nexSerial.setTimeout(timeout);
225 if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
226 {
227 ret = false;
228 }
229
230 if (temp[0] == NEX_RET_CMD_FINISHED
231 && temp[1] == 0xFF
232 && temp[2] == 0xFF
233 && temp[3] == 0xFF
234 )
235 {
236 ret = true;
237 }
238
239 if (ret)
240 {
241 dbSerialPrintln("recvRetCommandFinished ok");
242 }
243 else
244 {
245 dbSerialPrintln("recvRetCommandFinished err");
246 }
247
248 return ret;
249 }
250
256 void NexTouch::sendCommand(const char* cmd)
257 {
258 while (nexSerial.available())
259 {
260 nexSerial.read();
261 }
262
263 nexSerial.print(cmd);
264 nexSerial.write(0xFF);
265 nexSerial.write(0xFF);
266 nexSerial.write(0xFF);
267 }
268
279 uint16_t NexTouch::recvRetString(char *buffer, uint16_t len, uint32_t timeout)
280 {
281 uint16_t ret = 0;
282 bool str_start_flag = false;
283 uint8_t cnt_0xff = 0;
284 String temp = String("");
285 uint8_t c = 0;
286 long start;
287
288 if (!buffer || len == 0)
289 {
290 goto __return;
291 }
292
293 start = millis();
294 while (millis() - start <= timeout)
295 {
296 while (nexSerial.available())
297 {
298 c = nexSerial.read();
299 if (str_start_flag)
300 {
301 if (0xFF == c)
302 {
303 cnt_0xff++;
304 if (cnt_0xff >= 3)
305 {
306 break;
307 }
308 }
309 else
310 {
311 temp += (char)c;
312 }
313 }
314 else if (NEX_RET_STRING_HEAD == c)
315 {
316 str_start_flag = true;
317 }
318 }
319
320 if (cnt_0xff >= 3)
321 {
322 break;
323 }
324 }
325
326 ret = temp.length();
327 ret = ret > len ? len : ret;
328 strncpy(buffer, temp.c_str(), ret);
329
330 __return:
331
332 dbSerialPrint("recvRetString[");
333 dbSerialPrint(temp.length());
334 dbSerialPrint(",");
335 dbSerialPrint(temp);
336 dbSerialPrintln("]");
337
338 return ret;
339 }
340
351 bool NexTouch::recvRetNumber(uint32_t *number, uint32_t timeout)
352 {
353 bool ret = false;
354 uint8_t temp[8] = {0};
355
356 if (!number)
357 {
358 goto __return;
359 }
360
361 nexSerial.setTimeout(timeout);
362 if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
363 {
364 goto __return;
365 }
366
367 if (temp[0] == NEX_RET_NUMBER_HEAD
368 && temp[5] == 0xFF
369 && temp[6] == 0xFF
370 && temp[7] == 0xFF
371 )
372 {
373 *number = (temp[4] << 24) | (temp[3] << 16) | (temp[2] << 8) | (temp[1]);
374 ret = true;
375 }
376
377 __return:
378
379 if (ret)
380 {
381 dbSerialPrint("recvRetNumber :");
382 dbSerialPrintln(*number);
383 }
384 else
385 {
386 dbSerialPrintln("recvRetNumber err");
387 }
388
389 return ret;
390 }
391
398 bool nexInit(void)
399 {
400 dbSerialBegin(9600);
401 nexSerial.begin(9600);
402 NexTouch::sendCommand("");
403 NexTouch::sendCommand("page 0");
404 delay(100);
405 return true;
406 }
407
415 bool nexLoop(NexTouch **nex_listen_list)
416 {
417 NexTouch::mainEventLoop(nex_listen_list);
418 return false;
419 }
420
421 #if 0
422
430 bool sendCurrentPageId(uint8_t* pageId)
431 {
432
433 bool ret = false;
434 uint8_t temp[5] = {0};
435
436 if (!pageId)
437 {
438 goto __return;
439 }
440 NexTouch::sendCommand("sendme");
441 delay(50);
442 nexSerial.setTimeout(500);
443 if (sizeof(temp) != nexSerial.readBytes((char *)temp, sizeof(temp)))
444 {
445 goto __return;
446 }
447
448 if (temp[0] == NEX_RET_CURRENT_PAGE_ID_HEAD
449 && temp[2] == 0xFF
450 && temp[3] == 0xFF
451 && temp[4] == 0xFF
452 )
453 {
454 *pageId = temp[1];
455 ret = true;
456 }
457
458 __return:
459
460 if (ret)
461 {
462 dbSerialPrint("recvPageId :");
463 dbSerialPrintln(*pageId);
464 }
465 else
466 {
467 dbSerialPrintln("recvPageId err");
468 }
469
470 return ret;
471
472 }
473
480 bool touchCalibration(void)
481 {
482 bool ret = false;
483 NexTouch::sendCommand("touch_j");
484 delay(10);
485 if(NexTouch::recvRetCommandFinished())
486 {
487 dbSerialPrintln("TouchCalibration ok ");
488 ret = true;
489 }
490 else
491 {
492 dbSerialPrintln("TouchCalibration err ");
493 }
494
495 return ret;
496 }
497
504 bool disableTouchFocus(void)
505 {
506 bool ret = false;
507 NexTouch::sendCommand("cle_c");
508 delay(10);
509 if(NexTouch::recvRetCommandFinished())
510 {
511 dbSerialPrintln("disableTouchFocus ok ");
512 ret = true;
513 }
514 else
515 {
516 dbSerialPrintln("disableTouchFocus err ");
517 }
518
519 return ret;
520 }
521
528 bool pauseSerialCommand(void)
529 {
530
531 bool ret = false;
532 NexTouch::sendCommand("com_stop");
533 delay(10);
534 if(NexTouch::recvRetCommandFinished())
535 {
536 dbSerialPrintln("pauseSerialCommand ok ");
537 ret = true;
538 }
539 else
540 {
541 dbSerialPrintln("pauseSerialCommand err ");
542 }
543
544 return ret;
545 }
546
553 bool recoverySerialCommand(void)
554 {
555 bool ret = false;
556 NexTouch::sendCommand("com_star");
557 delay(10);
558 if(NexTouch::recvRetCommandFinished())
559 {
560 dbSerialPrintln("recoverySerialCommand ok ");
561 ret = true;
562 }
563 else
564 {
565 dbSerialPrintln("recoverySerialCommand err ");
566 }
567
568 return ret;
569 }
570
579 bool setCurrentBrightness(uint8_t dimValue)
580 {
581 bool ret = false;
582 char buf[10] = {0};
583 String cmd;
584 utoa(dimValue, buf, 10);
585 cmd += "dim=";
586 cmd += buf;
587 NexTouch::sendCommand(cmd.c_str());
588 delay(10);
589
590 if(NexTouch::recvRetCommandFinished())
591 {
592 dbSerialPrint("setCurrentBrightness[ ");
593 dbSerialPrint(dimValue);
594 dbSerialPrintln("]ok ");
595
596 ret = true;
597 }
598 else
599 {
600 dbSerialPrintln("setCurrentBrightness err ");
601 }
602
603 return ret;
604 }
605
614 bool setDefaultBrightness(uint8_t dimDefaultValue)
615 {
616 bool ret = false;
617 char buf[10] = {0};
618 String cmd;
619 utoa(dimDefaultValue, buf, 10);
620 cmd += "dims=";
621 cmd += buf;
622 NexTouch::sendCommand(cmd.c_str());
623 delay(10);
624
625 if(NexTouch::recvRetCommandFinished())
626 {
627 dbSerialPrint("setDefaultBrightness[");
628 dbSerialPrint(dimDefaultValue);
629 dbSerialPrintln("]ok");
630 ret = true;
631 }
632 else
633 {
634 dbSerialPrintln("setDefaultBrightness err ");
635 }
636
637 return ret;
638 }
639
648 bool sleepMode(uint8_t mode)
649 {
650 bool ret = false;
651 char buf[10] = {0};
652 String cmd;
653 if(mode != 0 && mode != 1)
654 {
655 dbSerialPrintln("mode input ok ");
656 return ret;
657 }
658 utoa(mode, buf, 10);
659 cmd += "sleep=";
660 cmd += buf;
661 NexTouch::sendCommand(cmd.c_str());
662 delay(10);
663
664 if(NexTouch::recvRetCommandFinished())
665 {
666 dbSerialPrintln("sleepMode ok ");
667 ret = true;
668 }
669 else
670 {
671 dbSerialPrintln("sleepMode err ");
672 }
673
674 return ret;
675 }
676
685 bool setCurrentBaudrate(uint32_t baudrate)
686 {
687 bool ret = false;
688 char buf[10] = {0};
689 String cmd;
690 utoa(baudrate, buf, 10);
691 cmd += "baud=";
692 cmd += buf;
693 NexTouch::sendCommand(cmd.c_str());
694 delay(10);
695
696 if(NexTouch::recvRetCommandFinished())
697 {
698 dbSerialPrintln("setCurrentBaudrate ok ");
699 ret = true;
700 }
701 else
702 {
703 dbSerialPrintln("setCurrentBaudrate err ");
704 }
705
706 return ret;
707 }
708
717 bool setDefaultBaudrate(uint32_t defaultBaudrate)
718 {
719 bool ret = false;
720 char buf[10] = {0};
721 String cmd;
722 utoa(defaultBaudrate, buf, 10);
723 cmd += "bauds=";
724 cmd += buf;
725 NexTouch::sendCommand(cmd.c_str());
726 delay(10);
727
728 if(NexTouch::recvRetCommandFinished())
729 {
730 dbSerialPrintln("setDefaultBaudrate ok ");
731 ret = true;
732 }
733 else
734 {
735 dbSerialPrintln("setDefaultBaudrate err ");
736 }
737
738 return ret;
739 }
740
741 #endif
NexTouch::getPid
NexPid getPid(void)
Get page id.
Definition: NexTouch.cpp:87
NexTouch::NexTouch
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch.
Definition: NexTouch.cpp:69
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexTouch::print
void print(void)
Print current object address,page id,component id, component name,pop event function address...
Definition: NexTouch.cpp:117
NexTouch::mainEventLoop
static uint8_t mainEventLoop(NexTouch **list)
Watting for Nextion's touch event.
Definition: NexTouch.cpp:26
NexTouch::getCid
NexCid getCid(void)
Get component id.
Definition: NexTouch.cpp:97
NexTouch.h
API of Nextion.
NexTouch::recvRetNumber
static bool recvRetNumber(uint32_t *number, uint32_t timeout=500)
Receive uint32_t data.
Definition: NexTouch.cpp:351
NexTouch::recvRetString
static uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data.
Definition: NexTouch.cpp:279
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: NexTouch.h Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
NexTouch.h
Go to the documentation of this file.
1
16 #ifndef __NEXTOUCH_H__
17 #define __NEXTOUCH_H__
18 #ifdef __cplusplus
19 #include <Arduino.h>
20 #include "NexSerialConfig.h"
21
22 typedef uint8_t NexPid;
23 typedef uint8_t NexCid;
24
25 typedef enum {
26 NEX_EVENT_POP = 0x00,
27 NEX_EVENT_PUSH = 0x01,
28 NEX_EVENT_NULL
29 } NexEventType;
30
31 /*The first byte of Nextoin's return value*/
32 #define NEX_RET_CMD_FINISHED (0x01)
33 #define NEX_RET_EVENT_LAUNCHED (0x88)
34 #define NEX_RET_EVENT_UPGRADED (0x89)
35 #define NEX_RET_EVENT_TOUCH_HEAD (0x65)
36 #define NEX_RET_EVENT_POSITION_HEAD (0x67)
37 #define NEX_RET_EVENT_SLEEP_POSITION_HEAD (0x68)
38 #define NEX_RET_CURRENT_PAGE_ID_HEAD (0x66)
39 #define NEX_RET_STRING_HEAD (0x70)
40 #define NEX_RET_NUMBER_HEAD (0x71)
41 #define NEX_RET_INVALID_CMD (0x00)
42 #define NEX_RET_INVALID_COMPONENT_ID (0x02)
43 #define NEX_RET_INVALID_PAGE_ID (0x03)
44 #define NEX_RET_INVALID_PICTURE_ID (0x04)
45 #define NEX_RET_INVALID_FONT_ID (0x05)
46 #define NEX_RET_INVALID_BAUD (0x11)
47 #define NEX_RET_INVALID_VARIABLE (0x1A)
48 #define NEX_RET_INVALID_OPERATION (0x1B)
49
50
51 typedef void (*NexTouchEventCb)(void *ptr);
52
57 class NexTouch
58 {
59 public: /* static methods */
60 static uint8_t mainEventLoop(NexTouch **list);
61 static void sendCommand(const char *cmd);
62 static bool recvRetCommandFinished(uint32_t timeout = 100);
63 static uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout = 500);
64 static bool recvRetNumber(uint32_t *number, uint32_t timeout = 500);
65
66 public: /* methods */
67 NexTouch(NexPid pid, NexCid cid, char *name,
68 NexTouchEventCb pop = NULL, void *pop_ptr = NULL,
69 NexTouchEventCb push = NULL, void *push_ptr = NULL);
70
71 NexPid getPid(void);
72 NexCid getCid(void);
73 const char *getObjName(void);
74 void print(void);
75
76 protected: /* static methods */
77
78 protected: /* methods */
79 void attachPush(NexTouchEventCb push, void *ptr = NULL);
80 void detachPush(void);
81 void attachPop(NexTouchEventCb pop, void *ptr = NULL);
82 void detachPop(void);
83
84 private: /* static methods */
85 static void iterate(NexTouch **list, NexPid pid, NexCid cid, NexEventType event);
86
87 private: /* methods */
88 void push(void);
89 void pop(void);
90
91 private: /* static data */
92 static uint8_t __buffer[256];
93
94 private: /* data */
95 NexPid pid; /* Page ID */
96 NexCid cid; /* Component ID */
97 char *name; /* An unique name */
98 NexTouchEventCb cbPush;
99 void *__cbpush_ptr;
100 NexTouchEventCb cbPop;
101 void *__cbpop_ptr;
102 };
103
104 bool nexInit(void);
105 bool nexLoop(NexTouch **nex_listen_list);
106
107 #if 0
108 bool sendCurrentPageId(uint8_t* pageId);
109 bool touchCalibration(void);
110 bool disableTouchFocus(void);
111 bool pauseSerialCommand(void);
112 bool recoverySerialCommand(void);
113 bool clearSerialSurplusCommand(void);
114 bool setCurrentBrightness(uint8_t dimValue);
115 bool setDefaultBrightness(uint8_t dimDefaultValue);
116 bool sleepMode(uint8_t mode);
117 bool setCurrentBaudrate(uint32_t baudrate);
118 bool setDefaultBaudrate(uint32_t baudrate);
119 #endif
120
121 #endif /* #ifdef __cplusplus */
122 #endif /* #ifndef __NEXTOUCH_H__ */
NexTouch::getPid
NexPid getPid(void)
Get page id.
Definition: NexTouch.cpp:87
NexTouch::NexTouch
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL)
Constructor of Nextouch.
Definition: NexTouch.cpp:69
NexSerialConfig.h
Serial configure.
nexInit
bool nexInit(void)
Init Nextion's baudrate,page id.
Definition: NexTouch.cpp:398
NexTouch::sendCommand
static void sendCommand(const char *cmd)
Send command to Nextion.
Definition: NexTouch.cpp:256
NexTouch::getObjName
const char * getObjName(void)
Get component name.
Definition: NexTouch.cpp:107
NexTouch::print
void print(void)
Print current object address,page id,component id, component name,pop event function address...
Definition: NexTouch.cpp:117
NexTouch::mainEventLoop
static uint8_t mainEventLoop(NexTouch **list)
Watting for Nextion's touch event.
Definition: NexTouch.cpp:26
NexTouch::getCid
NexCid getCid(void)
Get component id.
Definition: NexTouch.cpp:97
NexTouch::recvRetNumber
static bool recvRetNumber(uint32_t *number, uint32_t timeout=500)
Receive uint32_t data.
Definition: NexTouch.cpp:351
NexTouch::recvRetString
static uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout=500)
Receive string data.
Definition: NexTouch.cpp:279
NexTouch::recvRetCommandFinished
static bool recvRetCommandFinished(uint32_t timeout=100)
Command is executed successfully.
Definition: NexTouch.cpp:219
nexLoop
bool nexLoop(NexTouch **nex_listen_list)
Call mainEventLoop,watting for Nextion's touch event.
Definition: NexTouch.cpp:415
NexTouch
Root Class of Nextion Components.
Definition: NexTouch.h:57


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexButton Member List

This is the complete list of members for NexButton, including all inherited members.

attachPop(NexTouchEventCb pop, void *ptr=NULL) | NexButton |
detachPop(void) | NexButton |
getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
getText(char *buffer, uint16_t len) | NexButton |
mainEventLoop(NexTouch **list) | NexTouch | static
NexButton(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL) | NexButton |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static
setText(const char *buffer) | NexButton |


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexCrop Member List

This is the complete list of members for NexCrop, including all inherited members.

attachPop(NexTouchEventCb pop, void *ptr=NULL) | NexCrop |
detachPop(void) | NexCrop |
getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
mainEventLoop(NexTouch **list) | NexTouch | static
NexCrop(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL) | NexCrop |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexHotspot Member List

This is the complete list of members for NexHotspot, including all inherited members.

attachPop(NexTouchEventCb pop, void *ptr=NULL) | NexHotspot |
attachPush(NexTouchEventCb push, void *ptr=NULL) | NexHotspot |
detachPop(void) | NexHotspot |
detachPush(void) | NexHotspot |
getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
mainEventLoop(NexTouch **list) | NexTouch | static
NexHotspot(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexHotspot |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexPage Member List

This is the complete list of members for NexPage, including all inherited members.

attachPop(NexTouchEventCb pop, void *ptr=NULL) | NexPage |
detachPop(void) | NexPage |
getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
mainEventLoop(NexTouch **list) | NexTouch | static
NexPage(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL) | NexPage |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static
show(void) | NexPage |


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexPicture Member List

This is the complete list of members for NexPicture, including all inherited members.

attachPop(NexTouchEventCb pop, void *ptr=NULL) | NexPicture |
detachPop(void) | NexPicture |
getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPic(uint32_t *number) | NexPicture |
getPid(void) | NexTouch |
mainEventLoop(NexTouch **list) | NexTouch | static
NexPicture(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL) | NexPicture |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static
setPic(uint32_t number) | NexPicture |


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexPointer Member List

This is the complete list of members for NexPointer, including all inherited members.

getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
getValue(uint32_t *number) | NexPointer |
mainEventLoop(NexTouch **list) | NexTouch | static
NexPointer(NexPid pid, NexCid cid, char *name) | NexPointer |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static
setValue(uint32_t number) | NexPointer |


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexProgressBar Member List

This is the complete list of members for NexProgressBar, including all inherited members.

getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
getValue(uint32_t *number) | NexProgressBar |
mainEventLoop(NexTouch **list) | NexTouch | static
NexProgressBar(NexPid pid, NexCid cid, char *name) | NexProgressBar |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static
setValue(uint32_t number) | NexProgressBar |


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexText Member List

This is the complete list of members for NexText, including all inherited members.

attachPop(NexTouchEventCb pop, void *ptr=NULL) | NexText |
detachPop(void) | NexText |
getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
getText(char *buffer, uint16_t len) | NexText |
mainEventLoop(NexTouch **list) | NexTouch | static
NexText(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL) | NexText |
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static
setText(const char *buffer) | NexText |


API: Member List

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
NexTouch Member List

This is the complete list of members for NexTouch, including all inherited members.

getCid(void) | NexTouch |
getObjName(void) | NexTouch |
getPid(void) | NexTouch |
mainEventLoop(NexTouch **list) | NexTouch | static
NexTouch(NexPid pid, NexCid cid, char *name, NexTouchEventCb pop=NULL, void *pop_ptr=NULL, NexTouchEventCb push=NULL, void *push_ptr=NULL) | NexTouch |
print(void) | NexTouch |
recvRetCommandFinished(uint32_t timeout=100) | NexTouch | static
recvRetNumber(uint32_t *number, uint32_t timeout=500) | NexTouch | static
recvRetString(char *buffer, uint16_t len, uint32_t timeout=500) | NexTouch | static
sendCommand(const char *cmd) | NexTouch | static


API: Main Page

API
  • Related Pages
  • Classes
  • Files
  • Examples
API Documentation

Nextion Library for Arduino

Nextion Arduino library provides an easy-to-use way to manipulate Nextion serial displays. Users can use the libarry freely, either in commerical projects or open-source prjects, without any additional condiitons.

For more information about the Nextion display project, please visit the wiki。 The wiki provdies all the necessary technical documnets, quick start guide, tutorials, demos, as well as some useful resources.

To get your Nextion display, please visit iMall.

To discuss the project? Request new features? Report a BUG? please visit the Forums

​

Source

Latest source code can be download at https://github.com/itead/ITEADLIB_Arduino_Nextion.

You can clone it by:

git clone https://github.com/itead/ITEADLIB_Arduino_Nextion

Documentation

Online API documentation can be reached at http://docs.iteadstudio.com/ITEADLIB_Arduino_Nextion/.

Offline API documentation can be found under directory doc.

Suppported Mainboards:

All boards, which has one or more hardware serial, can be supported.

For example:

  • Iteaduino MEGA2560
  • Iteaduino UNO
  • Arduino MEGA2560
  • Arduino UNO

Serial configuration

In configuration file NexSerialConfig.h, you can find two macros below:

  • dbSerial: Debug Serial (baudrate:9600), needed by beginners for debug your nextion applications or sketches. If your complete your work, it will be a wise choice to disable Debug Serial.
  • nexSerial: Nextion Serial, the bridge of Nextion and your mainboard.

Note: the default configuration is for MEGA2560.

Redirect dbSerial and nexSerial

If you want to change the default serial to debug or communicate with Nextion , you need to modify the line in file NexSerialConfig.h:

#define dbSerial Serial    ---> #define dbSerial Serialxxx
#define nexSerial Serial2  ---> #define nexSeria Serialxxx

Disable Debug Serial

If you want to disable the debug information,you need to modify the line in file NexSerialConfig.h:

#define DEBUG_SERIAL_ENABLE ---> //#define DEBUG_SERIAL_ENABLE

UNO

If your board has only one hardware serial, such as UNO, you should disable dbSerial and redirect nexSerial to Serial(Refer to section:Serial configuration).

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004

Copyright (C) 2014 ITEAD Studio

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

   DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.


API: Related Pages

API
  • Related Pages
  • Classes
  • Files
  • Examples
Related Pages
Here is a list of all related documentation pages:
readme


API: readme.md Source File

API
  • Related Pages
  • Classes
  • Files
  • Examples
  • File List
  • File Members
readme.md
1 @mainpage
2
3 # Nextion Library for Arduino
4
5 Nextion Arduino library provides an easy-to-use way to manipulate Nextion serial displays.
6 Users can use the libarry freely, either in commerical projects or open-source prjects, without any additional condiitons.
7
8 For more information about the Nextion display project, please visit [the wiki。](http://wiki.iteadstudio.com/Nextion_HMI_Solution)
9 The wiki provdies all the necessary technical documnets, quick start guide, tutorials, demos, as well as some useful resources.
10
11 To get your Nextion display, please visit [iMall.](http://imall.itead.cc/display/nextion.html)
12
13 To discuss the project? Request new features? Report a BUG? please visit the [Forums](http://support.iteadstudio.com/discussions/1000058038)
14
15 ​
16 # Source
17
18 Latest source code can be download at https://github.com/itead/ITEADLIB_Arduino_Nextion.
19
20 You can clone it by:
21
22 git clone https://github.com/itead/ITEADLIB_Arduino_Nextion
23
24 # Documentation
25 Online API documentation can be reached at <http://docs.iteadstudio.com/ITEADLIB_Arduino_Nextion/>.
26
27 Offline API documentation can be found under directory
28 [doc](https://github.com/itead/ITEADLIB_Arduino_Nextion/tree/master/doc).
29
30 # Suppported Mainboards:
31
32 **All boards, which has one or more hardware serial, can be supported.**
33
34 For example:
35
36 - Iteaduino MEGA2560
37 - Iteaduino UNO
38 - Arduino MEGA2560
39 - Arduino UNO
40
41 # Serial configuration
42
43 In configuration file `NexSerialConfig.h`, you can find two macros below:
44
45 - dbSerial: Debug Serial (baudrate:9600), needed by beginners for debug your nextion applications or sketches. If
46 your complete your work, it will be a wise choice to disable Debug Serial.
47 - nexSerial: Nextion Serial, the bridge of Nextion and your mainboard.
48
49 **Note:** the default configuration is for MEGA2560.
50
51 ## Redirect dbSerial and nexSerial
52
53 If you want to change the default serial to debug or communicate with Nextion ,
54 you need to modify the line in file `NexSerialConfig.h`:
55
56 #define dbSerial Serial ---> #define dbSerial Serialxxx
57 #define nexSerial Serial2 ---> #define nexSeria Serialxxx
58
59 ## Disable Debug Serial
60
61 If you want to disable the debug information,you need to modify the line in file
62 `NexSerialConfig.h`:
63
64 #define DEBUG_SERIAL_ENABLE ---> //#define DEBUG_SERIAL_ENABLE
65
66 # UNO
67
68 If your board has only one hardware serial, such as UNO, you should disable
69 dbSerial and redirect nexSerial to Serial(Refer to section:`Serial configuration`).
70
71
72 -------------------------------------------------------------------------------
73
74
75 DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
76 Version 2, December 2004
77
78 Copyright (C) 2014 ITEAD Studio
79
80 Everyone is permitted to copy and distribute verbatim or modified
81 copies of this license document, and changing it is allowed as long
82 as the name is changed.
83
84 DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
85
86 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
87
88 0. You just DO WHAT THE FUCK YOU WANT TO.
89
90
91 -------------------------------------------------------------------------------