#ifndef ADCEXT_H
#define ADCEXT_H

/* Initialize ADC */
void adcext_init(void);

/* Start a conversion if it hasn't already been started.
   Wait for conversion to finish.
   Read the result and return the raw 32-bit value. */
uint32_t adcext_read(void);

/* Convert a raw 32-bit value into a signed result.
   The return value range is -(2^31) to (2^31)-1 */
int32_t adcext_convert(uint32_t raw);

/* Start a new conversion.  If a conversion was already started
   but the result was not read, this does nothing. */
void adcext_start_conversion(void);

/* Return 1 if a conversion is in progress, 0 otherwise */
int adcext_is_conversion_ready(void);

#endif
