cancel
Showing results for 
Search instead for 
Did you mean: 

Unused parameter: [F2] HAL_TIM_OnePulse_Start

valentin
Senior
Posted on May 06, 2017 at 08:30

I've just been pointed at this function by my compiler warnings and am wondering what's going on here?

The parameter uint32_t OutputChannel is clearly not used, instead channel 1 AND 2 are always started together.

This must either be intended behaviour for some hardware reason OR a bug.

In case 1: Please remove the parameter and explain the situation in the function comment.

Case 2: Please fix by actually using the parameter.

CubeMX 4.1

up-to-date F2 FW package

file: stm32f2xx_hal_tim.c line 2107

The same goes for:

- HAL_TIM_OnePulse_Stop

- HAL_TIM_OnePulse_Start_IT and

- HAL_TIM_OnePulse_Stop_IT

Thanks!

/**
 * @brief Starts the TIM One Pulse signal generation.
 * @param htim: pointer to a TIM_HandleTypeDef structure that contains
 * the configuration information for TIM module.
 * @param OutputChannel : TIM Channels to be enabled.
 * This parameter can be one of the following values:
 * @arg TIM_CHANNEL_1: TIM Channel 1 selected
 * @arg TIM_CHANNEL_2: TIM Channel 2 selected
 * @retval HAL status
 */
HAL_StatusTypeDef HAL_TIM_OnePulse_Start(TIM_HandleTypeDef *htim, uint32_t OutputChannel)
{
 /* Enable the Capture compare and the Input Capture channels 
 (in the OPM Mode the two possible channels that can be used are TIM_CHANNEL_1 and TIM_CHANNEL_2)
 if TIM_CHANNEL_1 is used as output, the TIM_CHANNEL_2 will be used as input and
 if TIM_CHANNEL_1 is used as input, the TIM_CHANNEL_2 will be used as output 
 in all combinations, the TIM_CHANNEL_1 and TIM_CHANNEL_2 should be enabled together 
 
 No need to enable the counter, it's enabled automatically by hardware 
 (the counter starts in response to a stimulus and generate a pulse */
 
 TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_1, TIM_CCx_ENABLE); 
 TIM_CCxChannelCmd(htim->Instance, TIM_CHANNEL_2, TIM_CCx_ENABLE); 
 
 if(IS_TIM_ADVANCED_INSTANCE(htim->Instance) != RESET) 
 {
 /* Enable the main output */
 __HAL_TIM_MOE_ENABLE(htim);
 }
 
 /* Return function status */
 return HAL_OK;
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

Btw, there are quite a bit of those unused parameters going on in the ST drivers alone.

0690X00000606ruQAA.png

-------------------------------------

I think that drivers and middleware intended for public use should be warning-free even in +wextra and +wpedantic mode. Does anybody disagree?

2 REPLIES 2
Imen.D
ST Employee
Posted on May 08, 2017 at 12:59

Hi

Roehrig.Valentin

,

Sorry for any inconvenience this may cause.

I confirm: this is a known issue and it will be fixed in the next release of STM32CubeF2 firmware package.

Thanks

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 08, 2017 at 22:05

Thanks, much appreciated!