瀏覽代碼

Restore correct STM32 port-bits code (#19678)

Victor Oliveira 4 年之前
父節點
當前提交
e680196c59
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5
    5
      Marlin/src/HAL/STM32/fastio.h

+ 5
- 5
Marlin/src/HAL/STM32/fastio.h 查看文件

@@ -51,15 +51,15 @@ void FastIO_init(); // Must be called before using fast io macros
51 51
 
52 52
 #if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
53 53
   #define _WRITE(IO, V) do { \
54
-    if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(digitalPinToPinName(IO) & 0x1F) ; \
55
-    else   FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR  = _BV32(digitalPinToPinName(IO) & 0x1F) ; \
54
+    if (V) FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO])) ; \
55
+    else   FastIOPortMap[STM_PORT(digitalPin[IO])]->BRR  = _BV32(STM_PIN(digitalPin[IO])) ; \
56 56
   }while(0)
57 57
 #else
58
-  #define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(digitalPinToPinName(IO) + ((V) ? 0 : 16)))
58
+  #define _WRITE(IO, V) (FastIOPortMap[STM_PORT(digitalPin[IO])]->BSRR = _BV32(STM_PIN(digitalPin[IO]) + ((V) ? 0 : 16)))
59 59
 #endif
60 60
 
61
-#define _READ(IO)               bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(digitalPinToPinName(IO) & 0x1F)))
62
-#define _TOGGLE(IO)             (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(digitalPinToPinName(IO) & 0x1F))
61
+#define _READ(IO)               bool(READ_BIT(FastIOPortMap[STM_PORT(digitalPin[IO])]->IDR, _BV32(STM_PIN(digitalPin[IO]))))
62
+#define _TOGGLE(IO)             (FastIOPortMap[STM_PORT(digitalPin[IO])]->ODR ^= _BV32(STM_PIN(digitalPin[IO])))
63 63
 
64 64
 #define _GET_MODE(IO)
65 65
 #define _SET_MODE(IO,M)         pinMode(IO, M)

Loading…
取消
儲存