![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Wireless
Dependencies: C12832 MMA7660 RPCInterface TextLCD mbed
Fork of RPC_Serial by
main.cpp@0:3ffd66df9efb, 2012-04-21 (annotated)
- Committer:
- harrisjunaid
- Date:
- Sat Apr 21 00:47:46 2012 +0000
- Revision:
- 0:3ffd66df9efb
- Child:
- 1:e245b0b4d96c
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" |
harrisjunaid | 0:3ffd66df9efb | 3 | Serial pc(USBTX, USBRX); |
harrisjunaid | 0:3ffd66df9efb | 4 | int main() { |
harrisjunaid | 0:3ffd66df9efb | 5 | // setup the classes that can be created dynamically |
harrisjunaid | 0:3ffd66df9efb | 6 | Base::add_rpc_class<AnalogIn>(); |
harrisjunaid | 0:3ffd66df9efb | 7 | Base::add_rpc_class<AnalogOut>(); |
harrisjunaid | 0:3ffd66df9efb | 8 | Base::add_rpc_class<DigitalIn>(); |
harrisjunaid | 0:3ffd66df9efb | 9 | Base::add_rpc_class<DigitalOut>(); |
harrisjunaid | 0:3ffd66df9efb | 10 | Base::add_rpc_class<DigitalInOut>(); |
harrisjunaid | 0:3ffd66df9efb | 11 | Base::add_rpc_class<PwmOut>(); |
harrisjunaid | 0:3ffd66df9efb | 12 | Base::add_rpc_class<Timer>(); |
harrisjunaid | 0:3ffd66df9efb | 13 | Base::add_rpc_class<SPI>(); |
harrisjunaid | 0:3ffd66df9efb | 14 | Base::add_rpc_class<BusOut>(); |
harrisjunaid | 0:3ffd66df9efb | 15 | Base::add_rpc_class<BusIn>(); |
harrisjunaid | 0:3ffd66df9efb | 16 | Base::add_rpc_class<BusInOut>(); |
harrisjunaid | 0:3ffd66df9efb | 17 | Base::add_rpc_class<Serial>(); |
harrisjunaid | 0:3ffd66df9efb | 18 | // receive commands, and send back the responses |
harrisjunaid | 0:3ffd66df9efb | 19 | char buf[256], outbuf[256]; |
harrisjunaid | 0:3ffd66df9efb | 20 | while(1) { |
harrisjunaid | 0:3ffd66df9efb | 21 | pc.gets(buf, 256); |
harrisjunaid | 0:3ffd66df9efb | 22 | rpc(buf, outbuf); |
harrisjunaid | 0:3ffd66df9efb | 23 | pc.printf("%s\n", outbuf); |
harrisjunaid | 0:3ffd66df9efb | 24 | } |
harrisjunaid | 0:3ffd66df9efb | 25 | } |