whitespace changes

This commit is contained in:
Michael Moon 2010-11-08 18:27:50 +11:00
parent a064ea8e37
commit 952ad4e2f3
1 changed files with 36 additions and 31 deletions

View File

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