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
RFSRF05.h
00001 00002 #ifndef MBED_RFSRF05_H 00003 #define MBED_RFSRF05_H 00004 00005 #include "mbed.h" 00006 #include "RF12B.h" 00007 00008 #define CODE0 0x22 00009 #define CODE1 0x44 00010 #define CODE2 0x88 00011 00012 /* SAMPLE IMPLEMENTATION! 00013 RFSRF05 my_srf(p13,p21,p22,p23,p24,p25,p26,p5,p6,p7,p8,p9); 00014 00015 00016 void callbinmain(int num, float dist) { 00017 //Here is where you deal with your brand new reading ;D 00018 } 00019 00020 int main() { 00021 pc.printf("Hello World of RobotSonar!\r\n"); 00022 my_srf.callbackfunc = callbinmain; 00023 00024 while (1); 00025 } 00026 00027 */ 00028 class DummyCT; 00029 00030 class RFSRF05 { 00031 public: 00032 00033 RFSRF05( 00034 PinName trigger, 00035 PinName echo0, 00036 PinName echo1, 00037 PinName echo2, 00038 PinName echo3, 00039 PinName echo4, 00040 PinName echo5, 00041 PinName SDI, 00042 PinName SDO, 00043 PinName SCK, 00044 PinName NCS, 00045 PinName NIRQ); 00046 00047 /** A non-blocking function that will return the last measurement 00048 * 00049 * @returns floating point representation of distance in cm 00050 */ 00051 float read0(); 00052 float read1(); 00053 float read2(); 00054 00055 /** A assigns a callback function when a new reading is available **/ 00056 //void (*callbackfunc)(int beaconnum, float distance); 00057 //DummyCT* callbackobj; 00058 //void (DummyCT::*mcallbackfunc)(int beaconnum, float distance); 00059 00060 //triggers a read 00061 void startRange(); 00062 00063 /** A short hand way of using the read function */ 00064 operator float(); 00065 00066 private : 00067 RF12B _rf; 00068 DigitalOut _trigger; 00069 InterruptIn _echo0; 00070 InterruptIn _echo1; 00071 InterruptIn _echo2; 00072 InterruptIn _echo3; 00073 InterruptIn _echo4; 00074 InterruptIn _echo5; 00075 Timer _timer; 00076 Ticker _ticker; 00077 void _rising (void); 00078 void _falling (void); 00079 float _dist[3]; 00080 char _code[3]; 00081 int _beacon_counter; 00082 bool ValidPulse; 00083 00084 }; 00085 00086 #endif
Generated on Fri Jul 29 2022 06:49:56 by 1.7.2