mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/stm32: added ADC for g0
This commit is contained in:
parent
c1e4a28c9b
commit
6414c64f89
@ -15,6 +15,8 @@ endif
|
||||
ifneq (,$(filter periph_adc,$(USEMODULE)))
|
||||
ifneq (,$(filter $(CPU_FAM),f4 f7))
|
||||
SRC += adc_f4_f7.c
|
||||
else ifneq (,$(filter $(CPU_FAM),f0 g0))
|
||||
SRC += adc_f0_g0.c
|
||||
else
|
||||
SRC += adc_$(CPU_FAM).c
|
||||
endif
|
||||
|
@ -24,21 +24,31 @@
|
||||
#include "periph/adc.h"
|
||||
|
||||
/**
|
||||
* @brief Allocate locks for all three available ADC device
|
||||
* @brief Allocate lock for the ADC device
|
||||
*
|
||||
* All STM32F0 CPUs we support so far only come with a single ADC device.
|
||||
* All STM32F0 & STM32G0 CPUs we support so far only come with a single ADC device.
|
||||
*/
|
||||
static mutex_t lock = MUTEX_INIT;
|
||||
|
||||
static inline void prep(void)
|
||||
{
|
||||
mutex_lock(&lock);
|
||||
#ifdef RCC_APB2ENR_ADCEN
|
||||
periph_clk_en(APB2, RCC_APB2ENR_ADCEN);
|
||||
#endif
|
||||
#ifdef RCC_APBENR2_ADCEN
|
||||
periph_clk_en(APB12, RCC_APBENR2_ADCEN);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void done(void)
|
||||
{
|
||||
#ifdef RCC_APB2ENR_ADCEN
|
||||
periph_clk_dis(APB2, RCC_APB2ENR_ADCEN);
|
||||
#endif
|
||||
#ifdef RCC_APBENR2_ADCEN
|
||||
periph_clk_dis(APB12, RCC_APBENR2_ADCEN);
|
||||
#endif
|
||||
mutex_unlock(&lock);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user