RPC over Serial with read line interrupt tested on LPC1768 and mac minicom terminal. Baudrate 115200

Dependencies:   mbed-rpc-stmfork mbed-src

Fork of rpc_over_serial by Suga koubou

main.cpp

Committer:
okini3939
Date:
2013-09-27
Revision:
0:7e0e5391432a
Child:
1:ae55f51ee284

File content as of revision 0:7e0e5391432a:

#include "mbed.h"
#include "mbed_rpc.h"

RPC rpc();
Serial pc(USBTX, USBRX);

int main() {
    char buf[256], outbuf[256];

    // setup the classes that can be created dynamically
//    RPC::add_rpc_class<RpcAnalogIn>();
//    RPC::add_rpc_class<RpcAnalogOut>();
    RPC::add_rpc_class<RpcDigitalIn>();
    RPC::add_rpc_class<RpcDigitalOut>();
    RPC::add_rpc_class<RpcDigitalInOut>();
    RPC::add_rpc_class<RpcPwmOut>();
    RPC::add_rpc_class<RpcTimer>();
    RPC::add_rpc_class<RpcSPI>();
    RPC::add_rpc_class<RpcSerial>();

    // receive commands, and send back the responses
    while(1) {
        pc.gets(buf, 256);
        RPC::call(buf, outbuf); 
        pc.printf("%s\r\n", outbuf);
    }
}