Browse Source

Fix (re-)defines in HAL_ESP32 (#13780)

felixstorm 5 years ago
parent
commit
4a48b70c0b
2 changed files with 11 additions and 1 deletions
  1. 5
    0
      Marlin/src/HAL/HAL_ESP32/HAL.h
  2. 6
    1
      Marlin/src/HAL/HAL_ESP32/i2s.cpp

+ 5
- 0
Marlin/src/HAL/HAL_ESP32/HAL.h View File

30
 
30
 
31
 #include <stdint.h>
31
 #include <stdint.h>
32
 
32
 
33
+// these are going to be re-defined in Arduino.h
33
 #undef DISABLED
34
 #undef DISABLED
34
 #undef M_PI
35
 #undef M_PI
36
+#undef _BV
35
 
37
 
36
 #include <Arduino.h>
38
 #include <Arduino.h>
37
 
39
 
40
+// revert back to the correct (old) definition
38
 #undef DISABLED
41
 #undef DISABLED
39
 #define DISABLED(V...) DO(DIS,&&,V)
42
 #define DISABLED(V...) DO(DIS,&&,V)
43
+// re-define in case Arduino.h has been skipped due to earlier inclusion (i.e. in Marlin\src\HAL\HAL_ESP32\i2s.cpp)
44
+#define _BV(b) (1UL << (b))
40
 
45
 
41
 #include "../shared/math_32bit.h"
46
 #include "../shared/math_32bit.h"
42
 #include "../shared/HAL_SPI.h"
47
 #include "../shared/HAL_SPI.h"

+ 6
- 1
Marlin/src/HAL/HAL_ESP32/i2s.cpp View File

21
  */
21
  */
22
 #ifdef ARDUINO_ARCH_ESP32
22
 #ifdef ARDUINO_ARCH_ESP32
23
 
23
 
24
-#include <Arduino.h> // replace that with the proper imports
24
+// replace that with the proper imports, then cleanup workarounds in Marlin\src\HAL\HAL_ESP32\HAL.h
25
+#include <Arduino.h>
26
+// revert back to the correct definition
27
+#undef DISABLED
28
+#define DISABLED(V...) DO(DIS,&&,V)
29
+
25
 #include "i2s.h"
30
 #include "i2s.h"
26
 #include "../../core/macros.h"
31
 #include "../../core/macros.h"
27
 #include "driver/periph_ctrl.h"
32
 #include "driver/periph_ctrl.h"

Loading…
Cancel
Save