whitespace changes
This commit is contained in:
parent
a064ea8e37
commit
952ad4e2f3
7
analog.c
7
analog.c
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#ifndef ANALOG_MASK
|
#ifndef ANALOG_MASK
|
||||||
#warning define ANALOG_MASK as a bitmask of all the analog channels you wish to use
|
#warning define ANALOG_MASK as a bitmask of all the analog channels you wish to use
|
||||||
|
#warning defining ANALOG_MASK as zero will prevent the analog subsystem from starting
|
||||||
#error ANALOG_MASK not defined
|
#error ANALOG_MASK not defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -59,7 +60,7 @@ void analog_init() {
|
||||||
|
|
||||||
// now we start the first conversion and leave the rest to the interrupt
|
// now we start the first conversion and leave the rest to the interrupt
|
||||||
ADCSRA |= MASK(ADIE) | MASK(ADSC);
|
ADCSRA |= MASK(ADIE) | MASK(ADSC);
|
||||||
#endif
|
#endif /* ANALOG_MASK > 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(ADC_vect, ISR_NOBLOCK) {
|
ISR(ADC_vect, ISR_NOBLOCK) {
|
||||||
|
|
@ -81,6 +82,7 @@ ISR(ADC_vect, ISR_NOBLOCK) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t analog_read(uint8_t channel) {
|
uint16_t analog_read(uint8_t channel) {
|
||||||
|
#if ANALOG_MASK > 0
|
||||||
uint16_t r;
|
uint16_t r;
|
||||||
|
|
||||||
uint8_t sreg;
|
uint8_t sreg;
|
||||||
|
|
@ -96,4 +98,7 @@ uint16_t analog_read(uint8_t channel) {
|
||||||
SREG = sreg;
|
SREG = sreg;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue