HAL_ADC_Init assert issue for oversampling right bit shift value on STM32H7
I am currently seeing an assert_param failure within the HAL_ADC_Init() method in stm32h7xx_hal_adc.c file.
Specifically the following assertion is failing:
assert_param(IS_ADC_RIGHT_BIT_SHIFT(hadc->Init.Oversampling.RightBitShift));The value being passed into the assertion is 0x140 which is being initialised in MX_ADC1_Init() and MX_ADC3_Init() as follows:
hadc1.Init.Oversampling.RightBitShift = ADC_RIGHTBITSHIFT_10;
hadc3.Init.Oversampling.RightBitShift = ADC_RIGHTBITSHIFT_10;I believe the actual issue is the macro in the file stm32h7xx_hal_adc_ex.h:
#define IS_ADC_RIGHT_BIT_SHIFT(__SHIFT__) (((__SHIFT__) == ADC_RIGHTBITSHIFT_NONE) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_1 ) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_2 ) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_3 ) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_4 ) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_5 ) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_6 ) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_7 ) || \
((__SHIFT__) == ADC_RIGHTBITSHIFT_8 ))which only checks values up to ADC_RIGHTBITSHIFT_8 and does not include the possible values of ADC_RIGHTBITSHIFT_9, ADC_RIGHTBITSHIFT_10 and ADC_RIGHTBITSHIFT_11 which are possible on the STM32H7.
I propose update the macro to include the missing potential values.
