* Conversion time is defined as 0.104 milliseconds by ADC_PRESCALE in ADCUtils.h. * Use previous settings */
| 89 | * Use previous settings |
| 90 | */ |
| 91 | uint16_t readADCChannel() { |
| 92 | WordUnionForADCUtils tUValue; |
| 93 | |
| 94 | // ADCSRB = 0; // Only active if ADATE is set to 1. |
| 95 | // ADSC-StartConversion ADIF-Reset Interrupt Flag - NOT free running mode |
| 96 | ADCSRA = (_BV(ADEN) | _BV(ADSC) | _BV(ADIF) | ADC_PRESCALE); |
| 97 | |
| 98 | // wait for single conversion to finish |
| 99 | loop_until_bit_is_clear(ADCSRA, ADSC); |
| 100 | |
| 101 | // Get value |
| 102 | tUValue.UByte.LowByte = ADCL; |
| 103 | tUValue.UByte.HighByte = ADCH; |
| 104 | return tUValue.UWord; |
| 105 | // return ADCL | (ADCH <<8); // needs 4 bytes more |
| 106 | } |
| 107 | |
| 108 | /* |
| 109 | * Use new channel aADCChannelNumber, but do not wait for channel switching |
nothing calls this directly
no outgoing calls
no test coverage detected