42 void adc_init(uint8_t mode, uint8_t ref){
43 ADCSRA = ((ADC_ENABLE) | (ADC_PRESCALE_64));
48 ADCSRB |= (0x07 & mode);
49 ADCSRA |= ((ADC_TRIGGER_ENABLE) | (ADC_INTERRUPT_ENABLE));
54 static uint8_t used_adcs = 0;
57 used_adcs |= (1 << mux);
66 if(ADCSRA & ADC_TRIGGER_ENABLE){
71 while (ADCSRA & (1 << ADSC)) {