Sample of program breaking when a certain set of source files are in a folder, but is fine when it is in the root. In this case, it is tested with RF12B.cpp, RF12B.h and rfdefs
Kalman/RFSRF05/RFSRF05.h@0:349dc9b0984f, 2012-03-25 (annotated)
- Committer:
- narshu
- Date:
- Sun Mar 25 13:39:11 2012 +0000
- Revision:
- 0:349dc9b0984f
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
narshu | 0:349dc9b0984f | 1 | |
narshu | 0:349dc9b0984f | 2 | #ifndef MBED_RFSRF05_H |
narshu | 0:349dc9b0984f | 3 | #define MBED_RFSRF05_H |
narshu | 0:349dc9b0984f | 4 | |
narshu | 0:349dc9b0984f | 5 | #include "mbed.h" |
narshu | 0:349dc9b0984f | 6 | #include "RF12B.h" |
narshu | 0:349dc9b0984f | 7 | |
narshu | 0:349dc9b0984f | 8 | #define CODE0 0x22 |
narshu | 0:349dc9b0984f | 9 | #define CODE1 0x44 |
narshu | 0:349dc9b0984f | 10 | #define CODE2 0x88 |
narshu | 0:349dc9b0984f | 11 | |
narshu | 0:349dc9b0984f | 12 | /* SAMPLE IMPLEMENTATION! |
narshu | 0:349dc9b0984f | 13 | RFSRF05 my_srf(p13,p21,p22,p23,p24,p25,p26,p5,p6,p7,p8,p9); |
narshu | 0:349dc9b0984f | 14 | |
narshu | 0:349dc9b0984f | 15 | |
narshu | 0:349dc9b0984f | 16 | void callbinmain(int num, float dist) { |
narshu | 0:349dc9b0984f | 17 | //Here is where you deal with your brand new reading ;D |
narshu | 0:349dc9b0984f | 18 | } |
narshu | 0:349dc9b0984f | 19 | |
narshu | 0:349dc9b0984f | 20 | int main() { |
narshu | 0:349dc9b0984f | 21 | pc.printf("Hello World of RobotSonar!\r\n"); |
narshu | 0:349dc9b0984f | 22 | my_srf.callbackfunc = callbinmain; |
narshu | 0:349dc9b0984f | 23 | |
narshu | 0:349dc9b0984f | 24 | while (1); |
narshu | 0:349dc9b0984f | 25 | } |
narshu | 0:349dc9b0984f | 26 | |
narshu | 0:349dc9b0984f | 27 | */ |
narshu | 0:349dc9b0984f | 28 | class DummyCT; |
narshu | 0:349dc9b0984f | 29 | |
narshu | 0:349dc9b0984f | 30 | class RFSRF05 { |
narshu | 0:349dc9b0984f | 31 | public: |
narshu | 0:349dc9b0984f | 32 | |
narshu | 0:349dc9b0984f | 33 | RFSRF05( |
narshu | 0:349dc9b0984f | 34 | PinName trigger, |
narshu | 0:349dc9b0984f | 35 | PinName echo0, |
narshu | 0:349dc9b0984f | 36 | PinName echo1, |
narshu | 0:349dc9b0984f | 37 | PinName echo2, |
narshu | 0:349dc9b0984f | 38 | PinName echo3, |
narshu | 0:349dc9b0984f | 39 | PinName echo4, |
narshu | 0:349dc9b0984f | 40 | PinName echo5, |
narshu | 0:349dc9b0984f | 41 | PinName SDI, |
narshu | 0:349dc9b0984f | 42 | PinName SDO, |
narshu | 0:349dc9b0984f | 43 | PinName SCK, |
narshu | 0:349dc9b0984f | 44 | PinName NCS, |
narshu | 0:349dc9b0984f | 45 | PinName NIRQ); |
narshu | 0:349dc9b0984f | 46 | |
narshu | 0:349dc9b0984f | 47 | /** A non-blocking function that will return the last measurement |
narshu | 0:349dc9b0984f | 48 | * |
narshu | 0:349dc9b0984f | 49 | * @returns floating point representation of distance in cm |
narshu | 0:349dc9b0984f | 50 | */ |
narshu | 0:349dc9b0984f | 51 | float read0(); |
narshu | 0:349dc9b0984f | 52 | float read1(); |
narshu | 0:349dc9b0984f | 53 | float read2(); |
narshu | 0:349dc9b0984f | 54 | |
narshu | 0:349dc9b0984f | 55 | /** A assigns a callback function when a new reading is available **/ |
narshu | 0:349dc9b0984f | 56 | //void (*callbackfunc)(int beaconnum, float distance); |
narshu | 0:349dc9b0984f | 57 | //DummyCT* callbackobj; |
narshu | 0:349dc9b0984f | 58 | //void (DummyCT::*mcallbackfunc)(int beaconnum, float distance); |
narshu | 0:349dc9b0984f | 59 | |
narshu | 0:349dc9b0984f | 60 | //triggers a read |
narshu | 0:349dc9b0984f | 61 | void startRange(); |
narshu | 0:349dc9b0984f | 62 | |
narshu | 0:349dc9b0984f | 63 | /** A short hand way of using the read function */ |
narshu | 0:349dc9b0984f | 64 | operator float(); |
narshu | 0:349dc9b0984f | 65 | |
narshu | 0:349dc9b0984f | 66 | private : |
narshu | 0:349dc9b0984f | 67 | RF12B _rf; |
narshu | 0:349dc9b0984f | 68 | DigitalOut _trigger; |
narshu | 0:349dc9b0984f | 69 | InterruptIn _echo0; |
narshu | 0:349dc9b0984f | 70 | InterruptIn _echo1; |
narshu | 0:349dc9b0984f | 71 | InterruptIn _echo2; |
narshu | 0:349dc9b0984f | 72 | InterruptIn _echo3; |
narshu | 0:349dc9b0984f | 73 | InterruptIn _echo4; |
narshu | 0:349dc9b0984f | 74 | InterruptIn _echo5; |
narshu | 0:349dc9b0984f | 75 | Timer _timer; |
narshu | 0:349dc9b0984f | 76 | Ticker _ticker; |
narshu | 0:349dc9b0984f | 77 | void _rising (void); |
narshu | 0:349dc9b0984f | 78 | void _falling (void); |
narshu | 0:349dc9b0984f | 79 | float _dist[3]; |
narshu | 0:349dc9b0984f | 80 | char _code[3]; |
narshu | 0:349dc9b0984f | 81 | int _beacon_counter; |
narshu | 0:349dc9b0984f | 82 | bool ValidPulse; |
narshu | 0:349dc9b0984f | 83 | |
narshu | 0:349dc9b0984f | 84 | }; |
narshu | 0:349dc9b0984f | 85 | |
narshu | 0:349dc9b0984f | 86 | #endif |