cast conversion issue when _LL_RTC_CONVERT_BCD2BIN macro is used
I am using stm32cube ide 1.7.0 and when I use the macro _LL_RTC_CONVERT_BCD2BIN a warning rise. I have wconversion warning flag enable, also, when I call the macro y use a uint8_t type data. I have -o2 optimization.

In the picture attached VALUE is replaced by a uint8_t variable with a valir bcd number.
This is the code which is calling the macro:
ptm.tm_hour = (int)__LL_RTC_CONVERT_BCD2BIN((uint8_t)__LL_RTC_GET_HOUR(time_bcd));
A workaround for this is replace the line with: #define __LL_RTC_CONVERT_BCD2BIN(VALUE) (uint8_t)((((uint8_t)((VALUE) & (uint8_t)0xF0) >> (uint8_t)0x04) * (uint8_t)10) + ((VALUE) & (uint8_t)0x0F))
Hi @jealcuna,
Thank you for this report. We will get back to you with a feedback as soon as possible. Please excuse the delay it may take us sometimes to reply. Thank you for your comprehension.
With regards,
Hi @jealcuna,
I hope you are fine. We tried to reproduce the problem you reported, with no success. Below the environment configuration used:
- STM32CubeG0 v1.6.1
- Cube IDE v1.9.0
- Optimization level
-O2 - Compilation flags
-Walland-Wconversionenabled
Would you mind precising the types of variables time_bcd and ptm.tm_hour used in your code?
Thanks,
Hi @jealcuna,
I hope you are doing well. As there has been no activity on this thread since a while and as we could not reproduce the issue you reported, please allow me to close this issue. Thank you for your comprehension.
With regards,