periph_cpu.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2017 Freie Universität Berlin
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
26 #if defined(ADC3)
27 #define ADC_DEVS (3U)
28 #elif defined(ADC2)
29 #define ADC_DEVS (2U)
30 #elif defined(ADC1)
31 #define ADC_DEVS (1U)
32 #else
33 #error "Can't determine the number of ADC devices"
34 #endif
35 
36 #if defined(CPU_MODEL_STM32L412KB) || defined(CPU_MODEL_STM32L476RG) || \
37  defined(CPU_MODEL_STM32L476VG) || defined(CPU_MODEL_STM32L475VG) || \
38  defined(CPU_MODEL_STM32L452RE) || defined(CPU_MODEL_STM32L432KC) || \
39  defined(CPU_MODEL_STM32L496ZG) || defined(CPU_MODEL_STM32L4R5ZI) || \
40  defined(CPU_MODEL_STM32L496AG)
44 #define ADC_T_ADCVREG_STUP_US (20)
45 #endif
46 
47 #ifndef DOXYGEN
48 
53 #define STM32_BOOTLOADER_ADDR (0x1FFF0000)
54 
59 #define HAVE_ADC_RES_T
60 typedef enum {
61  ADC_RES_6BIT = (ADC_CFGR_RES),
62  ADC_RES_8BIT = (ADC_CFGR_RES_1),
63  ADC_RES_10BIT = (ADC_CFGR_RES_0),
64  ADC_RES_12BIT = (0x00),
65  ADC_RES_14BIT = (0xfe),
66  ADC_RES_16BIT = (0xff)
67 } adc_res_t;
74 #define VBAT_ADC_RES ADC_RES_12BIT
75 #define VBAT_ADC_MAX 4095
78 #endif /* ndef DOXYGEN */
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
adc_res_t
Possible ADC resolution settings.
Definition: adc.h:92
@ ADC_RES_16BIT
ADC resolution: 16 bit.
Definition: adc.h:98
@ ADC_RES_8BIT
ADC resolution: 8 bit.
Definition: adc.h:94
@ ADC_RES_14BIT
ADC resolution: 14 bit.
Definition: adc.h:97
@ ADC_RES_6BIT
ADC resolution: 6 bit.
Definition: adc.h:93
@ ADC_RES_10BIT
ADC resolution: 10 bit.
Definition: adc.h:95
@ ADC_RES_12BIT
ADC resolution: 12 bit.
Definition: adc.h:96