Kaynağa Gözat

Restore correct STM32 port-bits code (#19678)

Victor Oliveira 4 yıl önce
ebeveyn
işleme
e680196c59
1 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 5
    5
      Marlin/src/HAL/STM32/fastio.h

+ 5
- 5
Marlin/src/HAL/STM32/fastio.h Dosyayı Görüntüle

@@ -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…
İptal
Kaydet