CompPage.ino
#include "Nextion.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);
}
nexLoop
void nexLoop(NexTouch *nex_listen_list[])
Listen touch event and calling callbacks attached before.
Definition: NexHardware.cpp:235
NexPage::show
bool show(void)
Show itself.
Definition: NexPage.cpp:23
NexTouch::attachPop
void attachPop(NexTouchEventCb pop, void *ptr=NULL)
Attach an callback function of pop touch event.
Definition: NexTouch.cpp:39
nexInit
bool nexInit(void)
Init Nextion.
Definition: NexHardware.cpp:220
NexPage
A special component , which can contain other components such as NexButton, NexText and NexWaveform...
Definition: NexPage.h:31
Nextion.h
The header file including all other header files provided by this library.
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53