diff options
Diffstat (limited to 'drivers/avr')
-rw-r--r-- | drivers/avr/analog.c | 10 | ||||
-rw-r--r-- | drivers/avr/ssd1306.c | 5 | ||||
-rw-r--r-- | drivers/avr/ssd1306.h | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/drivers/avr/analog.c b/drivers/avr/analog.c index 9b8397b933..8d299ffdb9 100644 --- a/drivers/avr/analog.c +++ b/drivers/avr/analog.c @@ -97,10 +97,11 @@ uint8_t pinToMux(pin_t pin) { #endif // clang-format on } + return 0; } int16_t adc_read(uint8_t mux) { - uint8_t low; + uint16_t low; // Enable ADC and configure prescaler ADCSRA = _BV(ADEN) | ADC_PRESCALER; @@ -128,5 +129,10 @@ int16_t adc_read(uint8_t mux) { // Must read LSB first low = ADCL; // Must read MSB only once! - return (ADCH << 8) | low; + low |= (ADCH << 8); + + // turn off the ADC + ADCSRA &= ~(1 << ADEN); + + return low; } diff --git a/drivers/avr/ssd1306.c b/drivers/avr/ssd1306.c index 61d7a99531..1a09a2bcb7 100644 --- a/drivers/avr/ssd1306.c +++ b/drivers/avr/ssd1306.c @@ -5,15 +5,14 @@ # include <string.h> # include "print.h" # include "glcdfont.c" -# ifdef ADAFRUIT_BLE_ENABLE -# include "adafruit_ble.h" -# endif # ifdef PROTOCOL_LUFA # include "lufa.h" # endif # include "sendchar.h" # include "timer.h" +struct CharacterMatrix display; + // Set this to 1 to help diagnose early startup problems // when testing power-on with ble. Turn it off otherwise, // as the latency of printing most of the debug info messes diff --git a/drivers/avr/ssd1306.h b/drivers/avr/ssd1306.h index 9669d1b7e7..9131afcf61 100644 --- a/drivers/avr/ssd1306.h +++ b/drivers/avr/ssd1306.h @@ -66,7 +66,7 @@ struct CharacterMatrix { bool dirty; }; -struct CharacterMatrix display; +extern struct CharacterMatrix display; bool iota_gfx_init(void); void iota_gfx_task(void); |