Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite4b1121

Browse files
committed
[ADC] Able to build without HAL module
Note: no size changeSigned-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent0753358 commite4b1121

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

‎cores/arduino/stm32/analog.c‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@
4444
extern"C" {
4545
#endif
4646

47+
48+
/* Private_Variables */
49+
staticPinNameg_current_pin=NC;
50+
4751
/* Private_Defines */
52+
#ifdefHAL_ADC_MODULE_ENABLED
53+
4854
#if defined(ADC_SAMPLETIME_8CYCLES_5)
4955
#defineSAMPLINGTIME ADC_SAMPLETIME_8CYCLES_5;
5056
#elif defined(ADC_SAMPLETIME_12CYCLES_5)
@@ -79,9 +85,6 @@ extern "C" {
7985
#defineADC_REGULAR_RANK_1 1
8086
#endif
8187

82-
/* Private_Variables */
83-
staticPinNameg_current_pin=NC;
84-
8588
/* Private Functions */
8689
staticuint32_tget_adc_channel(PinNamepin)
8790
{
@@ -155,6 +158,7 @@ static uint32_t get_adc_channel(PinName pin)
155158
}
156159
returnchannel;
157160
}
161+
#endif/* HAL_ADC_MODULE_ENABLED */
158162

159163
staticuint32_tget_pwm_channel(PinNamepin)
160164
{
@@ -337,7 +341,7 @@ void dac_stop(PinName pin)
337341
}
338342
#endif//HAL_DAC_MODULE_ENABLED
339343

340-
344+
#ifdefHAL_ADC_MODULE_ENABLED
341345
////////////////////////// ADC INTERFACE FUNCTIONS /////////////////////////////
342346

343347
/**
@@ -641,6 +645,7 @@ uint16_t adc_read_value(PinName pin)
641645

642646
returnuhADCxConvertedValue;
643647
}
648+
#endif/* HAL_ADC_MODULE_ENABLED */
644649

645650
////////////////////////// PWM INTERFACE FUNCTIONS /////////////////////////////
646651

‎cores/arduino/stm32/stm32yyxx_hal_conf.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
/*
2121
* Defined by default
2222
*/
23+
#if !defined(HAL_ADC_MODULE_DISABLED)
2324
#defineHAL_ADC_MODULE_ENABLED
25+
#else
26+
#undef HAL_ADC_MODULE_ENABLED
27+
#endif
2428

2529
#if !defined(HAL_I2C_MODULE_DISABLED)
2630
#defineHAL_I2C_MODULE_ENABLED

‎cores/arduino/wiring_analog.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,15 @@ static inline uint32_t mapResolution(uint32_t value, uint32_t from, uint32_t to)
6464
uint32_tanalogRead(uint32_tulPin)
6565
{
6666
uint32_tvalue=0;
67+
#ifdefHAL_ADC_MODULE_ENABLED
6768
PinNamep=analogInputToPinName(ulPin);
6869
if (p!=NC) {
6970
value=adc_read_value(p);
7071
value=mapResolution(value,ADC_RESOLUTION,_readResolution);
7172
}
73+
#else
74+
UNUSED(ulPin);
75+
#endif
7276
returnvalue;
7377
}
7478

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp