A RPC example usage program.

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial by Michael Walker

Committer:
dhcabinian
Date:
Tue Mar 15 04:28:17 2016 +0000
Revision:
5:59421f613a13
Parent:
4:d69dfbef9644
Child:
6:cb40d6349b96
First iteration of the RPC Instantiation over the RPC interface using the new RPC Library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MichaelW 0:78952cd3935b 1 #include "mbed.h"
MichaelW 2:37712731e13d 2 #include "mbed_rpc.h"
MichaelW 2:37712731e13d 3
MichaelW 3:4ddd10908e46 4 /**
MichaelW 3:4ddd10908e46 5 * This example program has been updated to use the RPC implementation in the new mbed libraries.
dhcabinian 5:59421f613a13 6 * This example shows the creation of the RPCDigitalOut wrapper class over the RPC interface
MichaelW 3:4ddd10908e46 7 */
MichaelW 2:37712731e13d 8
MichaelW 2:37712731e13d 9 //Use the RPC enabled wrapped class - see RpcClasses.h for more info
dhcabinian 5:59421f613a13 10 RpcDigitalOut led1(LED1,"led1");
MichaelW 0:78952cd3935b 11 Serial pc(USBTX, USBRX);
dhcabinian 5:59421f613a13 12
MichaelW 0:78952cd3935b 13 int main() {
dhcabinian 5:59421f613a13 14 //Allows RPC to create objects of type RPCDigitalOut via the RPC Interface
dhcabinian 5:59421f613a13 15 RPC::add_rpc_class<RpcDigitalOut>();
dhcabinian 5:59421f613a13 16
MichaelW 0:78952cd3935b 17 char buf[256], outbuf[256];
MichaelW 0:78952cd3935b 18 while(1) {
MichaelW 0:78952cd3935b 19 pc.gets(buf, 256);
MichaelW 2:37712731e13d 20 //Call the static call method on the RPC class
MichaelW 2:37712731e13d 21 RPC::call(buf, outbuf);
MichaelW 0:78952cd3935b 22 pc.printf("%s\n", outbuf);
MichaelW 0:78952cd3935b 23 }
dhcabinian 4:d69dfbef9644 24 }