-

Committer:
Deurklink
Date:
Fri Jul 04 09:48:47 2014 +0000
Revision:
0:9719776f6e46
-

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Deurklink 0:9719776f6e46 1 #include "Camera.h"
Deurklink 0:9719776f6e46 2
Deurklink 0:9719776f6e46 3 Camera::Camera(PinName gpsTx, PinName gpsRx, PinName xbTx, PinName xbRx, int freq, int len, int cdelay) :
Deurklink 0:9719776f6e46 4 gps(gpsTx, gpsRx),
Deurklink 0:9719776f6e46 5 L1(LED1),
Deurklink 0:9719776f6e46 6 L2(LED2),
Deurklink 0:9719776f6e46 7 L3(LED3),
Deurklink 0:9719776f6e46 8 L4(LED4),
Deurklink 0:9719776f6e46 9 XBee(xbTx, xbRx),
Deurklink 0:9719776f6e46 10 PPS(p5),
Deurklink 0:9719776f6e46 11 T1(p11),
Deurklink 0:9719776f6e46 12 T2(p12),
Deurklink 0:9719776f6e46 13 T3(p15),
Deurklink 0:9719776f6e46 14 T4(p16),
Deurklink 0:9719776f6e46 15 T5(p17),
Deurklink 0:9719776f6e46 16 T6(p18),
Deurklink 0:9719776f6e46 17 T7(p19),
Deurklink 0:9719776f6e46 18 T8(p20),
Deurklink 0:9719776f6e46 19 B1(p24),
Deurklink 0:9719776f6e46 20 B2(p23),
Deurklink 0:9719776f6e46 21 B3(p22),
Deurklink 0:9719776f6e46 22 B4(p21),
Deurklink 0:9719776f6e46 23 PulseFrequency(freq),
Deurklink 0:9719776f6e46 24 Pulselength(len),
Deurklink 0:9719776f6e46 25 CameraDelay_us(cdelay)
Deurklink 0:9719776f6e46 26 {
Deurklink 0:9719776f6e46 27 PWMon = false;
Deurklink 0:9719776f6e46 28 RxTO = false;
Deurklink 0:9719776f6e46 29 }
Deurklink 0:9719776f6e46 30
Deurklink 0:9719776f6e46 31 // Beacon initialisation
Deurklink 0:9719776f6e46 32 bool Camera::init(){
Deurklink 0:9719776f6e46 33
Deurklink 0:9719776f6e46 34 // Power down ethernet module
Deurklink 0:9719776f6e46 35 PHY_PowerDown();
Deurklink 0:9719776f6e46 36
Deurklink 0:9719776f6e46 37 // Initialize dipswitches
Deurklink 0:9719776f6e46 38 initDipSwitch();
Deurklink 0:9719776f6e46 39
Deurklink 0:9719776f6e46 40 // Read beacon number and timing offset
Deurklink 0:9719776f6e46 41 readDipSwitch();
Deurklink 0:9719776f6e46 42
Deurklink 0:9719776f6e46 43 // Set baud rate
Deurklink 0:9719776f6e46 44 XBee.baud(9600);
Deurklink 0:9719776f6e46 45
Deurklink 0:9719776f6e46 46 XBee.printf("\r\n.. Camera (ID:%d) Initializing ..\n",BeaconNumber);
Deurklink 0:9719776f6e46 47
Deurklink 0:9719776f6e46 48 // Initialize GPS unit
Deurklink 0:9719776f6e46 49 gps.Init();
Deurklink 0:9719776f6e46 50
Deurklink 0:9719776f6e46 51 //Attach interrupt to rising edge of GPS PPS pin
Deurklink 0:9719776f6e46 52 PPS.rise(this, &Camera::ppsSync);
Deurklink 0:9719776f6e46 53
Deurklink 0:9719776f6e46 54 // Initialize PWM
Deurklink 0:9719776f6e46 55 resetPWM(PulseFrequency, Pulselength);
Deurklink 0:9719776f6e46 56
Deurklink 0:9719776f6e46 57 XBee.printf("\r\n.. Camera (ID:%d) Initialization finished ..\n",BeaconNumber);
Deurklink 0:9719776f6e46 58
Deurklink 0:9719776f6e46 59 L1 = 1;
Deurklink 0:9719776f6e46 60
Deurklink 0:9719776f6e46 61 return true;
Deurklink 0:9719776f6e46 62 }
Deurklink 0:9719776f6e46 63
Deurklink 0:9719776f6e46 64 void Camera::cameraDelay(){
Deurklink 0:9719776f6e46 65 // Reset PWM timer value so that new cycle immediately starts
Deurklink 0:9719776f6e46 66 LPC_PWM1->TC = Period*24+TimingOffset - 1;
Deurklink 0:9719776f6e46 67 }
Deurklink 0:9719776f6e46 68
Deurklink 0:9719776f6e46 69
Deurklink 0:9719776f6e46 70 // PPS pin interrupt
Deurklink 0:9719776f6e46 71 void Camera::ppsSync(){
Deurklink 0:9719776f6e46 72 // Toggle LED1
Deurklink 0:9719776f6e46 73 L1 = !L1;
Deurklink 0:9719776f6e46 74 if (PWMon == true){
Deurklink 0:9719776f6e46 75 // Call timer reset function for PWM after CameraDelay_us microseconds
Deurklink 0:9719776f6e46 76 _CameraDelay.attach_us(this,&Camera::cameraDelay,CameraDelay_us);
Deurklink 0:9719776f6e46 77 }
Deurklink 0:9719776f6e46 78 }
Deurklink 0:9719776f6e46 79
Deurklink 0:9719776f6e46 80 // XBee Receive Timeout
Deurklink 0:9719776f6e46 81 void Camera::rxTimeOut(){
Deurklink 0:9719776f6e46 82 RxTO = true;
Deurklink 0:9719776f6e46 83 }
Deurklink 0:9719776f6e46 84
Deurklink 0:9719776f6e46 85
Deurklink 0:9719776f6e46 86 //------------------------------------DIP-SWITCHES---------------------------
Deurklink 0:9719776f6e46 87 void Camera::readDipSwitch(){
Deurklink 0:9719776f6e46 88 // Transform the dip switch binary numbers into integers
Deurklink 0:9719776f6e46 89 // For the timing offset, the leftmost bit is the sign bit (2's complement)
Deurklink 0:9719776f6e46 90 TimingOffset = -128*T1 + 64*T2 + 32*T3 + 16*T4 + 8*T5 + 4*T6 + 2*T7 + T8;
Deurklink 0:9719776f6e46 91 BeaconNumber = 8*B1 + 4*B2 + 2*B3 + B4;
Deurklink 0:9719776f6e46 92 }
Deurklink 0:9719776f6e46 93
Deurklink 0:9719776f6e46 94 void Camera::initDipSwitch(){
Deurklink 0:9719776f6e46 95 // Set pull-down resistor for dip switch inputs
Deurklink 0:9719776f6e46 96 T1.mode(PullDown);
Deurklink 0:9719776f6e46 97 T2.mode(PullDown);
Deurklink 0:9719776f6e46 98 T3.mode(PullDown);
Deurklink 0:9719776f6e46 99 T4.mode(PullDown);
Deurklink 0:9719776f6e46 100 T5.mode(PullDown);
Deurklink 0:9719776f6e46 101 T6.mode(PullDown);
Deurklink 0:9719776f6e46 102 T7.mode(PullDown);
Deurklink 0:9719776f6e46 103 T8.mode(PullDown);
Deurklink 0:9719776f6e46 104
Deurklink 0:9719776f6e46 105 B1.mode(PullDown);
Deurklink 0:9719776f6e46 106 B2.mode(PullDown);
Deurklink 0:9719776f6e46 107 B3.mode(PullDown);
Deurklink 0:9719776f6e46 108 B4.mode(PullDown);
Deurklink 0:9719776f6e46 109 }
Deurklink 0:9719776f6e46 110 //---------------------------------------------------------------------------
Deurklink 0:9719776f6e46 111
Deurklink 0:9719776f6e46 112
Deurklink 0:9719776f6e46 113 //------------------------------------PWM------------------------------------
Deurklink 0:9719776f6e46 114 void Camera::startPWM(){
Deurklink 0:9719776f6e46 115 // enable PWM mode and counting
Deurklink 0:9719776f6e46 116 LPC_PWM1->TCR = (1 << 3) | 1;
Deurklink 0:9719776f6e46 117 PWMon = true;
Deurklink 0:9719776f6e46 118 }
Deurklink 0:9719776f6e46 119
Deurklink 0:9719776f6e46 120 void Camera::stopPWM(){
Deurklink 0:9719776f6e46 121 // Reset PWM-counter; this also stops it
Deurklink 0:9719776f6e46 122 LPC_PWM1->TCR = 2;
Deurklink 0:9719776f6e46 123 PWMon = false;
Deurklink 0:9719776f6e46 124 }
Deurklink 0:9719776f6e46 125
Deurklink 0:9719776f6e46 126 void Camera::resetPWM(int _PulseFrequency, int _Pulselength){
Deurklink 0:9719776f6e46 127 // Note: wherever you read pin P2.0, it is pin 2[0] of the microcontroller.
Deurklink 0:9719776f6e46 128 // This is wired to p26 of the mbed board.
Deurklink 0:9719776f6e46 129 stopPWM();
Deurklink 0:9719776f6e46 130 // First stop PWM if it is running
Deurklink 0:9719776f6e46 131
Deurklink 0:9719776f6e46 132 PWMclock = SystemCoreClock / 96;
Deurklink 0:9719776f6e46 133 Period = PWMclock / _PulseFrequency;
Deurklink 0:9719776f6e46 134
Deurklink 0:9719776f6e46 135
Deurklink 0:9719776f6e46 136 LPC_SC->PCONP |= 1 << 6;
Deurklink 0:9719776f6e46 137 // Reset mode PWM timer
Deurklink 0:9719776f6e46 138 LPC_PWM1->TCR = 2;
Deurklink 0:9719776f6e46 139
Deurklink 0:9719776f6e46 140 // configure P2.0 for PWM1.1 - O - Pulse Width Modulator 1, channel 1 output.
Deurklink 0:9719776f6e46 141 LPC_PINCON->PINSEL4 = (LPC_PINCON->PINSEL4 & ~(0x3 << 0)) | (0x1 << 0);
Deurklink 0:9719776f6e46 142
Deurklink 0:9719776f6e46 143 // Disable pullups for P2.0
Deurklink 0:9719776f6e46 144 LPC_PINCON->PINMODE4 = (LPC_PINCON->PINMODE4 & ~0x3) | 0x2;
Deurklink 0:9719776f6e46 145
Deurklink 0:9719776f6e46 146 // Set prescaler
Deurklink 0:9719776f6e46 147 //LPC_PWM1->PR = SystemCoreClock / (4 * 1000000) - 1;
Deurklink 0:9719776f6e46 148
Deurklink 0:9719776f6e46 149 // Set up match registers
Deurklink 0:9719776f6e46 150 LPC_PWM1->MR0 = Period*24+TimingOffset; // Set MR0 (Period)
Deurklink 0:9719776f6e46 151 /*
Deurklink 0:9719776f6e46 152 TimingOffset is there to compensate for crystal errors.
Deurklink 0:9719776f6e46 153 It has to be calculated for every mbed, as every crystal is a little different
Deurklink 0:9719776f6e46 154 It basically adds or detracts a few cycles from every period to keep the period equal for every module
Deurklink 0:9719776f6e46 155 */
Deurklink 0:9719776f6e46 156 LPC_PWM1->MR1 = _Pulselength*24; // Set MR1 (Pulse length)
Deurklink 0:9719776f6e46 157 LPC_PWM1->LER = 0x07; // set latch-enable register
Deurklink 0:9719776f6e46 158 LPC_PWM1->MCR |= 0x02; // Reset PWM1 on match
Deurklink 0:9719776f6e46 159 LPC_PWM1->PCR = 1 << 9; // enable PWM1 with single-edge operation
Deurklink 0:9719776f6e46 160 }
Deurklink 0:9719776f6e46 161 //------------------------------------/PWM------------------------------------
Deurklink 0:9719776f6e46 162
Deurklink 0:9719776f6e46 163
Deurklink 0:9719776f6e46 164
Deurklink 0:9719776f6e46 165 //------------------------------------XBee------------------------------------
Deurklink 0:9719776f6e46 166 bool Camera::xbeeReadable(){
Deurklink 0:9719776f6e46 167 return XBee.readable();
Deurklink 0:9719776f6e46 168 }
Deurklink 0:9719776f6e46 169
Deurklink 0:9719776f6e46 170 void Camera::printStatus(){
Deurklink 0:9719776f6e46 171 // Print the status of a Beacon
Deurklink 0:9719776f6e46 172 XBee.printf("\r\n\nCamera (ID:%d); TimingOffset: %d",BeaconNumber, TimingOffset);
Deurklink 0:9719776f6e46 173 XBee.printf("\r\nLast GPS update: %d:%d:%2.2f",gps.hours, gps.minutes, gps.seconds);
Deurklink 0:9719776f6e46 174 XBee.printf("\r\nFlash frequency: %d Hz; Pulse length: %d usec; Delay: %d usec", PulseFrequency, Pulselength, CameraDelay_us);
Deurklink 0:9719776f6e46 175 XBee.printf("\r\nPulse generation: %d (0=off,1=on)",PWMon);
Deurklink 0:9719776f6e46 176 XBee.printf("\r\nGPS location: %f,%f", gps.latitude, gps.longitude);
Deurklink 0:9719776f6e46 177 XBee.printf("\r\nFixtype: %d (0=no fix,1=gps,2=differential)",gps.fixtype);
Deurklink 0:9719776f6e46 178 XBee.printf("\r\nNo. of satellites: %d",gps.satellites);
Deurklink 0:9719776f6e46 179 }
Deurklink 0:9719776f6e46 180
Deurklink 0:9719776f6e46 181 void Camera::getXbeeData(){
Deurklink 0:9719776f6e46 182 // Function used by parse data function
Deurklink 0:9719776f6e46 183 // Read data from the Xbee serial Buffer
Deurklink 0:9719776f6e46 184 // Wait until $ is read, then put characters received after that in RxBuffer[] until # is read.
Deurklink 0:9719776f6e46 185
Deurklink 0:9719776f6e46 186 RxTO = false; // Reset time-out
Deurklink 0:9719776f6e46 187 bool dollarSignRcv = false;
Deurklink 0:9719776f6e46 188 bool dashRcv = false;
Deurklink 0:9719776f6e46 189
Deurklink 0:9719776f6e46 190 _RxTimeOut.attach(this,&Camera::rxTimeOut,XBEETIMEOUT); // timeout after XBEETIMEOUT seconds
Deurklink 0:9719776f6e46 191
Deurklink 0:9719776f6e46 192 while(!dollarSignRcv){
Deurklink 0:9719776f6e46 193 // Read XBee until dollarsign received or timeout
Deurklink 0:9719776f6e46 194 if (XBee.readable()){
Deurklink 0:9719776f6e46 195 if (XBee.getc() == '$'){
Deurklink 0:9719776f6e46 196 dollarSignRcv = true;
Deurklink 0:9719776f6e46 197 //XBee.printf("$ received");
Deurklink 0:9719776f6e46 198 }
Deurklink 0:9719776f6e46 199 }
Deurklink 0:9719776f6e46 200 // Timeout if no $ is received within XBEETIMEOUT seconds
Deurklink 0:9719776f6e46 201 if (RxTO == true){
Deurklink 0:9719776f6e46 202 wait(BeaconNumber);
Deurklink 0:9719776f6e46 203 XBee.printf("\r\nCamera (ID:%d) rx time out",BeaconNumber);
Deurklink 0:9719776f6e46 204 return;
Deurklink 0:9719776f6e46 205 }
Deurklink 0:9719776f6e46 206 }
Deurklink 0:9719776f6e46 207
Deurklink 0:9719776f6e46 208 int i = 0;
Deurklink 0:9719776f6e46 209 while(!dashRcv){
Deurklink 0:9719776f6e46 210 // Fill buffer until dash is received, buffer is full or timeout
Deurklink 0:9719776f6e46 211 if (XBee.readable()){
Deurklink 0:9719776f6e46 212 RxBuffer[i] = XBee.getc();
Deurklink 0:9719776f6e46 213 if(RxBuffer[i] == '#') {
Deurklink 0:9719776f6e46 214 RxBuffer[i] = 0;
Deurklink 0:9719776f6e46 215 dashRcv = true;
Deurklink 0:9719776f6e46 216 //XBee.printf("# received");
Deurklink 0:9719776f6e46 217 }
Deurklink 0:9719776f6e46 218 i++;
Deurklink 0:9719776f6e46 219 }
Deurklink 0:9719776f6e46 220 // Return if buffer is full
Deurklink 0:9719776f6e46 221 if (i > 255){
Deurklink 0:9719776f6e46 222 wait(BeaconNumber);
Deurklink 0:9719776f6e46 223 XBee.printf("\r\nCamera (ID:%d) rx buffer overflow",BeaconNumber);
Deurklink 0:9719776f6e46 224 return;
Deurklink 0:9719776f6e46 225 }
Deurklink 0:9719776f6e46 226 // Timeout if no '#' is received within XBEETIMEOUT seconds
Deurklink 0:9719776f6e46 227 if (RxTO == true){
Deurklink 0:9719776f6e46 228 wait(BeaconNumber);
Deurklink 0:9719776f6e46 229 XBee.printf("\r\nCamera (ID:%d) rx time out",BeaconNumber);
Deurklink 0:9719776f6e46 230 XBee.printf("\r\nReceived: %s",RxBuffer);
Deurklink 0:9719776f6e46 231 return;
Deurklink 0:9719776f6e46 232 }
Deurklink 0:9719776f6e46 233 }
Deurklink 0:9719776f6e46 234 }
Deurklink 0:9719776f6e46 235
Deurklink 0:9719776f6e46 236 void Camera::parseXbee(){
Deurklink 0:9719776f6e46 237 // This function collects data from RxBuffer[] and reads it
Deurklink 0:9719776f6e46 238
Deurklink 0:9719776f6e46 239 // put data into RxBuffer[]
Deurklink 0:9719776f6e46 240 getXbeeData();
Deurklink 0:9719776f6e46 241
Deurklink 0:9719776f6e46 242 // $STATUS#
Deurklink 0:9719776f6e46 243 // Send a status message
Deurklink 0:9719776f6e46 244 if (strncmp(RxBuffer, "STATUS",6) == 0){
Deurklink 0:9719776f6e46 245 wait(BeaconNumber);
Deurklink 0:9719776f6e46 246 printStatus();
Deurklink 0:9719776f6e46 247 }
Deurklink 0:9719776f6e46 248
Deurklink 0:9719776f6e46 249 // $STARTPULSE#
Deurklink 0:9719776f6e46 250 // Start pulse generation if there is a GPS fix
Deurklink 0:9719776f6e46 251 else if (strncmp(RxBuffer, "STARTPULSE",10) == 0){
Deurklink 0:9719776f6e46 252 if (gps.fixtype > 0){
Deurklink 0:9719776f6e46 253 startPWM();
Deurklink 0:9719776f6e46 254 wait(BeaconNumber);
Deurklink 0:9719776f6e46 255 XBee.printf("\r\nCamera (ID:%d) pulses started",BeaconNumber);
Deurklink 0:9719776f6e46 256 }
Deurklink 0:9719776f6e46 257 else{
Deurklink 0:9719776f6e46 258 wait(BeaconNumber);
Deurklink 0:9719776f6e46 259 XBee.printf("\r\nCamera (ID:%d) has no GPS fix",BeaconNumber);
Deurklink 0:9719776f6e46 260 }
Deurklink 0:9719776f6e46 261 }
Deurklink 0:9719776f6e46 262
Deurklink 0:9719776f6e46 263 // $FORCEPULSE#
Deurklink 0:9719776f6e46 264 // Start pulse generation regardless of GPS fix
Deurklink 0:9719776f6e46 265 else if (strncmp(RxBuffer, "FORCEPULSE",10) == 0){
Deurklink 0:9719776f6e46 266 startPWM();
Deurklink 0:9719776f6e46 267 if (gps.fixtype > 0){
Deurklink 0:9719776f6e46 268 wait(BeaconNumber);
Deurklink 0:9719776f6e46 269 XBee.printf("\r\nCamera (ID:%d) pulses started",BeaconNumber);
Deurklink 0:9719776f6e46 270 }
Deurklink 0:9719776f6e46 271 else{
Deurklink 0:9719776f6e46 272 wait(BeaconNumber);
Deurklink 0:9719776f6e46 273 XBee.printf("\r\nCamera (ID:%d) has no GPS fix; pulses started anyway",BeaconNumber);
Deurklink 0:9719776f6e46 274 }
Deurklink 0:9719776f6e46 275 }
Deurklink 0:9719776f6e46 276
Deurklink 0:9719776f6e46 277 // $STOPPULSE#
Deurklink 0:9719776f6e46 278 // Stop pulse generation
Deurklink 0:9719776f6e46 279 else if (strncmp(RxBuffer, "STOPPULSE",9) == 0){
Deurklink 0:9719776f6e46 280 if (PWMon == true){
Deurklink 0:9719776f6e46 281 stopPWM();
Deurklink 0:9719776f6e46 282 wait(BeaconNumber);
Deurklink 0:9719776f6e46 283 XBee.printf("\r\nCamera (ID:%d) pulses stopped",BeaconNumber);
Deurklink 0:9719776f6e46 284 }
Deurklink 0:9719776f6e46 285 else{
Deurklink 0:9719776f6e46 286 wait(BeaconNumber);
Deurklink 0:9719776f6e46 287 XBee.printf("\r\nCamera (ID:%d) has not been started yet. No action",BeaconNumber);
Deurklink 0:9719776f6e46 288 }
Deurklink 0:9719776f6e46 289 }
Deurklink 0:9719776f6e46 290
Deurklink 0:9719776f6e46 291 // $CHANGEPULSE,freq(hz),pulselength(us)#
Deurklink 0:9719776f6e46 292 // Change frequency and pulse length; Ignored by camera
Deurklink 0:9719776f6e46 293 else if (strncmp(RxBuffer, "CHANGEPULSE",11) == 0){
Deurklink 0:9719776f6e46 294 wait(BeaconNumber);
Deurklink 0:9719776f6e46 295 XBee.printf("\n\rCamera (ID:%d) ignored message",BeaconNumber);
Deurklink 0:9719776f6e46 296 }
Deurklink 0:9719776f6e46 297
Deurklink 0:9719776f6e46 298 // $CAMCHANGEPULSE,freq(hz),pulselength(us),delay(us)#
Deurklink 0:9719776f6e46 299 // Change frequency and pulse length of camera
Deurklink 0:9719776f6e46 300 else if (strncmp(RxBuffer, "CAMCHANGEPULSE",14) == 0){
Deurklink 0:9719776f6e46 301 if(sscanf(RxBuffer, "%*s %d %d %d", &PulseFrequency, &Pulselength, &CameraDelay_us) ==3){
Deurklink 0:9719776f6e46 302 resetPWM(PulseFrequency, Pulselength);
Deurklink 0:9719776f6e46 303 wait(BeaconNumber);
Deurklink 0:9719776f6e46 304 XBee.printf("\r\nCamera (ID:%d) frequency set to: %d Hz. Pulselength set to %d us. Delay set to %d us",BeaconNumber,PulseFrequency,Pulselength,CameraDelay_us);
Deurklink 0:9719776f6e46 305 XBee.printf("\r\nWaiting for start pulse command");
Deurklink 0:9719776f6e46 306 }
Deurklink 0:9719776f6e46 307 else{
Deurklink 0:9719776f6e46 308 wait(BeaconNumber);
Deurklink 0:9719776f6e46 309 XBee.printf("\r\nCamera (ID:%d) pulselength, frequency or delay not received correctly, please try again (CAMCHAMGEPULSE,freq,pulselength,delay)",BeaconNumber);
Deurklink 0:9719776f6e46 310 }
Deurklink 0:9719776f6e46 311 }
Deurklink 0:9719776f6e46 312
Deurklink 0:9719776f6e46 313 // $RESETPULSE#
Deurklink 0:9719776f6e46 314 // Read the dip switches, stop and reset PWM with new timing offset
Deurklink 0:9719776f6e46 315 else if (strncmp(RxBuffer, "RESETPULSE",10) == 0){
Deurklink 0:9719776f6e46 316 readDipSwitch();
Deurklink 0:9719776f6e46 317 resetPWM(PulseFrequency, Pulselength);
Deurklink 0:9719776f6e46 318 wait(BeaconNumber);
Deurklink 0:9719776f6e46 319 XBee.printf("\r\nCamera (ID:%d) PWM reset",BeaconNumber);
Deurklink 0:9719776f6e46 320 }
Deurklink 0:9719776f6e46 321
Deurklink 0:9719776f6e46 322 // Received message was not one of the above commands
Deurklink 0:9719776f6e46 323 else{
Deurklink 0:9719776f6e46 324 wait(BeaconNumber);
Deurklink 0:9719776f6e46 325 XBee.printf("\r\nCamera (ID:%d) did not understand message",BeaconNumber);
Deurklink 0:9719776f6e46 326 XBee.printf("\r\nReceived: %s",RxBuffer);
Deurklink 0:9719776f6e46 327 }
Deurklink 0:9719776f6e46 328 // Flush buffer
Deurklink 0:9719776f6e46 329 for (int i=0;i<255;i++){
Deurklink 0:9719776f6e46 330 RxBuffer[i] = '0';
Deurklink 0:9719776f6e46 331 }
Deurklink 0:9719776f6e46 332 }
Deurklink 0:9719776f6e46 333 //-----------------------------------/XBee------------------------------------
Deurklink 0:9719776f6e46 334
Deurklink 0:9719776f6e46 335 //------------------------------------GPS-------------------------------------
Deurklink 0:9719776f6e46 336 bool Camera::gpsReadable(){
Deurklink 0:9719776f6e46 337 return gps.readable();
Deurklink 0:9719776f6e46 338 }
Deurklink 0:9719776f6e46 339
Deurklink 0:9719776f6e46 340 void Camera::parseGpsData(){
Deurklink 0:9719776f6e46 341 gps.parseData();
Deurklink 0:9719776f6e46 342 }
Deurklink 0:9719776f6e46 343 //-----------------------------------/GPS-------------------------------------