Documentation: examples/CompHotspot/CompHotspot.ino Source File

| Documentation For Arduino users

- Main Page
- Related Pages
- Modules
- Classes
- Files
- Examples

- File List
- File Members

CompHotspot.ino
1
18 #include "Nextion.h"
19
20 NexHotspot hot0 = NexHotspot(0, 1, "hot0");
21 NexHotspot hot1 = NexHotspot(0, 2, "hot1");
22
23 NexTouch *nex_listen_list[] =
24 {
25 &hot0,
26 &hot1,
27 NULL
28 };
29
30 void hot0PushCallback(void *ptr)
31 {
32 dbSerialPrintln("hot0PushCallback");
33 dbSerialPrint("ptr=");
34 dbSerialPrintln((uint32_t)ptr);
35 }
36
37 void hot1PushCallback(void *ptr)
38 {
39 dbSerialPrintln("hot1PushCallback");
40 dbSerialPrint("ptr=");
41 dbSerialPrintln((uint32_t)ptr);
42 }
43
44 void hot0PopCallback(void *ptr)
45 {
46 dbSerialPrintln("hot0PopCallback");
47 dbSerialPrint("ptr=");
48 dbSerialPrintln((uint32_t)ptr);
49 }
50
51 void hot1PopCallback(void *ptr)
52 {
53 dbSerialPrintln("hot1PopCallback");
54 dbSerialPrint("ptr=");
55 dbSerialPrintln((uint32_t)ptr);
56 }
57
58 void setup(void)
59 {
60 nexInit();
61 hot0.attachPush(hot0PushCallback, &hot0);
62 hot0.attachPop(hot0PopCallback, &hot0);
63 hot1.attachPush(hot1PushCallback, &hot1);
64 hot1.attachPop(hot1PopCallback, &hot1);
65 dbSerialPrintln("setup done");
66 }
67
68 void loop(void)
69 {
70 nexLoop(nex_listen_list);
71 }
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