From e7682eea425d2173e594b5cfdb5c2e4d6fc953c0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 2 May 2019 00:45:50 -0500 Subject: [PATCH] Use Arduino.h include wrapper (#13877) --- Marlin/src/HAL/HAL_AVR/HAL.h | 15 +++--- Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp | 2 +- Marlin/src/HAL/HAL_AVR/servo_AVR.cpp | 2 +- .../src/HAL/HAL_DUE/EepromEmulation_Due.cpp | 2 +- Marlin/src/HAL/HAL_DUE/HAL.h | 7 ++- Marlin/src/HAL/HAL_DUE/Servo_Due.cpp | 2 +- Marlin/src/HAL/HAL_DUE/pinsDebug.h | 2 +- .../HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp | 14 +++--- .../HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp | 5 +- Marlin/src/HAL/HAL_ESP32/HAL.h | 14 +----- Marlin/src/HAL/HAL_ESP32/i2s.cpp | 8 +-- Marlin/src/HAL/HAL_ESP32/i2s.h | 2 + Marlin/src/HAL/HAL_LINUX/HAL.h | 7 ++- Marlin/src/HAL/HAL_LINUX/fastio.h | 2 +- Marlin/src/HAL/HAL_LPC1768/HAL.h | 10 ++-- Marlin/src/HAL/HAL_LPC1768/fastio.h | 2 +- .../u8g/u8g_com_HAL_LPC1768_sw_spi.cpp | 4 +- Marlin/src/HAL/HAL_STM32/HAL.h | 18 +++---- Marlin/src/HAL/HAL_STM32F1/HAL.h | 13 ++--- Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h | 3 +- Marlin/src/HAL/HAL_STM32F4/HAL.h | 18 +++---- Marlin/src/HAL/HAL_STM32F7/HAL.h | 4 +- Marlin/src/HAL/HAL_TEENSY31_32/HAL.h | 9 +--- Marlin/src/HAL/HAL_TEENSY35_36/HAL.h | 10 +--- Marlin/src/HAL/shared/HAL_ST7920.h | 2 +- Marlin/src/HAL/shared/Marduino.h | 50 +++++++++++++++++++ Marlin/src/HAL/shared/servo.cpp | 1 - Marlin/src/lcd/fontutils.h | 5 +- Marlin/src/lcd/ultralcd.cpp | 1 + Marlin/src/libs/duration_t.h | 2 +- Marlin/src/libs/softspi.h | 35 ++++++++++--- Marlin/src/pins/pins_MIGHTYBOARD_REVE.h | 2 +- 32 files changed, 155 insertions(+), 118 deletions(-) create mode 100644 Marlin/src/HAL/shared/Marduino.h diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index b5b63dc5d1..9dc5e95c55 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -24,14 +24,7 @@ #include -#include - -#include -#include -#include -#include -#include - +#include "../shared/Marduino.h" #include "../shared/HAL_SPI.h" #include "fastio_AVR.h" #include "watchdog_AVR.h" @@ -43,6 +36,12 @@ #include "MarlinSerial.h" #endif +#include +#include +#include +#include +#include + // -------------------------------------------------------------------------- // Defines // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp b/Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp index 63fbe4d969..c58f9da41d 100644 --- a/Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/fastio_AVR.cpp @@ -30,7 +30,7 @@ #ifdef FASTIO_EXT_START -#include +#include "../shared/Marduino.h" #define _IS_EXT(P) WITHIN(P, FASTIO_EXT_START, FASTIO_EXT_END) diff --git a/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp b/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp index e3d2194bf7..7e8357ed57 100644 --- a/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/servo_AVR.cpp @@ -58,8 +58,8 @@ #if HAS_SERVOS #include -#include +#include "../shared/Marduino.h" #include "../shared/servo.h" #include "../shared/servo_private.h" diff --git a/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp b/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp index 21f1a8c9d4..07f746a17d 100644 --- a/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/EepromEmulation_Due.cpp @@ -36,7 +36,7 @@ #if ENABLED(EEPROM_SETTINGS) && DISABLED(I2C_EEPROM, SPI_EEPROM) -#include +#include "../shared/Marduino.h" #define EEPROMSize 4096 #define PagesPerGroup 128 diff --git a/Marlin/src/HAL/HAL_DUE/HAL.h b/Marlin/src/HAL/HAL_DUE/HAL.h index d430e6b649..2fd9a0b0dd 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.h +++ b/Marlin/src/HAL/HAL_DUE/HAL.h @@ -29,16 +29,15 @@ #define CPU_32_BIT -#include - -#include - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio_Due.h" #include "watchdog_Due.h" #include "HAL_timers_Due.h" +#include + // Serial ports #if !WITHIN(SERIAL_PORT, -1, 3) #error "SERIAL_PORT must be from -1 to 3" diff --git a/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp b/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp index 848d263b70..d9e41f9541 100644 --- a/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/Servo_Due.cpp @@ -44,7 +44,7 @@ #if HAS_SERVOS -#include +#include "../shared/Marduino.h" #include "../shared/servo.h" #include "../shared/servo_private.h" diff --git a/Marlin/src/HAL/HAL_DUE/pinsDebug.h b/Marlin/src/HAL/HAL_DUE/pinsDebug.h index 9d86577052..9b6cbe1cc4 100644 --- a/Marlin/src/HAL/HAL_DUE/pinsDebug.h +++ b/Marlin/src/HAL/HAL_DUE/pinsDebug.h @@ -28,7 +28,7 @@ * Translation of routines & variables used by pinsDebug.h */ -#include +#include "../shared/Marduino.h" /** * Due/Marlin quirks diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp index ba7700150f..9e92519ef6 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_shared_hw_spi.cpp @@ -66,20 +66,20 @@ #include "../../Marlin.h" -#define SPI_FULL_SPEED 0 -#define SPI_HALF_SPEED 1 -#define SPI_QUARTER_SPEED 2 -#define SPI_EIGHTH_SPEED 3 +#define SPI_FULL_SPEED 0 +#define SPI_HALF_SPEED 1 +#define SPI_QUARTER_SPEED 2 +#define SPI_EIGHTH_SPEED 3 #define SPI_SIXTEENTH_SPEED 4 -#define SPI_SPEED_5 5 -#define SPI_SPEED_6 6 +#define SPI_SPEED_5 5 +#define SPI_SPEED_6 6 void spiBegin(); void spiInit(uint8_t spiRate); void spiSend(uint8_t b); void spiSend(const uint8_t* buf, size_t n); -#include +#include "../shared/Marduino.h" #include "fastio_Due.h" void u8g_SetPIOutput_DUE_hw_spi(u8g_t *u8g, uint8_t pin_index) { diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp index 3cef880bca..34428573bb 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp @@ -59,10 +59,11 @@ #if HAS_GRAPHICAL_LCD -#include -#include +#include "../shared/Marduino.h" #include "../shared/Delay.h" +#include + void u8g_SetPIOutput_DUE(u8g_t *u8g, uint8_t pin_index) { PIO_Configure(g_APinDescription[u8g->pin_list[pin_index]].pPort, PIO_OUTPUT_1, g_APinDescription[u8g->pin_list[pin_index]].ulPin, g_APinDescription[u8g->pin_list[pin_index]].ulPinConfiguration); // OUTPUT diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index 16859263b2..556a484677 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -30,19 +30,7 @@ #include -// these are going to be re-defined in Arduino.h -#undef DISABLED -#undef M_PI -#undef _BV - -#include - -// revert back to the correct (old) definition -#undef DISABLED -#define DISABLED(V...) DO(DIS,&&,V) -// re-define in case Arduino.h has been skipped due to earlier inclusion (i.e. in Marlin\src\HAL\HAL_ESP32\i2s.cpp) -#define _BV(b) (1UL << (b)) - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" diff --git a/Marlin/src/HAL/HAL_ESP32/i2s.cpp b/Marlin/src/HAL/HAL_ESP32/i2s.cpp index 0345889e07..3dbabb535e 100644 --- a/Marlin/src/HAL/HAL_ESP32/i2s.cpp +++ b/Marlin/src/HAL/HAL_ESP32/i2s.cpp @@ -21,13 +21,9 @@ */ #ifdef ARDUINO_ARCH_ESP32 -// replace that with the proper imports, then cleanup workarounds in Marlin\src\HAL\HAL_ESP32\HAL.h -#include -// revert back to the correct definition -#undef DISABLED -#define DISABLED(V...) DO(DIS,&&,V) - #include "i2s.h" + +#include "../shared/Marduino.h" #include "../../core/macros.h" #include "driver/periph_ctrl.h" #include "rom/lldesc.h" diff --git a/Marlin/src/HAL/HAL_ESP32/i2s.h b/Marlin/src/HAL/HAL_ESP32/i2s.h index fbe7b2419a..42c35aa12d 100644 --- a/Marlin/src/HAL/HAL_ESP32/i2s.h +++ b/Marlin/src/HAL/HAL_ESP32/i2s.h @@ -21,6 +21,8 @@ */ #pragma once +#include + // current value of the outputs provided over i2s extern uint32_t i2s_port_data; diff --git a/Marlin/src/HAL/HAL_LINUX/HAL.h b/Marlin/src/HAL/HAL_LINUX/HAL.h index 1057fae995..b3cabdfe6f 100644 --- a/Marlin/src/HAL/HAL_LINUX/HAL.h +++ b/Marlin/src/HAL/HAL_LINUX/HAL.h @@ -47,16 +47,15 @@ uint8_t _getc(); //arduino: Print.h #define DEC 10 #define HEX 16 -#define OCT 8 -#define BIN 2 +#define OCT 8 +#define BIN 2 //arduino: binary.h (weird defines) #define B01 1 #define B10 2 #include "hardware/Clock.h" -#include - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" diff --git a/Marlin/src/HAL/HAL_LINUX/fastio.h b/Marlin/src/HAL/HAL_LINUX/fastio.h index 8eae771a4f..d304c4b2a2 100644 --- a/Marlin/src/HAL/HAL_LINUX/fastio.h +++ b/Marlin/src/HAL/HAL_LINUX/fastio.h @@ -25,7 +25,7 @@ * Fast I/O Routines for X86_64 */ -#include +#include "../shared/Marduino.h" #include #define SET_DIR_INPUT(IO) Gpio::setDir(IO, 1) diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h index 36357d6aea..24dea75304 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h @@ -37,18 +37,18 @@ void HAL_init(); extern "C" volatile millis_t _millis; -#include -#include -#include - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio.h" -#include #include "watchdog.h" #include "HAL_timers.h" #include "MarlinSerial.h" +#include +#include +#include + // // Default graphical display delays // diff --git a/Marlin/src/HAL/HAL_LPC1768/fastio.h b/Marlin/src/HAL/HAL_LPC1768/fastio.h index 49f8ec13c3..22bda795d0 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -33,7 +33,7 @@ * For TARGET LPC1768 */ -#include +#include "../shared/Marduino.h" #define PWM_PIN(P) true // all pins are PWM capable #define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index e851284ad5..860321aa73 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -59,17 +59,17 @@ #if HAS_GRAPHICAL_LCD -#include #include "SoftwareSPI.h" #undef SPI_SPEED #define SPI_SPEED 2 // About 2 MHz +#include #include #include #include -#include +#include uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h index d08a49587f..44cc96957b 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.h +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -28,20 +28,20 @@ // Includes // -------------------------------------------------------------------------- -#include - -#include "Arduino.h" - -#ifdef USBCON - #include -#endif - -#include "../../inc/MarlinConfigPre.h" +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio_STM32.h" #include "watchdog_STM32.h" +#include "../../inc/MarlinConfigPre.h" + +#include + +#ifdef USBCON + #include +#endif + // -------------------------------------------------------------------------- // Defines // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index 66c4cba59e..66c7ee883a 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -36,14 +36,7 @@ // Includes // -------------------------------------------------------------------------- -#include -#include -#include - -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" @@ -51,6 +44,10 @@ #include "watchdog_STM32F1.h" #include "HAL_timers_STM32F1.h" + +#include +#include + #include "../../inc/MarlinConfigPre.h" // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h index 86c1355456..bb48b3beda 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h @@ -25,7 +25,8 @@ // Includes // -------------------------------------------------------------------------- -#include "Arduino.h" +#include "../shared/Marduino.h" + #include "libmaple/sdio.h" #include "libmaple/dma.h" diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.h b/Marlin/src/HAL/HAL_STM32F4/HAL.h index c41fe05f60..6f2d22b8dd 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.h @@ -32,21 +32,21 @@ // Includes // -------------------------------------------------------------------------- -#include - -#include "Arduino.h" - -#ifdef USBCON - #include -#endif - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" #include "fastio_STM32F4.h" #include "watchdog_STM32F4.h" - #include "HAL_timers_STM32F4.h" +#include "../../inc/MarlinConfigPre.h" + +#include + +#ifdef USBCON + #include +#endif + // -------------------------------------------------------------------------- // Defines // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h index db7aa0391a..878d933653 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h @@ -34,8 +34,7 @@ #include -#include "Arduino.h" - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" @@ -44,6 +43,7 @@ #include "HAL_timers_STM32F7.h" +#include "../../inc/MarlinConfigPre.h" // -------------------------------------------------------------------------- // Defines diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h index 81b011b186..0fb1b551fc 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL.h @@ -28,14 +28,7 @@ #define CPU_32_BIT -// _BV is re-defined in Arduino.h -#undef _BV - -#include - -// Redefine sq macro defined by teensy3/wiring.h -#undef sq -#define sq(x) ((x)*(x)) +#include "../shared/Marduino.h" #include "../math_32bit.h" #include "../HAL_SPI.h" diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h index 99fc31aff5..0cd3ed8de5 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h @@ -31,15 +31,7 @@ // Includes // -------------------------------------------------------------------------- -// _BV is re-defined in Arduino.h -#undef _BV - -#include - -// Redefine sq macro defined by teensy3/wiring.h -#undef sq -#define sq(x) ((x)*(x)) - +#include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" diff --git a/Marlin/src/HAL/shared/HAL_ST7920.h b/Marlin/src/HAL/shared/HAL_ST7920.h index 9af1286c7a..bdc2b8cbb2 100644 --- a/Marlin/src/HAL/shared/HAL_ST7920.h +++ b/Marlin/src/HAL/shared/HAL_ST7920.h @@ -33,4 +33,4 @@ void ST7920_set_cmd(); void ST7920_set_dat(); void ST7920_write_byte(const uint8_t data); -#endif \ No newline at end of file +#endif diff --git a/Marlin/src/HAL/shared/Marduino.h b/Marlin/src/HAL/shared/Marduino.h new file mode 100644 index 0000000000..bb93451efc --- /dev/null +++ b/Marlin/src/HAL/shared/Marduino.h @@ -0,0 +1,50 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * HAL/shared/Marduino.h + */ + +#undef DISABLED // Redefined by ESP32 +#undef M_PI // Redefined by all +#undef _BV // Redefined by some +#undef sq // Redefined by teensy3/wiring.h + +#include // NOTE: If included earlier then this line is a NOOP + +#undef DISABLED +#define DISABLED(V...) DO(DIS,&&,V) + +#undef _BV +#define _BV(b) (1UL << (b)) + +#undef sq +#define sq(x) ((x)*(x)) + +#ifndef SBI + #define SBI(A,B) (A |= (1 << (B))) +#endif + +#ifndef CBI + #define CBI(A,B) (A &= ~(1 << (B))) +#endif diff --git a/Marlin/src/HAL/shared/servo.cpp b/Marlin/src/HAL/shared/servo.cpp index 0d276c4aa6..ec25569f9d 100644 --- a/Marlin/src/HAL/shared/servo.cpp +++ b/Marlin/src/HAL/shared/servo.cpp @@ -55,7 +55,6 @@ #if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F1) || defined(STM32F1xx) || defined(STM32F4) || defined(STM32F4xx) || defined(STM32F7xx)) -//#include #include "servo.h" #include "servo_private.h" diff --git a/Marlin/src/lcd/fontutils.h b/Marlin/src/lcd/fontutils.h index 2f4dca7dca..28921aef25 100644 --- a/Marlin/src/lcd/fontutils.h +++ b/Marlin/src/lcd/fontutils.h @@ -8,9 +8,10 @@ */ #pragma once -#include -#include +#include "../HAL/shared/Marduino.h" #include "../core/macros.h" + +#include #include // wchar_t #include // uint32_t diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index f7381c1d14..3fd483a79f 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -746,6 +746,7 @@ void MarlinUI::update() { refresh(); init_lcd(); // May revive the LCD if static electricity killed it + ms = millis(); next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; // delay LCD update until after SD activity completes } diff --git a/Marlin/src/libs/duration_t.h b/Marlin/src/libs/duration_t.h index b446f4b496..1eb0b03984 100644 --- a/Marlin/src/libs/duration_t.h +++ b/Marlin/src/libs/duration_t.h @@ -21,7 +21,7 @@ */ #pragma once -#include +#include "../HAL/shared/Marduino.h" struct duration_t { /** diff --git a/Marlin/src/libs/softspi.h b/Marlin/src/libs/softspi.h index 819567df81..e986922c83 100644 --- a/Marlin/src/libs/softspi.h +++ b/Marlin/src/libs/softspi.h @@ -1,17 +1,36 @@ -// https://github.com/niteris/ArduinoSoftSpi +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once -#include +// +// Based on https://github.com/niteris/ArduinoSoftSpi +// + +#include "../HAL/shared/Marduino.h" #ifndef FORCE_INLINE #define FORCE_INLINE inline __attribute__((always_inline)) #endif -#ifndef _BV - #define _BV(B) (1 << (B)) - #define SBI(A,B) (A |= (1 << (B))) - #define CBI(A,B) (A &= ~(1 << (B))) -#endif - #define nop __asm__ volatile ("nop") // NOP for timing #ifdef __arm__ diff --git a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h index d9def846c2..5a4fa42354 100644 --- a/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h +++ b/Marlin/src/pins/pins_MIGHTYBOARD_REVE.h @@ -271,7 +271,7 @@ // Check if all pins are defined in mega/pins_arduino.h -#include +//#include static_assert(NUM_DIGITAL_PINS > MAX_PIN, "add missing pins to [arduino dir]/hardware/arduino/avr/variants/mega/pins_arduino.h based on fastio.h" "to digital_pin_to_port_PGM, digital_pin_to_bit_mask_PGM, digital_pin_to_timer_PGM, NUM_DIGITAL_PINS, see below");