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.
Dependencies: NTPClient W5500Interface Watchdog device_configuration eeprom_flash mbed-rpc-nucleo mbed-rtos mbed
Fork of F103-Serial-to-Ethernet by
Revision 38:f8735ae519aa, committed 2016-06-13
- Comitter:
- olympux
- Date:
- Mon Jun 13 23:06:38 2016 +0000
- Parent:
- 37:94b847fea94e
- Child:
- 39:083cf93121a9
- Commit message:
- Supported RPCVariable and RPCFunction
Changed in this revision
--- a/README.md Mon Jun 13 22:41:29 2016 +0000 +++ b/README.md Mon Jun 13 23:06:38 2016 +0000 @@ -8,7 +8,12 @@ # Releases -## v2.0 (04/06/2016) +## v2.0.0 (04/06/2016) + +New features + +- RPCVariable +- RPCFunction Improvements
--- a/main.cpp Mon Jun 13 22:41:29 2016 +0000
+++ b/main.cpp Mon Jun 13 23:06:38 2016 +0000
@@ -169,7 +169,6 @@
// Watchdog
Watchdog wdt;
-
/*
* NNIO Protocol
*/
@@ -270,6 +269,27 @@
}
+// These are examples of some variable types that can be modified through RPC.
+int wheelsOn;
+char lcdBannerMessage;
+float speed;
+
+RPCVariable<int> rpcLights(&wheelsOn, "wheels");
+RPCVariable<char> rpcBanner(&lcdBannerMessage, "banner");
+RPCVariable<float> rpcSpeed(&speed, "speed");
+
+/**
+ * RPC function definitions
+ */
+// Create a function of the required format
+void do_blink(Arguments* args, Reply* rep);
+void do_blink(Arguments* args, Reply* rep){
+ DBG("RPC function called");
+}
+// Attach it to an RPC object
+RPCFunction blink(&do_blink, "blink");
+
+// Main code
int main()
{
int n, ret;
--- a/protocol_rpc.txt Mon Jun 13 22:41:29 2016 +0000
+++ b/protocol_rpc.txt Mon Jun 13 23:06:38 2016 +0000
@@ -47,4 +47,19 @@
/uart/baud 9600
/uart/putc 60: send ASCII code, '<'
/uart/getc x: return ASCII code
- /uart/puts helloworld: print helloworld to serial port
\ No newline at end of file
+ /uart/puts helloworld: print helloworld to serial port
+
+7. RPCVariable
+ + Declare normal variables and associate them with RPCVariable, e.g. int wheels, float speed, char banner
+ + Commands:
+ /speed/write 34.5
+ /speed/read x
+ /wheels/write 64
+ /wheels/read x
+ /banner/write c
+ /banner/read x
+
+8. RPCFunction
+ + Declare a function and associate it with RPCFunction
+ + Commands:
+ /func_name/run x
\ No newline at end of file
