AnsweredAssumed Answered

Macro about Peripheral clock

Question asked by julien.terrier on Sep 11, 2015
Latest reply on Sep 13, 2015 by julien.terrier
Hello,
someone would be able to explain me what's happen in the last two lines of this macro:

/** @defgroup RCC_AHB1_Clock_Enable_Disable AHB1 Peripheral Clock Enable Disable
  * @brief  Enable or disable the AHB1 peripheral clock.
  * @note   After reset, the peripheral clock (used for registers read/write access)
  *         is disabled and the application software has to enable this clock before
  *         using it.  
  * @{
  */
#define __HAL_RCC_GPIOA_CLK_ENABLE()    do { \
                                        __IO uint32_t tmpreg; \
                                        SET_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
                                        /* Delay after an RCC peripheral clock enabling */ \
                                        tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);\
                                        UNUSED(tmpreg); \
                    } while(0)

-tmpreg = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOAEN);

#define READ_BIT(REG, BIT)    ((REG) & (BIT))

-UNUSED(tmpreg);

#define UNUSED(x) ((void)(x))


I understood everything except these two lines.

Nb: No need to explain how works the bitwise & I can. I want only know why to have add these lines

Thank you.

Outcomes