diff --git a/adxl335/analog.c b/adxl335/analog.c index e6efd12..072dd98 100644 --- a/adxl335/analog.c +++ b/adxl335/analog.c @@ -16,46 +16,46 @@ #include "analog.h" uint16_t analog_read(uint8_t pin) { - - /* Enable ADC and set prescaler. */ - ADCSRA = _BV(ADEN) | ADC_PRESCALER; - - /* Set high speed mode. */ + + /* Enable ADC and set prescaler. */ + ADCSRA = _BV(ADEN) | ADC_PRESCALER; + + /* Set high speed mode. */ ADCSRB |= _BV(ADHSM); - - /* Set adc reference and select mux. */ - ADMUX = ADC_REF | (pin & 0b00011111); - - /* Start conversion. */ + + /* Set adc reference and select mux. */ + ADMUX = ADC_REF | (pin & 0b00011111); + + /* Start conversion. */ ADCSRA |= _BV(ADSC); /* Wait until adc has result ready. */ loop_until_bit_is_clear(ADCSRA, ADSC); - /* Word! */ - return ADCW; + /* Word! */ + return ADCW; } uint8_t analog_read_byte(uint8_t pin) { - - /* Enable ADC and set prescaler. */ - ADCSRA = _BV(ADEN) | ADC_PRESCALER; - - /* Set high speed mode. */ + + /* Enable ADC and set prescaler. */ + ADCSRA = _BV(ADEN) | ADC_PRESCALER; + + /* Set high speed mode. */ ADCSRB |= _BV(ADHSM); - - /* Set adc reference and select mux. */ - ADMUX = ADC_REF | (pin & 0b00011111); - - /* Left adjust the 10 bit result. */ + + /* Set adc reference and select mux. */ + ADMUX = ADC_REF | (pin & 0b00011111); + + /* Left adjust the 10 bit result. */ ADMUX |= (1<