From 27fdd5acbb4371d9ba5c273e2d79004f6834b9f5 Mon Sep 17 00:00:00 2001 From: asterix Date: Tue, 11 Oct 2011 17:16:54 +0000 Subject: [PATCH] Minor fixes. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@5157 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/cortex-m3/drv/adc_sam3.c | 11 +++++------ boards/sam3x-ek/hw/hw_adc.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bertos/cpu/cortex-m3/drv/adc_sam3.c b/bertos/cpu/cortex-m3/drv/adc_sam3.c index 303689f1..f9fdc132 100644 --- a/bertos/cpu/cortex-m3/drv/adc_sam3.c +++ b/bertos/cpu/cortex-m3/drv/adc_sam3.c @@ -59,7 +59,7 @@ /* We use event to signal the end of conversion */ -static Event data_ready; +static Event adc_data_ready; /* The last converted data */ static uint32_t data; @@ -76,11 +76,10 @@ static uint32_t data; */ static DECLARE_ISR(adc_conversion_end_irq) { - data = 0; if (ADC_ISR & BV(ADC_DRDY)) { data = ADC_LDATA; - event_do(&data_ready); + event_do(&adc_data_ready); } } @@ -101,7 +100,7 @@ void adc_hw_select_ch(uint8_t ch) uint16_t adc_hw_read(void) { ADC_CR = BV(ADC_START); - event_wait(&data_ready); + event_wait(&adc_data_ready); return(data); } @@ -114,13 +113,13 @@ void adc_hw_init(void) IRQ_ASSERT_ENABLED(); /* Initialize the dataready event */ - event_initGeneric(&data_ready); + event_initGeneric(&adc_data_ready); /* Clock ADC peripheral */ pmc_periphEnable(ADC_ID); /* Reset adc controller */ - ADC_CR = ADC_SWRST; + ADC_CR |= BV(ADC_SWRST); /* * Set adc mode register: diff --git a/boards/sam3x-ek/hw/hw_adc.h b/boards/sam3x-ek/hw/hw_adc.h index 4f0bc243..1b9cc38d 100644 --- a/boards/sam3x-ek/hw/hw_adc.h +++ b/boards/sam3x-ek/hw/hw_adc.h @@ -47,7 +47,7 @@ INLINE void hw_enableTempRead(void) { - ADC_ACR = BV(ADC_TSON); + ADC_ACR |= BV(ADC_TSON); } -- 2.25.1