From 58671e1bc184c2d8e5138065d47a93a57a5e78ee Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jan 2018 23:39:37 -0600 Subject: [PATCH] Marlin must override _BV for 32-bit masks! --- Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h | 2 +- Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h | 2 +- Marlin/src/core/macros.h | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h index f2196a6740..03ab69a1ed 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h @@ -98,7 +98,7 @@ #define NUM_SERIAL 1 #endif -#define _BV(bit) (1 << (bit)) +#define _BV(b) (1UL << (b)) /** * TODO: review this to return 1 for pins that are not analog input diff --git a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h index ed74161e01..e22acc6670 100644 --- a/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h @@ -29,7 +29,7 @@ #ifndef _FASTIO_STM32F7_H #define _FASTIO_STM32F7_H -#define _BV(bit) (1 << (bit)) +#define _BV(b) (1UL << (b)) #define READ(IO) digitalRead(IO) #define WRITE(IO, v) digitalWrite(IO,v) diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 2c62467232..945233a457 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -95,9 +95,8 @@ #define STRINGIFY(M) STRINGIFY_(M) // Macros for bit masks -#ifndef _BV - #define _BV(n) (1<<(n)) -#endif +#undef _BV // Marlin needs 32-bit unsigned! +#define _BV(b) (1UL << (b)) #define TEST(n,b) (((n)&_BV(b))!=0) #define SBI(n,b) (n |= _BV(b)) #define CBI(n,b) (n &= ~_BV(b))