1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/stm32: add ADC support for WB55

This commit is contained in:
crasbe 2024-07-03 22:54:08 +02:00
parent d312d36728
commit f93aa40186
4 changed files with 38 additions and 1 deletions

View File

@ -79,7 +79,7 @@ ifneq (,$(filter periph_rtc_mem,$(USEMODULE)))
endif
ifneq (,$(filter periph_adc,$(FEATURES_USED)))
ifneq (,$(filter f3 l4 wl, $(CPU_FAM)))
ifneq (,$(filter f3 l4 wb wl, $(CPU_FAM)))
USEMODULE += ztimer
USEMODULE += ztimer_msec
endif

View File

@ -24,6 +24,26 @@
extern "C" {
#endif
/**
* @brief Available number of ADC devices
*/
#if defined(ADC3)
#define ADC_DEVS (3U)
#elif defined(ADC2)
#define ADC_DEVS (2U)
#elif defined(ADC1)
#define ADC_DEVS (1U)
#else
#error "Can't determine the number of ADC devices"
#endif
#if defined(CPU_MODEL_STM32WB55RG)
/**
* @brief ADC voltage regulator start-up time [us]
*/
#define ADC_T_ADCVREG_STUP_US (20)
#endif
#ifndef DOXYGEN
/**
@ -32,6 +52,21 @@ extern "C" {
*/
#define STM32_BOOTLOADER_ADDR (0x1FFF0000)
/**
* @brief Override ADC resolution values
* @{
*/
#define HAVE_ADC_RES_T
typedef enum {
ADC_RES_6BIT = (ADC_CFGR_RES), /**< ADC resolution: 6 bit */
ADC_RES_8BIT = (ADC_CFGR_RES_1), /**< ADC resolution: 8 bit */
ADC_RES_10BIT = (ADC_CFGR_RES_0), /**< ADC resolution: 10 bit */
ADC_RES_12BIT = (0x0), /**< ADC resolution: 12 bit */
ADC_RES_14BIT = (0x1), /**< not applicable */
ADC_RES_16BIT = (0x2) /**< not applicable */
} adc_res_t;
/** @} */
/**
* @name Constants for internal VBAT ADC line
* @{

View File

@ -17,6 +17,8 @@ ifneq (,$(filter periph_adc,$(USEMODULE)))
SRC += adc_f4_f7.c
else ifneq (,$(filter $(CPU_FAM),f0 g0 c0))
SRC += adc_f0_g0_c0.c
else ifneq (,$(filter $(CPU_FAM),l4 wb))
SRC += adc_l4_wb.c
else
SRC += adc_$(CPU_FAM).c
endif