#ifndef __AVRADC_H__
#define __AVRADC_H__

// take time_cpu and set the adc prescaler to a suitable value
void adc_timeinit(void);

// function to handle on/off of parts external to MCU chip
// return value: time to wait (us) for the external part to finish e.g. power on
//typedef uint16_t (*st_onoff_f)(uint16_t on_mask);

// run the adc state machine and tell us if there is a value available
// 0 = no value available
// 1 = new converted value available in *adc
int8_t adc_run(uint16_t *adc);

// start a new run with new parameters, possible aborting any current one
void adc_start(uint8_t admux);

// stop and power off adc
void adc_stop(void);

#endif
