@@ -217,16 +217,24 @@ bool recvRetCommandFinished(uint32_t timeout)
217
217
}
218
218
219
219
220
+ bool nexInit (void )
221
+ {
222
+ bool ret1 = false ;
223
+ bool ret2 = false ;
224
+
225
+ dbSerialBegin (9600 );
226
+ nexSerial.begin (9600 );
227
+ sendCommand (" " );
228
+ sendCommand (" bkcmd=1" );
229
+ ret1 = recvRetCommandFinished ();
230
+ sendCommand (" page 0" );
231
+ ret2 = recvRetCommandFinished ();
232
+ return ret1 && ret2;
233
+ }
220
234
221
- /* *
222
- * Watting for Nextion's touch event.
223
- *
224
- * @param list - index to Nextion Components list.
225
- *
226
- */
227
- static void mainEventLoop (NexTouch **list)
235
+ void nexLoop (NexTouch **nex_listen_list)
228
236
{
229
- static uint8_t __buffer[16 ];
237
+ static uint8_t __buffer[10 ];
230
238
231
239
uint16_t i;
232
240
uint8_t c;
@@ -249,53 +257,11 @@ static void mainEventLoop(NexTouch **list)
249
257
250
258
if (0xFF == __buffer[4 ] && 0xFF == __buffer[5 ] && 0xFF == __buffer[6 ])
251
259
{
252
- NexTouch::iterate (list , __buffer[1 ], __buffer[2 ], (int32_t )__buffer[3 ]);
260
+ NexTouch::iterate (nex_listen_list , __buffer[1 ], __buffer[2 ], (int32_t )__buffer[3 ]);
253
261
}
254
262
255
263
}
256
264
}
257
265
}
258
266
}
259
267
260
- /* *
261
- * @addtogroup Nextion
262
- * @{
263
- */
264
-
265
-
266
- /* *
267
- * Init Nextion's baudrate,page id.
268
- *
269
- * @retval true - success.
270
- * @retval false - failed.
271
- */
272
- bool nexInit (void )
273
- {
274
- bool ret1 = false ;
275
- bool ret2 = false ;
276
-
277
- dbSerialBegin (9600 );
278
- nexSerial.begin (9600 );
279
- sendCommand (" " );
280
- sendCommand (" bkcmd=1" );
281
- ret1 = recvRetCommandFinished ();
282
- sendCommand (" page 0" );
283
- ret2 = recvRetCommandFinished ();
284
- return ret1 && ret2;
285
- }
286
-
287
- /* *
288
- * Call mainEventLoop,watting for Nextion's touch event.
289
- *
290
- * @param nex_listen_list - index to Nextion Components list.
291
- *
292
- */
293
- void nexLoop (NexTouch **nex_listen_list)
294
- {
295
- mainEventLoop (nex_listen_list);
296
- }
297
-
298
- /* *
299
- * @}
300
- */
301
-
0 commit comments