SM32L1xx Standard Peripherals Library Drivers, IS_RCC_APB1_PERIPH(PERIPH)
Hi,
I saw on the latest version of STM32L1xx Standard Peripherals Library Drivers,V1.2.0 something that I do not like.Look at those macros:&sharpdefine IS_RCC_APB1_PERIPH(PERIPH)
&sharpdefine IS_RCC_APB2_PERIPH(PERIPH)
In case of RCC_APB2Periph_USART1, both will return TRUE.
/// 100000000000000 ,
/// 1001111000000010011010111000000 , &sharpdefine IS_RCC_APB1_PERIPH(PERIPH) ((((PERIPH) & 0x4F0135C0) == 0x00) && ((PERIPH) != 0x00))
/// 11111111111111111010010111100010 , &sharpdefine IS_RCC_APB2_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFA5E2) == 0x00) && ((PERIPH) != 0x00))
And look where those are used:
''void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
''
and
''void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
''
If you analyze a but more you will see that SPI2 and UART1 have the same value.Now the questions are coming:1) am I right that this is a mistake?2) due to the same value of SPI2 and UART1 it is not really possible to make the check using the approach of those macros (therefore not so easy to solve)3) Does somebody have an idea if this is an exeption or are there other cases?, shall I really ''trust'' those asserts ? #stm32-standard-peripheral-librar