Browse Source

Marlin must override _BV for 32-bit masks!

Scott Lahteine 7 years ago
parent
commit
58671e1bc1

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h View File

98
   #define NUM_SERIAL 1
98
   #define NUM_SERIAL 1
99
 #endif
99
 #endif
100
 
100
 
101
-#define _BV(bit) (1 << (bit))
101
+#define _BV(b) (1UL << (b))
102
 
102
 
103
 /**
103
 /**
104
  * TODO: review this to return 1 for pins that are not analog input
104
  * TODO: review this to return 1 for pins that are not analog input

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h View File

29
 #ifndef _FASTIO_STM32F7_H
29
 #ifndef _FASTIO_STM32F7_H
30
 #define _FASTIO_STM32F7_H
30
 #define _FASTIO_STM32F7_H
31
 
31
 
32
-#define _BV(bit) (1 << (bit))
32
+#define _BV(b) (1UL << (b))
33
 
33
 
34
 #define READ(IO)              digitalRead(IO)
34
 #define READ(IO)              digitalRead(IO)
35
 #define WRITE(IO, v)          digitalWrite(IO,v)
35
 #define WRITE(IO, v)          digitalWrite(IO,v)

+ 2
- 3
Marlin/src/core/macros.h View File

95
 #define STRINGIFY(M) STRINGIFY_(M)
95
 #define STRINGIFY(M) STRINGIFY_(M)
96
 
96
 
97
 // Macros for bit masks
97
 // Macros for bit masks
98
-#ifndef _BV
99
-  #define _BV(n)  (1<<(n))
100
-#endif
98
+#undef _BV // Marlin needs 32-bit unsigned!
99
+#define _BV(b) (1UL << (b))
101
 #define TEST(n,b) (((n)&_BV(b))!=0)
100
 #define TEST(n,b) (((n)&_BV(b))!=0)
102
 #define SBI(n,b) (n |= _BV(b))
101
 #define SBI(n,b) (n |= _BV(b))
103
 #define CBI(n,b) (n &= ~_BV(b))
102
 #define CBI(n,b) (n &= ~_BV(b))

Loading…
Cancel
Save