From 26e7e33698a3624614f2c0c1be260be9990943f6 Mon Sep 17 00:00:00 2001 From: Msq001 <760675063@qq.com> Date: Wed, 12 Jun 2019 19:30:24 +0800 Subject: [PATCH] Fix bug in STM32F1 WRITE macro (#14275) --- Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h index f1f205626..a7bfab802 100644 --- a/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h +++ b/Marlin/src/HAL/HAL_STM32F1/fastio_STM32F1.h @@ -30,7 +30,7 @@ #include #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) << ((V) ? 0 : 16)) #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)