Diff: RFSRF05.h
- Revision:
- 1:0370ea94b64a
- Parent:
- 0:7583de124698
--- a/RFSRF05.h Fri Mar 30 19:44:25 2012 +0000 +++ b/RFSRF05.h Thu Apr 26 17:50:00 2012 +0000 @@ -2,8 +2,12 @@ #ifndef MBED_RFSRF05_H #define MBED_RFSRF05_H + + #include "mbed.h" #include "RF12B.h" +#include "globals.h" + #define CODE0 0x22 #define CODE1 0x44 @@ -47,23 +51,30 @@ /** A non-blocking function that will return the last measurement * - * @returns floating point representation of distance in cm + * @returns floating point representation of distance in mm */ float read0(); float read1(); float read2(); float read(unsigned int beaconnum); + /** A assigns a callback function when a new reading is available **/ void (*callbackfunc)(int beaconnum, float distance); DummyCT* callbackobj; - void (DummyCT::*mcallbackfunc)(int beaconnum, float distance); + void (DummyCT::*mcallbackfunc)(int beaconnum, float distance, float variance); //triggers a read - void startRange(); + #ifndef PRIMARY_ROBOT + void startRange(unsigned char rx_code); + #endif + + //set codes + void setCode(int code_index, unsigned char code); + unsigned char codes[3]; /** A short hand way of using the read function */ - operator float(); + //operator float(); private : RF12B _rf; @@ -76,10 +87,12 @@ InterruptIn _echo5; Timer _timer; Ticker _ticker; + #ifdef PRIMARY_ROBOT + void _startRange(void); + #endif void _rising (void); void _falling (void); float _dist[3]; - char _code[3]; int _beacon_counter; bool ValidPulse; bool expValidPulse;