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.
Fork of RPC_Serial by
Revision 2:fe5692354530, committed 2015-04-24
- Comitter:
- apullin
- Date:
- Fri Apr 24 03:20:22 2015 +0000
- Parent:
- 1:c7b247964631
- Child:
- 3:92f92f48bd8c
- Commit message:
- Changed ifdef's to if's, since library does define 1/0
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed-rpc.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 23 23:35:11 2015 +0000
+++ b/main.cpp Fri Apr 24 03:20:22 2015 +0000
@@ -1,27 +1,63 @@
#include "mbed.h"
-#include "rpc.h"
+#include "mbed_rpc.h"
+
+//using namespace mbed;
Serial pc(USBTX, USBRX);
int main() {
// setup the classes that can be created dynamically
- RPC::add_rpc_class<AnalogIn>();
- RPC::add_rpc_class<AnalogOut>();
- RPC::add_rpc_class<DigitalIn>();
- RPC::add_rpc_class<DigitalOut>();
- RPC::add_rpc_class<DigitalInOut>();
- RPC::add_rpc_class<PwmOut>();
- RPC::add_rpc_class<Timer>();
- RPC::add_rpc_class<SPI>();
- RPC::add_rpc_class<BusOut>();
- RPC::add_rpc_class<BusIn>();
- RPC::add_rpc_class<BusInOut>();
- RPC::add_rpc_class<Serial>();
+
+ //These exist for all platforms
+ RPC::add_rpc_class<RpcDigitalIn>();
+ RPC::add_rpc_class<RpcDigitalOut>();
+ RPC::add_rpc_class<RpcDigitalInOut>();
+ RPC::add_rpc_class<RpcTimer>();
+
+ //Others are conditional by platform
+
+ //Unknown how RPC would work if serial was not present?
+ #if DEVICE_SERIAL
+ RPC::add_rpc_class<RpcSerial>();
+ #else
+ #warning "No Serial function available in this configuration."
+ #endif
+
+ #if DEVICE_ANALOGIN
+ RPC::add_rpc_class<RpcAnalogIn>();
+ #else
+ #warning "No AnalogIn function available in this configuration."
+ #endif
+
+ #if DEVICE_ANALOGOUT
+ RPC::add_rpc_class<RpcAnalogOut>();
+ #else
+ #warning "No AnalogOut function available in this configuration."
+ #endif
+
+ #if DEVICE_PWMOUT
+ RPC::add_rpc_class<RpcPwmOut>();
+ #else
+ #warning "No PWMOut function available in this configuration."
+ #endif
+
+ #if DEVICE_SPI
+ RPC::add_rpc_class<RpcSPI>();
+ #else
+ #warning "No SPI function available in this configuration."
+ #endif
+
+ //These appear to not be implemented
+ //RPC::add_rpc_class<BusOut>();
+ //RPC::add_rpc_class<RpcBusIn>();
+ //RPC::add_rpc_class<RpcBusInOut>();
+
// receive commands, and send back the responses
- char buf[256], outbuf[256];
+ char buf[RPC_MAX_STRING], outbuf[RPC_MAX_STRING];
while(1) {
- pc.gets(buf, 256);
- rpc(buf, outbuf);
+ pc.gets(buf, RPC_MAX_STRING);
+ RPC::call(buf, outbuf);
pc.printf("%s\n", outbuf);
}
+
}
--- a/mbed-rpc.lib Thu Apr 23 23:35:11 2015 +0000 +++ b/mbed-rpc.lib Fri Apr 24 03:20:22 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/mbed/code/mbed-rpc/#fece2d5e8d96 +http://developer.mbed.org/users/apullin/code/mbed-rpc/#228c68184e71
