Merge branch 'hid_joystick' of git://github.com/a-chol/qmk_firmware into a-chol-hid_joystick

This commit is contained in:
Jack Humbert 2020-05-04 13:19:48 -04:00
commit 708bb4f55d
23 changed files with 1556 additions and 5 deletions

View file

@ -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;
}