Skip to content

Commit b875d3a

Browse files
committed
examples: update adc internal channels to support STM32C0xx
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 6c82fb2 commit b875d3a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

examples/Peripherals/ADC/Internal_channels/Internal_channels.ino

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,22 @@
2020
#include "stm32yyxx_ll_adc.h"
2121

2222
/* Values available in datasheet */
23+
#if defined(STM32C0xx)
24+
#define CALX_TEMP 30
25+
#else
2326
#define CALX_TEMP 25
24-
#if defined(STM32F1xx)
25-
#define V25 1430
27+
#endif
28+
29+
#if defined(STM32C0xx)
30+
#define VTEMP 760
31+
#define AVG_SLOPE 2530
32+
#define VREFINT 1212
33+
#elif defined(STM32F1xx)
34+
#define VTEMP 1430
2635
#define AVG_SLOPE 4300
2736
#define VREFINT 1200
2837
#elif defined(STM32F2xx) || defined(STM32F4xx)
29-
#define V25 760
38+
#define VTEMP 760
3039
#define AVG_SLOPE 2500
3140
#define VREFINT 1210
3241
#endif
@@ -66,7 +75,7 @@ static int32_t readTempSensor(int32_t VRef)
6675
return (__LL_ADC_CALC_TEMPERATURE(VRef, analogRead(ATEMP), LL_ADC_RESOLUTION));
6776
#endif
6877
#elif defined(__LL_ADC_CALC_TEMPERATURE_TYP_PARAMS)
69-
return (__LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(AVG_SLOPE, V25, CALX_TEMP, VRef, analogRead(ATEMP), LL_ADC_RESOLUTION));
78+
return (__LL_ADC_CALC_TEMPERATURE_TYP_PARAMS(AVG_SLOPE, VTEMP, CALX_TEMP, VRef, analogRead(ATEMP), LL_ADC_RESOLUTION));
7079
#else
7180
return 0;
7281
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy