X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstm32l0%2Fao_adc_stm32l0.c;fp=src%2Fstm32l0%2Fao_adc_stm32l0.c;h=5c0f4c2bd1021e2e25597148710355f5bf93e61c;hp=a7af0a08308197fc21a6a395eaf59284e9b4a031;hb=2d4484e1577edc66c52bcb260329387f93123a6d;hpb=5b3a457f232e39977a437fc52256fc15c612b377 diff --git a/src/stm32l0/ao_adc_stm32l0.c b/src/stm32l0/ao_adc_stm32l0.c index a7af0a08..5c0f4c2b 100644 --- a/src/stm32l0/ao_adc_stm32l0.c +++ b/src/stm32l0/ao_adc_stm32l0.c @@ -54,8 +54,8 @@ ao_adc_init(void) (0 << STM_ADC_CCR_VREFEN)); /* Calibrate. This also enables the ADC vreg */ - stm_adc.cr |= (1 << STM_ADC_CR_ADCAL); - while ((stm_adc.cr & (1 << STM_ADC_CR_ADCAL)) != 0) + stm_adc.cr |= (1UL << STM_ADC_CR_ADCAL); + while ((stm_adc.cr & (1UL << STM_ADC_CR_ADCAL)) != 0) ; /* Enable */ @@ -77,10 +77,10 @@ ao_adc_shutdown(void) stm_adc.isr = (1 << STM_ADC_ISR_ADRDY); /* Disable ADC vreg */ - stm_adc.cr &= ~(1 << STM_ADC_CR_ADVREGEN); + stm_adc.cr &= ~(1UL << STM_ADC_CR_ADVREGEN); /* Disable ADC clocks */ - stm_rcc.apb2enr &= ~(1 << STM_RCC_APB2ENR_ADCEN); + stm_rcc.apb2enr &= ~(1UL << STM_RCC_APB2ENR_ADCEN); } uint16_t @@ -104,7 +104,7 @@ ao_adc_read_vref(void) ; /* Fetch result */ - value = stm_adc.dr; + value = (uint16_t) stm_adc.dr; ao_adc_shutdown(); return value;