Skip to main content
disirio2
Associate III
November 26, 2011
Question

Recommendation regarding STM32 register header files

  • November 26, 2011
  • 0 replies
  • 549 views
Posted on November 26, 2011 at 11:13

Hi,

There is a small conceptual issue I wish to report in the STM32F2/F4/L1 headers.

Currently the GPIO BSRR register is declared as two separated 16bits registers BSRRL and BSRRH which defeats its purpose of making atomic masked writes possible, that requires a single 32bits access.

I recommend redefining it as an union allowing both access modes:

  volatile union {

    uint32_t            W;

    struct {

      uint16_t          set;

      uint16_t          clear;

    } H;

  } BSRR;

This would make possible both simple and masked accesses.

Giovanni

---

http://www.chibios.org

#stm32-headers-rtos
    This topic has been closed for replies.