Browse Source

Restore correct STM32 port-bits code (#19678)

Victor Oliveira 3 years ago
parent
commit
e680196c59
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      Marlin/src/HAL/STM32/fastio.h

+ 5
- 5
Marlin/src/HAL/STM32/fastio.h View File

51
 
51
 
52
 #if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
52
 #if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || defined(STM32L0xx) || defined(STM32L4xx)
53
   #define _WRITE(IO, V) do { \
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
   }while(0)
56
   }while(0)
57
 #else
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
 #endif
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
 #define _GET_MODE(IO)
64
 #define _GET_MODE(IO)
65
 #define _SET_MODE(IO,M)         pinMode(IO, M)
65
 #define _SET_MODE(IO,M)         pinMode(IO, M)

Loading…
Cancel
Save