Shuto Naruse
/
Eurobot2012_Secondary
Eurobot2012_Secondary
Fork of Eurobot_2012_Secondary by
Diff: Kalman/Sonar/RFSRF05.h
- Revision:
- 1:cc2a9eb0bd55
- Parent:
- 0:fbfafa6bf5f9
diff -r fbfafa6bf5f9 -r cc2a9eb0bd55 Kalman/Sonar/RFSRF05.h --- a/Kalman/Sonar/RFSRF05.h Fri Apr 20 21:32:24 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ - -#ifndef MBED_RFSRF05_H -#define MBED_RFSRF05_H - -#include "mbed.h" -#include "RF12B.h" - -#define CODE0 0x22 -#define CODE1 0x44 -#define CODE2 0x88 - -/* SAMPLE IMPLEMENTATION! -RFSRF05 my_srf(p13,p21,p22,p23,p24,p25,p26,p5,p6,p7,p8,p9); - - -void callbinmain(int num, float dist) { - //Here is where you deal with your brand new reading ;D -} - -int main() { - pc.printf("Hello World of RobotSonar!\r\n"); - my_srf.callbackfunc = callbinmain; - - while (1); -} - - */ - -class DummyCT; - -class RFSRF05 { -public: - - RFSRF05( - PinName trigger, - PinName echo0, - PinName echo1, - PinName echo2, - PinName echo3, - PinName echo4, - PinName echo5, - PinName SDI, - PinName SDO, - PinName SCK, - PinName NCS, - PinName NIRQ); - - /** A non-blocking function that will return the last measurement - * - * @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, float variance); - - //triggers a read - - - /** A short hand way of using the read function */ - //operator float(); - -private : - RF12B _rf; - DigitalOut _trigger; - InterruptIn _echo0; - InterruptIn _echo1; - InterruptIn _echo2; - InterruptIn _echo3; - InterruptIn _echo4; - InterruptIn _echo5; - Timer _timer; - Ticker _ticker; - void _startRange(); - void _rising (void); - void _falling (void); - float _dist[3]; - char _code[3]; - int _beacon_counter; - bool ValidPulse; - bool expValidPulse; - -}; - -#endif