Subversion Repositories FlightCtrl

Rev

Rev 2108 | Rev 2132 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2108 Rev 2109
Line 30... Line 30...
30
  uint8_t sreg = SREG;
30
  uint8_t sreg = SREG;
Line 31... Line 31...
31
 
31
 
32
  // disable all interrupts before reconfiguration
32
  // disable all interrupts before reconfiguration
Line 33... Line 33...
33
  cli();
33
  cli();
34
 
34
 
35
  // Configure speaker port as output.
35
  // Configure speaker port as output and also the diags pin D2
Line 36... Line 36...
36
  DDRD |= (1 << DDD5);
36
  DDRD |= ((1 << DDD5) | (1 << DDD2));
Line 37... Line 37...
37
  PORTD &= ~(1 << PORTD5);
37
  PORTD &= ~((1 << PORTD5) | (1 << DDD2));
38
 
38
 
Line 140... Line 140...
140
// -----------------------------------------------------------------------
140
// -----------------------------------------------------------------------
141
void delay_ms_with_adc_measurement(uint16_t w, uint8_t stop) {
141
void delay_ms_with_adc_measurement(uint16_t w, uint8_t stop) {
142
  uint16_t t_stop;
142
  uint16_t t_stop;
143
  t_stop = setDelay(w);
143
  t_stop = setDelay(w);
144
  while (!checkDelay(t_stop)) {
144
  while (!checkDelay(t_stop)) {
-
 
145
    debugOut.analog[30]++;
145
        if (sensorDataReady == ALL_DATA_READY) {
146
        if (sensorDataReady == ALL_DATA_READY) {
146
          analog_update();
147
          analog_update();
147
          startAnalogConversionCycle();
148
          startAnalogConversionCycle();
148
        }
149
        }
149
  }
150
  }
150
  if (stop) {
151
  if (stop) {
151
  // Wait for new samples to get prepared but do not restart AD conversion after that!
152
  // Wait for new samples to get prepared but do not restart AD conversion after that!
152
  // Caller MUST to that.
153
  // Caller MUST to that.
153
        while (!sensorDataReady != ALL_DATA_READY);
154
        // while (!sensorDataReady != ALL_DATA_READY);
154
  }
155
  }
155
}
156
}