Andrew Chen
/
RPC_Serial
serial settings for zumocrawler
Fork of RPC_Serial by
main.cpp@1:de34af25056a, 2010-08-24 (annotated)
- Committer:
- MichaelW
- Date:
- Tue Aug 24 15:15:44 2010 +0000
- Revision:
- 1:de34af25056a
- Parent:
- 0:78952cd3935b
- Child:
- 2:188bfc221aad
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MichaelW | 0:78952cd3935b | 1 | #include "mbed.h" |
MichaelW | 0:78952cd3935b | 2 | #include "rpc.h" |
MichaelW | 0:78952cd3935b | 3 | Serial pc(USBTX, USBRX); |
MichaelW | 0:78952cd3935b | 4 | int main() { |
MichaelW | 1:de34af25056a | 5 | // setup the classes that can be created dynamically |
MichaelW | 0:78952cd3935b | 6 | Base::add_rpc_class<AnalogIn>(); |
MichaelW | 0:78952cd3935b | 7 | Base::add_rpc_class<AnalogOut>(); |
MichaelW | 0:78952cd3935b | 8 | Base::add_rpc_class<DigitalIn>(); |
MichaelW | 0:78952cd3935b | 9 | Base::add_rpc_class<DigitalOut>(); |
MichaelW | 0:78952cd3935b | 10 | Base::add_rpc_class<DigitalInOut>(); |
MichaelW | 0:78952cd3935b | 11 | Base::add_rpc_class<PwmOut>(); |
MichaelW | 0:78952cd3935b | 12 | Base::add_rpc_class<Timer>(); |
MichaelW | 0:78952cd3935b | 13 | Base::add_rpc_class<SPI>(); |
MichaelW | 0:78952cd3935b | 14 | Base::add_rpc_class<BusOut>(); |
MichaelW | 0:78952cd3935b | 15 | Base::add_rpc_class<BusIn>(); |
MichaelW | 0:78952cd3935b | 16 | Base::add_rpc_class<BusInOut>(); |
MichaelW | 0:78952cd3935b | 17 | Base::add_rpc_class<Serial>(); |
MichaelW | 1:de34af25056a | 18 | // receive commands, and send back the responses |
MichaelW | 0:78952cd3935b | 19 | char buf[256], outbuf[256]; |
MichaelW | 0:78952cd3935b | 20 | while(1) { |
MichaelW | 0:78952cd3935b | 21 | pc.gets(buf, 256); |
MichaelW | 0:78952cd3935b | 22 | rpc(buf, outbuf); |
MichaelW | 0:78952cd3935b | 23 | pc.printf("%s\n", outbuf); |
MichaelW | 0:78952cd3935b | 24 | } |
MichaelW | 0:78952cd3935b | 25 | } |