Fork of mbed-rpc.

Dependents:   RPC_Serial

Fork of mbed-rpc by Mbed

Files at this revision

API Documentation at this revision

Comitter:
apullin
Date:
Fri Apr 24 00:51:09 2015 +0000
Parent:
8:fece2d5e8d96
Commit message:
Adding getArg and putData for uint16_t types, which are required for AnalogIn.; ; Untested on hardware.

Changed in this revision

Arguments.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r fece2d5e8d96 -r 228c68184e71 Arguments.cpp
--- a/Arguments.cpp	Mon Feb 09 09:15:22 2015 +0000
+++ b/Arguments.cpp	Fri Apr 24 00:51:09 2015 +0000
@@ -98,6 +98,12 @@
     return atof(argv[index]);
 }
 
+template<> uint16_t Arguments::getArg<uint16_t>(void) {
+    index++;
+    char *pEnd;
+    return (uint16_t)(strtol(argv[index], &pEnd, 10) & 0xffff);
+}
+
 Reply::Reply(char* r) {
     first = true;
     *r = '\0';
@@ -137,4 +143,9 @@
     reply += sprintf(reply, "%.17g", f);
 }
 
+template<> void Reply::putData<unsigned short>(unsigned short uint16) {
+    separator();
+    reply += sprintf(reply, "%u", uint16);
+}
+
 } // namespace mbed