mirror of https://github.com/ArduPilot/ardupilot
uncrustify libraries/AP_AnalogSource/AP_AnalogSource_Arduino.cpp
This commit is contained in:
parent
e9b5e28b40
commit
3c1a4b249a
|
@ -16,8 +16,8 @@ static uint8_t num_pins_watched;
|
|||
static uint8_t next_pin_index;
|
||||
static uint8_t next_pin_count;
|
||||
static volatile struct {
|
||||
uint8_t pin;
|
||||
uint8_t sum_count;
|
||||
uint8_t pin;
|
||||
uint8_t sum_count;
|
||||
uint16_t output;
|
||||
uint16_t sum;
|
||||
} pins[MAX_PIN_SOURCES];
|
||||
|
@ -27,7 +27,7 @@ static volatile struct {
|
|||
// each conversion takes about 125 microseconds
|
||||
static void adc_timer(uint32_t t)
|
||||
{
|
||||
if (bit_is_set(ADCSRA, ADSC) || num_pins_watched == 0) {
|
||||
if (bit_is_set(ADCSRA, ADSC) || num_pins_watched == 0) {
|
||||
// conversion is still running. This should be
|
||||
// very rare, as we are called at 1kHz
|
||||
return;
|
||||
|
@ -69,7 +69,7 @@ static void adc_timer(uint32_t t)
|
|||
ADMUX = _BV(REFS0) | (pin & 0x07);
|
||||
}
|
||||
|
||||
// start the next conversion
|
||||
// start the next conversion
|
||||
ADCSRA |= _BV(ADSC);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void AP_AnalogSource_Arduino::assign_pin_index(uint8_t pin)
|
|||
num_pins_watched++;
|
||||
if (num_pins_watched == 1) {
|
||||
// enable the ADC
|
||||
PRR0 &= ~_BV(PRADC);
|
||||
ADCSRA |= _BV(ADEN);
|
||||
PRR0 &= ~_BV(PRADC);
|
||||
ADCSRA |= _BV(ADEN);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue