diff --git a/libraries/Desktop/include/wiring.h b/libraries/Desktop/include/wiring.h index 5eb449f5e4..0b8710eef7 100644 --- a/libraries/Desktop/include/wiring.h +++ b/libraries/Desktop/include/wiring.h @@ -95,7 +95,7 @@ extern "C"{ #define bitSet(value, bit) ((value) |= (1UL << (bit))) #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) - +#define bit_is_set(value, bit) (((value) & bit) != 0) typedef unsigned int word; @@ -109,7 +109,6 @@ void init(void); void pinMode(uint8_t, uint8_t); void digitalWrite(uint8_t, uint8_t); int digitalRead(uint8_t); -int analogRead(uint8_t); void analogReference(uint8_t mode); void analogWrite(uint8_t, int); diff --git a/libraries/Desktop/support/Arduino.cpp b/libraries/Desktop/support/Arduino.cpp index 78f123577d..f82cc37e7c 100644 --- a/libraries/Desktop/support/Arduino.cpp +++ b/libraries/Desktop/support/Arduino.cpp @@ -129,11 +129,6 @@ void digitalWrite(uint8_t pin, uint8_t val) { } -int analogRead(uint8_t pin) -{ - return 0; -} - } diff --git a/libraries/Desktop/support/sitl.cpp b/libraries/Desktop/support/sitl.cpp index ea774b83e9..069dbca932 100644 --- a/libraries/Desktop/support/sitl.cpp +++ b/libraries/Desktop/support/sitl.cpp @@ -268,6 +268,11 @@ static void timer_handler(int signum) sitl.state.airspeed); sitl_update_barometer(sitl.state.altitude); sitl_update_compass(sitl.state.rollDeg, sitl.state.pitchDeg, sitl.state.heading); + + // clear the ADC conversion flag, + // so the ADC code doesn't get stuck + ADCSRA &= ~_BV(ADSC); + sei(); running = false; }