Shuto Naruse
/
Eurobot2012_Beacons
Eurobot2012_Beacons
Diff: RF12B/RF12B.cpp
- Revision:
- 2:3ff84732828f
- Parent:
- 0:b8be0a00c4f8
diff -r b0aa1251016a -r 3ff84732828f RF12B/RF12B.cpp --- a/RF12B/RF12B.cpp Sat Apr 28 17:07:20 2012 +0000 +++ b/RF12B/RF12B.cpp Sat Apr 28 17:11:25 2012 +0000 @@ -24,7 +24,7 @@ /* Setup interrupt to happen on falling edge of NIRQ */ NIRQ.fall(this, &RF12B::rxISR); - + /* Dummy code init */ rfCode = 0x00; } @@ -183,8 +183,8 @@ // 4. Data Rate Command - writeCmd(RFM_DATA_RATE_9600); - + //writeCmd(RFM_DATA_RATE_9600); + writeCmd(RFM_DATA_RATE_57600); // 5. Receiver Control Command writeCmd( @@ -344,6 +344,13 @@ while (!temp.empty()) { fifo.push(temp.front()); temp.pop(); + + if (read() == rfCode) { + TRIG = 1; + wait_us(10); + TRIG = 0; + trigLED = !trigLED; + } } } @@ -356,12 +363,6 @@ } } } - if (read() == rfCode) { - TRIG = 1; - wait_us(10); - TRIG = 0; - trigLED = !trigLED; - } } unsigned int RF12B::status() { @@ -388,6 +389,6 @@ } /* RF code set */ -void RF12B::setCode(unsigned char code){ -rfCode = code; +void RF12B::setCode(unsigned char code) { + rfCode = code; } \ No newline at end of file