46 SOUNDER_DDR |= SOUNDER_MASK;
47 SOUNDER_PORT &= ~SOUNDER_MASK;
48 SOUNDER_PORT |= SOUNDER_MASK;
54 SOUNDER_PORT &= ~(SOUNDER_MASK);
55 SOUNDER_DDR &= ~(SOUNDER_MASK);
65 ADCSRA &= ~( _BV(ADIE) | _BV(ADIF) );
67 ADCSRA |= _BV(ADPS2) | _BV(ADPS1) | _BV(ADIE);
79 ADMUX |= (channel & 0x1F);
86 ADCSRA |= _BV(ADEN) | _BV(ADSC);
88 while ( ADCSRA & _BV(ADSC) );
92 reading |= (ADCH & 3) << 8;
104 LIGHT_PORT |= LIGHT_PIN_MASK;
105 LIGHT_PORT_DDR |= LIGHT_PIN_MASK;
107 TEMP_PORT_DDR &= ~TEMP_PIN_MASK;
108 TEMP_PORT &= ~TEMP_PIN_MASK;
110 reading = get_adc(LIGHT_ADC_CHANNEL);
112 LIGHT_PORT &= ~LIGHT_PIN_MASK;
113 LIGHT_PORT_DDR &= ~LIGHT_PIN_MASK;
123 LIGHT_PORT &= ~LIGHT_PIN_MASK;
124 LIGHT_PORT_DDR &= ~LIGHT_PIN_MASK;
126 TEMP_PORT_DDR |= TEMP_PIN_MASK;
127 TEMP_PORT |= TEMP_PIN_MASK;
129 reading = get_adc(TEMP_ADC_CHANNEL);
131 TEMP_PORT_DDR &= ~TEMP_PIN_MASK;
132 TEMP_PORT &= ~TEMP_PIN_MASK;
143 ACCEL_PORT_DDR |= ACCEL_PIN_MASK;
144 ACCEL_PORT |= ACCEL_PIN_MASK;
146 reading = get_adc(ACCELX_ADC_CHANNEL);
148 ACCEL_PORT_DDR &= ~ACCEL_PIN_MASK;
149 ACCEL_PORT &= ~ACCEL_PIN_MASK;
160 ACCEL_PORT_DDR |= ACCEL_PIN_MASK;
161 ACCEL_PORT |= ACCEL_PIN_MASK;
163 reading = get_adc(ACCELY_ADC_CHANNEL);
165 ACCEL_PORT_DDR &= ~ACCEL_PIN_MASK;
166 ACCEL_PORT &= ~ACCEL_PIN_MASK;
177 MAGNET_PORT_DDR |= MAGNET_PIN_MASK;
178 MAGNET_PORT |= MAGNET_PIN_MASK;
180 reading = get_adc(MAGNETX_ADC_CHANNEL);
182 MAGNET_PORT_DDR &= ~MAGNET_PIN_MASK;
183 MAGNET_PORT &= ~MAGNET_PIN_MASK;
194 MAGNET_PORT_DDR |= MAGNET_PIN_MASK;
195 MAGNET_PORT |= MAGNET_PIN_MASK;
197 reading = get_adc(MAGNETY_ADC_CHANNEL);
199 MAGNET_PORT_DDR &= ~MAGNET_PIN_MASK;
200 MAGNET_PORT &= ~MAGNET_PIN_MASK;
211 MIC_PORT_DDR |= MIC_PIN_MASK;
212 MIC_PORT |= MIC_PIN_MASK;
214 reading = get_adc(MIC_ADC_CHANNEL);
216 MIC_PORT_DDR &= ~MIC_PIN_MASK;
217 MIC_PORT &= ~MIC_PIN_MASK;