From: asterix Date: Mon, 21 Mar 2011 18:04:26 +0000 (+0000) Subject: Add comments and clean up. X-Git-Tag: 2.7.0~179 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=f81df2ee3de292493462ee9d0a8905eaafb57243;p=bertos.git Add comments and clean up. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4787 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/cortex-m3/drv/adc_sam3.c b/bertos/cpu/cortex-m3/drv/adc_sam3.c index 7dd48bf6..e1e43a97 100644 --- a/bertos/cpu/cortex-m3/drv/adc_sam3.c +++ b/bertos/cpu/cortex-m3/drv/adc_sam3.c @@ -58,11 +58,21 @@ #include +/* 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) { diff --git a/bertos/cpu/cortex-m3/drv/adc_sam3.h b/bertos/cpu/cortex-m3/drv/adc_sam3.h index 1a6ca532..6c31a700 100644 --- a/bertos/cpu/cortex-m3/drv/adc_sam3.h +++ b/bertos/cpu/cortex-m3/drv/adc_sam3.h @@ -56,7 +56,6 @@ */ #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);