Browse Source

Use _BV32 to avoid name conflict

pull/1/head
Scott Lahteine 7 years ago
parent
commit
f5cfdf6efe
  1. 4
      Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp
  2. 2
      Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h
  3. 2
      Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h
  4. 11
      Marlin/src/core/macros.h
  5. 6
      Marlin/src/gcode/parser.h

4
Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp

@ -130,8 +130,8 @@ extern "C" void GpioDisableInt(const uint32_t port, const uint32_t pin) {
}
}
bool isPowerOf2(unsigned int n) {
return n == 1 || (n & (n - 1)) == 0;
constexpr bool isPowerOf2(const uint16_t n) {
return IS_POWER_OF_2(n);
}
#if 0

2
Marlin/src/HAL/HAL_STM32F7/HAL_STM32F7.h

@ -98,7 +98,7 @@
#define NUM_SERIAL 1
#endif
#define _BV(b) (1UL << (b))
#define _BV(b) (1 << (b))
/**
* TODO: review this to return 1 for pins that are not analog input

2
Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h

@ -29,7 +29,7 @@
#ifndef _FASTIO_STM32F7_H
#define _FASTIO_STM32F7_H
#define _BV(b) (1UL << (b))
#define _BV(b) (1 << (b))
#define READ(IO) digitalRead(IO)
#define WRITE(IO, v) digitalWrite(IO,v)

11
Marlin/src/core/macros.h

@ -95,13 +95,18 @@
#define STRINGIFY(M) STRINGIFY_(M)
// Macros for bit masks
#undef _BV // Marlin needs 32-bit unsigned!
#define _BV(b) (1UL << (b))
#define TEST(n,b) (((n)&_BV(b))!=0)
#undef _BV
#define _BV(b) (1<<(b))
#define TEST(n,b) !!((n)&_BV(b))
#define SBI(n,b) (n |= _BV(b))
#define CBI(n,b) (n &= ~_BV(b))
#define SET_BIT(n,b,value) (n) ^= ((-value)^(n)) & (_BV(b))
#define _BV32(b) (1UL << (b))
#define TEST32(n,b) !!((n)&_BV32(b))
#define SBI32(n,b) (n |= _BV32(b))
#define CBI32(n,b) (n &= ~_BV32(b))
// Macros for maths shortcuts
#ifndef M_PI
#define M_PI 3.14159265358979323846

6
Marlin/src/gcode/parser.h

@ -108,7 +108,7 @@ public:
static void set(const char c, char * const ptr) {
const uint8_t ind = LETTER_BIT(c);
if (ind >= COUNT(param)) return; // Only A-Z
SBI(codebits, ind); // parameter exists
SBI32(codebits, ind); // parameter exists
param[ind] = ptr ? ptr - command_ptr : 0; // parameter offset or 0
#if ENABLED(DEBUG_GCODE_PARSER)
if (codenum == 800) {
@ -125,7 +125,7 @@ public:
static bool seen(const char c) {
const uint8_t ind = LETTER_BIT(c);
if (ind >= COUNT(param)) return false; // Only A-Z
const bool b = TEST(codebits, ind);
const bool b = TEST32(codebits, ind);
if (b) {
char * const ptr = command_ptr + param[ind];
value_ptr = param[ind] && valid_float(ptr) ? ptr : (char*)NULL;
@ -135,7 +135,7 @@ public:
static bool seen_any() { return !!codebits; }
#define SEEN_TEST(L) TEST(codebits, LETTER_BIT(L))
#define SEEN_TEST(L) TEST32(codebits, LETTER_BIT(L))
#else // !FASTER_GCODE_PARSER

Loading…
Cancel
Save