4444extern "C" {
4545#endif
4646
47+
48+ /* Private_Variables */
49+ #if defined(HAL_ADC_MODULE_ENABLED )|| defined(HAL_DAC_MODULE_ENABLED )|| \
50+ defined(HAL_TIM_MODULE_ENABLED )
51+ static PinName g_current_pin = NC ;
52+ #endif
53+
4754/* Private_Defines */
55+ #ifdef HAL_ADC_MODULE_ENABLED
56+
4857#if defined(ADC_SAMPLETIME_8CYCLES_5 )
4958#define SAMPLINGTIME ADC_SAMPLETIME_8CYCLES_5;
5059#elif defined(ADC_SAMPLETIME_12CYCLES_5 )
@@ -79,9 +88,6 @@ extern "C" {
7988#define ADC_REGULAR_RANK_1 1
8089#endif
8190
82- /* Private_Variables */
83- static PinName g_current_pin = NC ;
84-
8591/* Private Functions */
8692static uint32_t get_adc_channel (PinName pin )
8793{
@@ -155,7 +161,9 @@ static uint32_t get_adc_channel(PinName pin)
155161 }
156162return channel ;
157163}
164+ #endif /* HAL_ADC_MODULE_ENABLED */
158165
166+ #ifdef HAL_TIM_MODULE_ENABLED
159167static uint32_t get_pwm_channel (PinName pin )
160168{
161169uint32_t function = pinmap_function (pin ,PinMap_PWM );
@@ -179,6 +187,7 @@ static uint32_t get_pwm_channel(PinName pin)
179187 }
180188return channel ;
181189}
190+ #endif /* HAL_TIM_MODULE_ENABLED */
182191
183192#ifdef HAL_DAC_MODULE_ENABLED
184193static uint32_t get_dac_channel (PinName pin )
@@ -337,7 +346,7 @@ void dac_stop(PinName pin)
337346}
338347#endif //HAL_DAC_MODULE_ENABLED
339348
340-
349+ #ifdef HAL_ADC_MODULE_ENABLED
341350////////////////////////// ADC INTERFACE FUNCTIONS /////////////////////////////
342351
343352/**
@@ -641,7 +650,9 @@ uint16_t adc_read_value(PinName pin)
641650
642651return uhADCxConvertedValue ;
643652}
653+ #endif /* HAL_ADC_MODULE_ENABLED */
644654
655+ #ifdef HAL_TIM_MODULE_ENABLED
645656////////////////////////// PWM INTERFACE FUNCTIONS /////////////////////////////
646657
647658
@@ -775,6 +786,7 @@ void pwm_stop(PinName pin)
775786
776787HAL_TIM_PWM_DeInit (& timHandle );
777788}
789+ #endif /* HAL_TIM_MODULE_ENABLED */
778790
779791#ifdef __cplusplus
780792}