Michael Walker
/
RPC_Serial
Program to interface with mbed using RPC over Serial
Revision 2:37712731e13d, committed 2014-08-14
- Comitter:
- MichaelW
- Date:
- Thu Aug 14 09:08:44 2014 +0000
- Parent:
- 1:de34af25056a
- Child:
- 3:4ddd10908e46
- Commit message:
- Intial Commit of RPC over serial updated to the new RPC implementation on mbed
Changed in this revision
--- a/main.cpp Tue Aug 24 15:15:44 2010 +0000 +++ b/main.cpp Thu Aug 14 09:08:44 2014 +0000 @@ -1,25 +1,21 @@ #include "mbed.h" -#include "rpc.h" +#include "mbed_rpc.h" + +//This example program as been updated to use the RPC implementation in the new mbed libraries. + +//Use the RPC enabled wrapped class - see RpcClasses.h for more info +RpcDigitalOut myled(LED4,"myled"); + Serial pc(USBTX, USBRX); int main() { - // setup the classes that can be created dynamically - Base::add_rpc_class<AnalogIn>(); - Base::add_rpc_class<AnalogOut>(); - Base::add_rpc_class<DigitalIn>(); - Base::add_rpc_class<DigitalOut>(); - Base::add_rpc_class<DigitalInOut>(); - Base::add_rpc_class<PwmOut>(); - Base::add_rpc_class<Timer>(); - Base::add_rpc_class<SPI>(); - Base::add_rpc_class<BusOut>(); - Base::add_rpc_class<BusIn>(); - Base::add_rpc_class<BusInOut>(); - Base::add_rpc_class<Serial>(); + //The mbed RPC classes are now wrapped to create an RPC enabled version - see RpcClasses.h so no longer any need to add them to the base class + // receive commands, and send back the responses char buf[256], outbuf[256]; while(1) { pc.gets(buf, 256); - rpc(buf, outbuf); + //Call the static call method on the RPC class + RPC::call(buf, outbuf); pc.printf("%s\n", outbuf); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rpc.lib Thu Aug 14 09:08:44 2014 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/teams/mbed/code/mbed-rpc/#4490a0d9cb2a
--- a/mbed.bld Tue Aug 24 15:15:44 2010 +0000 +++ b/mbed.bld Thu Aug 14 09:08:44 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da +http://mbed.org/users/mbed_official/code/mbed/builds/6213f644d804 \ No newline at end of file