#include <io/cm3.h>
+/* We use event to signal the end of conversion */
static Event data_ready;
+/* The last converted data */
static uint32_t data;
/**
* ADC ISR.
+ *
+ * The interrupt is connected to ready data, so when the
+ * adc ends the conversion we generate an event and then
+ * we return the converted value.
+ *
+ * \note to clear the Ready data bit and End of conversion
+ * bit we should read the Last Converted Data register, otherwise
+ * the ready data interrupt loop on this call.
*/
static DECLARE_ISR(adc_conversion_end_irq)
{
*/
#define ADC_PRESCALER (DIV_ROUNDUP(CPU_FREQ, 2 * CONFIG_ADC_CLOCK) - 1)
#define ADC_CLOCK (CPU_FREQ / ((ADC_PRESCALER + 1) * 2))
-#define ADC_STARTUPTIME (((CONFIG_ADC_STARTUP_TIME * ADC_COMPUTED_CLOCK) / 8000000UL) - 1)
void adc_hw_select_ch(uint8_t ch);
uint16_t adc_hw_read(void);