Fork of mbed RPC_serial to fix build errors. mbed RPC_Serial for LabVIEW interface: http://mbed.org/cookbook/Interfacing-with-LabVIEW http://mbed.org/cookbook/Interfacing-Using-RPC Steps: *Compile RPC_Serial main *Copy bit file to mbed flash and reset *Run examples in LabVIEW
Fork of RPC_Serial by
main.cpp@1:c7b247964631, 2015-04-23 (annotated)
- Committer:
- apullin
- Date:
- Thu Apr 23 23:35:11 2015 +0000
- Revision:
- 1:c7b247964631
- Parent:
- 0:3ffd66df9efb
- Child:
- 2:fe5692354530
Updates to get program to build with latest libraries.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
harrisjunaid | 0:3ffd66df9efb | 1 | #include "mbed.h" |
harrisjunaid | 0:3ffd66df9efb | 2 | #include "rpc.h" |
apullin | 1:c7b247964631 | 3 | |
harrisjunaid | 0:3ffd66df9efb | 4 | Serial pc(USBTX, USBRX); |
apullin | 1:c7b247964631 | 5 | |
harrisjunaid | 0:3ffd66df9efb | 6 | int main() { |
harrisjunaid | 0:3ffd66df9efb | 7 | // setup the classes that can be created dynamically |
apullin | 1:c7b247964631 | 8 | RPC::add_rpc_class<AnalogIn>(); |
apullin | 1:c7b247964631 | 9 | RPC::add_rpc_class<AnalogOut>(); |
apullin | 1:c7b247964631 | 10 | RPC::add_rpc_class<DigitalIn>(); |
apullin | 1:c7b247964631 | 11 | RPC::add_rpc_class<DigitalOut>(); |
apullin | 1:c7b247964631 | 12 | RPC::add_rpc_class<DigitalInOut>(); |
apullin | 1:c7b247964631 | 13 | RPC::add_rpc_class<PwmOut>(); |
apullin | 1:c7b247964631 | 14 | RPC::add_rpc_class<Timer>(); |
apullin | 1:c7b247964631 | 15 | RPC::add_rpc_class<SPI>(); |
apullin | 1:c7b247964631 | 16 | RPC::add_rpc_class<BusOut>(); |
apullin | 1:c7b247964631 | 17 | RPC::add_rpc_class<BusIn>(); |
apullin | 1:c7b247964631 | 18 | RPC::add_rpc_class<BusInOut>(); |
apullin | 1:c7b247964631 | 19 | RPC::add_rpc_class<Serial>(); |
harrisjunaid | 0:3ffd66df9efb | 20 | // receive commands, and send back the responses |
harrisjunaid | 0:3ffd66df9efb | 21 | char buf[256], outbuf[256]; |
harrisjunaid | 0:3ffd66df9efb | 22 | while(1) { |
harrisjunaid | 0:3ffd66df9efb | 23 | pc.gets(buf, 256); |
harrisjunaid | 0:3ffd66df9efb | 24 | rpc(buf, outbuf); |
harrisjunaid | 0:3ffd66df9efb | 25 | pc.printf("%s\n", outbuf); |
harrisjunaid | 0:3ffd66df9efb | 26 | } |
harrisjunaid | 0:3ffd66df9efb | 27 | } |