Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: NexHardware.h
- Revision:
- 1:e4163fd9aa4c
- Parent:
- 0:67bae57e0b73
diff -r 67bae57e0b73 -r e4163fd9aa4c NexHardware.h
--- a/NexHardware.h Wed Apr 15 17:02:54 2020 +0000
+++ b/NexHardware.h Mon May 04 17:52:49 2020 +0000
@@ -1,35 +1,16 @@
-/**
- * @file NexHardware.h
- *
- * The definition of base API for using Nextion.
- *
- * @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
- * @date 2015/8/11
- * @copyright
- * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
- * 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.
- */
#ifndef __NEXHARDWARE_H__
#define __NEXHARDWARE_H__
-
-//#include <Arduino.h>
+#include "mbed.h"
#include "NexConfig.h"
#include "NexTouch.h"
-
-/**
- * @addtogroup CoreAPI
- * @{
- */
-
+#include "NexObject.h"
+#include "Utilities.h"
/**
* Init Nextion.
*
* @return true if success, false for failure.
*/
-bool nexInit(void);
+uint8_t nexInit(void);
/**
* Listen touch event and calling callbacks attached before.
@@ -42,15 +23,20 @@
* @warning This function must be called repeatedly to response touch events
* from Nextion touch panel. Actually, you should place it in your loop function.
*/
-void nexLoop(NexTouch *nex_listen_list[]);
+void nexLoop(struct NexObject *nex_listen_list[]);
/**
* @}
*/
+//timeout=100
+uint8_t recvRetNumber(uint32_t *number);
+uint16_t recvRetString(char *buffer, uint16_t len);
+uint8_t recvRetCommandFinished();
+void sendCommand(char *command);
-bool recvRetNumber(uint32_t *number, uint32_t timeout = 100);
-uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout = 100);
-void sendCommand(const char* cmd);
-bool recvRetCommandFinished(uint32_t timeout = 100);
+#define CreateNexObject(obj, pid, id, name) \
+ obj.__pid = pid; \
+ obj.__cid = id; \
+ StringCopy(obj.__name, name)
#endif /* #ifndef __NEXHARDWARE_H__ */
\ No newline at end of file