Fix "spontaneous heating" issue (WRITE bug) on STM32 (#13356)
Should fix "spontanous heating" problems due to order of operations error. Error occurs at least with ststm32 v5.1.0 in PlatformIO.
This commit is contained in:
parent
b824a517aa
commit
4c43e6c48b
1 changed files with 1 additions and 1 deletions
|
@ -30,7 +30,7 @@
|
||||||
#include <libmaple/gpio.h>
|
#include <libmaple/gpio.h>
|
||||||
|
|
||||||
#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
|
#define READ(IO) (PIN_MAP[IO].gpio_device->regs->IDR & (1U << PIN_MAP[IO].gpio_bit) ? HIGH : LOW)
|
||||||
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !(bool)V))
|
#define WRITE(IO,V) (PIN_MAP[IO].gpio_device->regs->BSRR = (1U << PIN_MAP[IO].gpio_bit) << (16 * !((bool)V)))
|
||||||
#define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
|
#define TOGGLE(IO) (PIN_MAP[IO].gpio_device->regs->ODR = PIN_MAP[IO].gpio_device->regs->ODR ^ (1U << PIN_MAP[IO].gpio_bit))
|
||||||
#define WRITE_VAR(IO,V) WRITE(IO,V)
|
#define WRITE_VAR(IO,V) WRITE(IO,V)
|
||||||
|
|
||||||
|
|
Reference in a new issue