cpu/stm32: gpio: use bit-banding #14517
Conversation
e3509f9 to
6981156
Compare
Bit-Banding is available on STM32 CPUs, so make use of it in the GPIO driver to save a few cycles when setting pins.
6981156 to
951d742
Compare
There was a problem hiding this comment.
Some of the changes will become obsolete once the low-level GPIO API in PR #14610 handles pin masks. This functions will change to something like the following:
_port(port)->BSRR = pins;
Not sure whether we should introduce it for now. It will make rebasing harder.
| void gpio_set(gpio_t pin) | ||
| { | ||
| _port(pin)->BSRR = (1 << _pin_num(pin)); | ||
| bit_set32(&_port(pin)->BSRR, _pin_num(pin)); |
There was a problem hiding this comment.
This change will become obsolete with PR #14610 and will produce conflicts.
| void gpio_clear(gpio_t pin) | ||
| { | ||
| _port(pin)->BSRR = (1 << (_pin_num(pin) + 16)); | ||
| bit_set32(&_port(pin)->BSRR, _pin_num(pin) + 16); |
There was a problem hiding this comment.
This change will become obsolete with PR #14610 and will produce conflicts.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
Bit-Banding is available on STM32 CPUs, so make use of it in the GPIO driver to save a few cycles when setting pins.
Testing procedure
tests/periph_gpioshould still work.Issues/PRs references
depends on #14516