X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstmf0%2Fao_adc_fast.c;h=51860ced435d91c083819e356f15e1e6b74741d1;hb=6f7d530b9ca06272354d1b7c05813a2523b24887;hp=0a2e2c5c7b13f952ec5e20ede18132381862d2be;hpb=9f9d77b6d025d8285e362e53a8f728ec47adb234;p=fw%2Faltos diff --git a/src/stmf0/ao_adc_fast.c b/src/stmf0/ao_adc_fast.c index 0a2e2c5c..51860ced 100644 --- a/src/stmf0/ao_adc_fast.c +++ b/src/stmf0/ao_adc_fast.c @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -88,7 +89,7 @@ ao_adc_init(void) /* Reset ADC */ stm_rcc.apb2rstr |= (1 << STM_RCC_APB2RSTR_ADCRST); - stm_rcc.apb2rstr &= ~(1 << STM_RCC_APB2RSTR_ADCRST); + stm_rcc.apb2rstr &= ~(1UL << STM_RCC_APB2RSTR_ADCRST); /* Turn on ADC pins */ stm_rcc.ahbenr |= AO_ADC_RCC_AHBENR; @@ -159,11 +160,11 @@ ao_adc_init(void) stm_adc.smpr = STM_ADC_SMPR_SMP_1_5 << STM_ADC_SMPR_SMP; /* Turn off enable and start */ - stm_adc.cr &= ~((1 << STM_ADC_CR_ADEN) | (1 << STM_ADC_CR_ADSTART)); + stm_adc.cr &= ~((1UL << STM_ADC_CR_ADEN) | (1 << STM_ADC_CR_ADSTART)); /* Calibrate */ - 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 */ @@ -196,7 +197,7 @@ ao_adc_init(void) stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SYSCFGCOMPEN); /* Set ADC to use DMA channel 1 (option 1) */ - stm_syscfg.cfgr1 &= ~(1 << STM_SYSCFG_CFGR1_ADC_DMA_RMP); + stm_syscfg.cfgr1 &= ~(1UL << STM_SYSCFG_CFGR1_ADC_DMA_RMP); ao_dma_alloc(STM_DMA_INDEX(STM_DMA_CHANNEL_ADC_1)); }