CompHotspot_v0_32.ino
#include "Nextion.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);
}
nexLoop
void nexLoop(NexTouch *nex_listen_list[])
Listen touch event and calling callbacks attached before.
Definition: NexHardware.cpp:235
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
Nextion.h
The header file including all other header files provided by this library.
NexHotspot
NexHotspot component.
Definition: NexHotspot.h:30
NexTouch
Father class of the components with touch events.
Definition: NexTouch.h:53
NexTouch::attachPush
void attachPush(NexTouchEventCb push, void *ptr=NULL)
Attach an callback function of push touch event.
Definition: NexTouch.cpp:27