Shuto Naruse
/
eurobot_2011_main
RF12B/RFSerial.cpp@0:c8c04928d025, 2012-02-29 (annotated)
- Committer:
- narshu
- Date:
- Wed Feb 29 17:50:49 2012 +0000
- Revision:
- 0:c8c04928d025
Primary Robot with Sonar function - needs PID tuning for motor control
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
narshu | 0:c8c04928d025 | 1 | |
narshu | 0:c8c04928d025 | 2 | /* Constructor */ |
narshu | 0:c8c04928d025 | 3 | #include "RFSerial.h" |
narshu | 0:c8c04928d025 | 4 | |
narshu | 0:c8c04928d025 | 5 | RFSerial::RFSerial(PinName _SDI, |
narshu | 0:c8c04928d025 | 6 | PinName _SDO, |
narshu | 0:c8c04928d025 | 7 | PinName _SCK, |
narshu | 0:c8c04928d025 | 8 | PinName _NCS, |
narshu | 0:c8c04928d025 | 9 | PinName _NIRQ) |
narshu | 0:c8c04928d025 | 10 | :RF12B(_SDI, _SDO, _SCK, _NCS, _NIRQ) { |
narshu | 0:c8c04928d025 | 11 | |
narshu | 0:c8c04928d025 | 12 | } |
narshu | 0:c8c04928d025 | 13 | |
narshu | 0:c8c04928d025 | 14 | // Stream implementation functions |
narshu | 0:c8c04928d025 | 15 | int RFSerial::_putc(int value) { |
narshu | 0:c8c04928d025 | 16 | RF12B::write((unsigned char) value); |
narshu | 0:c8c04928d025 | 17 | return value; |
narshu | 0:c8c04928d025 | 18 | } |
narshu | 0:c8c04928d025 | 19 | int RFSerial::_getc() { |
narshu | 0:c8c04928d025 | 20 | if(available()) { |
narshu | 0:c8c04928d025 | 21 | return RF12B::read(); |
narshu | 0:c8c04928d025 | 22 | } else { |
narshu | 0:c8c04928d025 | 23 | return EOF; |
narshu | 0:c8c04928d025 | 24 | } |
narshu | 0:c8c04928d025 | 25 | } |