example serial interface for python and LPC11U24

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial by bhavik gala

Committer:
bhavik
Date:
Fri Jun 20 16:02:35 2014 +0000
Revision:
4:726b4e996614
Parent:
3:726cfc72fe9a
rpc serial interface using mbed-rpc library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MichaelW 0:78952cd3935b 1 #include "mbed.h"
bhavik 3:726cfc72fe9a 2 #include "mbed_rpc.h"
bhavik 2:fadccef926e4 3
MichaelW 0:78952cd3935b 4 Serial pc(USBTX, USBRX);
bhavik 2:fadccef926e4 5
MichaelW 0:78952cd3935b 6 int main() {
MichaelW 1:de34af25056a 7 // setup the classes that can be created dynamically
bhavik 4:726b4e996614 8 RPC::add_rpc_class<RpcAnalogIn>();
bhavik 4:726b4e996614 9 RPC::add_rpc_class<RpcAnalogOut>();
bhavik 3:726cfc72fe9a 10 RPC::add_rpc_class<RpcDigitalIn>();
bhavik 4:726b4e996614 11 RPC::add_rpc_class<RpcDigitalOut>();
bhavik 4:726b4e996614 12 RPC::add_rpc_class<RpcDigitalInOut>();
bhavik 4:726b4e996614 13 RPC::add_rpc_class<RpcPwmOut>();
bhavik 4:726b4e996614 14 RPC::add_rpc_class<RpcTimer>();
bhavik 4:726b4e996614 15 RPC::add_rpc_class<RpcSPI>();
bhavik 4:726b4e996614 16 RPC::add_rpc_class<RpcBusOut>();
bhavik 4:726b4e996614 17 RPC::add_rpc_class<RpcBusIn>();
bhavik 4:726b4e996614 18 RPC::add_rpc_class<RpcBusInOut>();
bhavik 4:726b4e996614 19 RPC::add_rpc_class<RpcSerial>();
bhavik 3:726cfc72fe9a 20
MichaelW 1:de34af25056a 21 // receive commands, and send back the responses
bhavik 3:726cfc72fe9a 22 char buf[256], outbuf[256];
bhavik 3:726cfc72fe9a 23
MichaelW 0:78952cd3935b 24 while(1) {
MichaelW 0:78952cd3935b 25 pc.gets(buf, 256);
bhavik 3:726cfc72fe9a 26 RPC::call(buf, outbuf);
MichaelW 0:78952cd3935b 27 pc.printf("%s\n", outbuf);
MichaelW 0:78952cd3935b 28 }
MichaelW 0:78952cd3935b 29 }