Closed baverrud closed 1 year ago
In the following function:
static inline void gpio_write(uint16_t pin, bool val) { struct gpio *gpio = GPIO(PINBANK(pin)); gpio->BSRR |= (1U << PINNO(pin)) << (val ? 0 : 16); }
.. the BSRR |= .. will cause an unnecessary attempt to read the BSRR register, as BSRR is write-only. Replace |= with =. Functionally it will be the same, only a tiny bit more efficient.
Thank you @baverrud
Fixed by https://github.com/cpq/bare-metal-programming-guide/commit/dd4d96d6d90ba3e1150c108df5e4205a0255c294
In the following function:
.. the BSRR |= .. will cause an unnecessary attempt to read the BSRR register, as BSRR is write-only. Replace |= with =. Functionally it will be the same, only a tiny bit more efficient.