Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Change HAL_PATH macro for easier HAL relocation (MarlinFirmware#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and Andy-Big committed Jul 14, 2023
1 parent 642b122 commit df0e43e
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif

#include HAL_PATH(.,HAL.h)
#include HAL_PATH(..,HAL.h)
extern MarlinHAL hal;

#define HAL_ADC_RANGE _BV(HAL_ADC_RESOLUTION)
Expand Down
26 changes: 13 additions & 13 deletions Marlin/src/HAL/platforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,34 @@
#define XSTR(V...) #V

#ifdef __AVR__
#define HAL_PATH(PATH, NAME) XSTR(PATH/AVR/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/AVR/NAME)
#elif defined(ARDUINO_ARCH_SAM)
#define HAL_PATH(PATH, NAME) XSTR(PATH/DUE/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/DUE/NAME)
#elif defined(__MK20DX256__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/TEENSY31_32/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/TEENSY31_32/NAME)
#elif defined(__MK64FX512__) || defined(__MK66FX1M0__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/TEENSY35_36/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/TEENSY35_36/NAME)
#elif defined(__IMXRT1062__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/TEENSY40_41/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/TEENSY40_41/NAME)
#elif defined(TARGET_LPC1768)
#define HAL_PATH(PATH, NAME) XSTR(PATH/LPC1768/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/LPC1768/NAME)
#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32F1/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/STM32F1/NAME)
#elif defined(ARDUINO_ARCH_STM32)
#ifndef HAL_STM32
#define HAL_STM32
#endif
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/STM32/NAME)
#elif defined(ARDUINO_ARCH_ESP32)
#define HAL_PATH(PATH, NAME) XSTR(PATH/ESP32/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/ESP32/NAME)
#elif defined(__PLAT_LINUX__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/LINUX/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/LINUX/NAME)
#elif defined(__PLAT_NATIVE_SIM__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/NATIVE_SIM/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/NATIVE_SIM/NAME)
#elif defined(__SAMD51__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/SAMD51/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/SAMD51/NAME)
#elif defined(__SAMD21__)
#define HAL_PATH(PATH, NAME) XSTR(PATH/SAMD21/NAME)
#define HAL_PATH(PATH, NAME) XSTR(PATH/HAL/SAMD21/NAME)
#else
#error "Unsupported Platform!"
#endif
8 changes: 4 additions & 4 deletions Marlin/src/inc/MarlinConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
#include "../pins/pins.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(../HAL, timers.h)
#include HAL_PATH(../HAL, spi_pins.h)
#include HAL_PATH(.., timers.h)
#include HAL_PATH(.., spi_pins.h)
#endif

#include "Conditionals_post.h"

#ifndef __MARLIN_DEPS__

#include HAL_PATH(../HAL, inc/Conditionals_post.h)
#include HAL_PATH(.., inc/Conditionals_post.h)

#include "../core/types.h" // Ahead of sanity-checks

#include "Changes.h"
#include "SanityCheck.h"
#include HAL_PATH(../HAL, inc/SanityCheck.h)
#include HAL_PATH(.., inc/SanityCheck.h)

// Include all core headers
#include "../core/language.h"
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/inc/MarlinConfigPre.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#include "Conditionals_LCD.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(../HAL, inc/Conditionals_LCD.h)
#include HAL_PATH(.., inc/Conditionals_LCD.h)
#endif

#include "../core/drivers.h"
Expand All @@ -58,5 +58,5 @@
#include "Conditionals_adv.h"

#ifndef __MARLIN_DEPS__
#include HAL_PATH(../HAL, inc/Conditionals_adv.h)
#include HAL_PATH(.., inc/Conditionals_adv.h)
#endif
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "../../../MarlinCore.h"
#include "../../../inc/MarlinConfig.h"

#include HAL_PATH(../../../HAL, tft/xpt2046.h)
#include HAL_PATH(../../.., tft/xpt2046.h)
#include "../../marlinui.h"
XPT2046 touch;

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/tft/touch.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
#endif

#if ENABLED(TFT_TOUCH_DEVICE_GT911)
#include HAL_PATH(../../HAL, tft/gt911.h)
#include HAL_PATH(../.., tft/gt911.h)
#define TOUCH_DRIVER_CLASS GT911
#elif ENABLED(TFT_TOUCH_DEVICE_XPT2046)
#include HAL_PATH(../../HAL, tft/xpt2046.h)
#include HAL_PATH(../.., tft/xpt2046.h)
#define TOUCH_DRIVER_CLASS XPT2046
#else
#error "Unknown Touch Screen Type."
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/tft_io/tft_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
#include "../../inc/MarlinConfig.h"

#if HAS_SPI_TFT
#include HAL_PATH(../../HAL, tft/tft_spi.h)
#include HAL_PATH(../.., tft/tft_spi.h)
#elif HAS_FSMC_TFT
#include HAL_PATH(../../HAL, tft/tft_fsmc.h)
#include HAL_PATH(../.., tft/tft_fsmc.h)
#elif HAS_LTDC_TFT
#include HAL_PATH(../../HAL, tft/tft_ltdc.h)
#include HAL_PATH(../.., tft/tft_ltdc.h)
#else
#error "TFT IO only supports SPI, FSMC or LTDC interface."
#endif
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/touch/touch_buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#include "../scaled_tft.h"

#if ENABLED(TFT_TOUCH_DEVICE_GT911)
#include HAL_PATH(../../HAL, tft/gt911.h)
#include HAL_PATH(../.., tft/gt911.h)
GT911 touchIO;
#elif ENABLED(TFT_TOUCH_DEVICE_XPT2046)
#include HAL_PATH(../../HAL, tft/xpt2046.h)
#include HAL_PATH(../.., tft/xpt2046.h)
XPT2046 touchIO;
#else
#error "Unknown Touch Screen Type."
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/libs/MAX31865.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

#include "../inc/MarlinConfig.h"
#include "../HAL/shared/Delay.h"
#include HAL_PATH(../HAL, MarlinSPI.h)
#include HAL_PATH(.., MarlinSPI.h)

#define MAX31865_CONFIG_REG 0x00
#define MAX31865_CONFIG_BIAS 0x80
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/libs/W25Qxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <stdint.h>

#include HAL_PATH(../HAL, MarlinSPI.h)
#include HAL_PATH(.., MarlinSPI.h)

#define W25X_WriteEnable 0x06
#define W25X_WriteDisable 0x04
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "../core/debug_out.h"

#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
#include HAL_PATH(../HAL, endstop_interrupts.h)
#include HAL_PATH(.., endstop_interrupts.h)
#endif

#if BOTH(SD_ABORT_ON_ENDSTOP_HIT, HAS_MEDIA)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/stepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3995,7 +3995,7 @@ void Stepper::report_positions() {

#else // PRINTRBOARD_G2

#include HAL_PATH(../HAL, fastio/G2_PWM.h)
#include HAL_PATH(.., fastio/G2_PWM.h)

#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/pinsDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const PinInfo pin_array[] PROGMEM = {

};

#include HAL_PATH(../HAL, pinsDebug.h) // get the correct support file for this CPU
#include HAL_PATH(.., pinsDebug.h) // get the correct support file for this CPU

#ifndef M43_NEVER_TOUCH
#define M43_NEVER_TOUCH(Q) false
Expand Down
1 change: 1 addition & 0 deletions ini/features.ini
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,4 @@ HAS_MICROSTEPS = src_filter=+<src/gcode/control/M350_M35
arduinoWebSockets=links2004/WebSockets@2.3.4
luc-github/ESP32SSDP@1.1.1
lib_ignore=ESPAsyncTCP
build_flags=-DSRCHOME=${platformio.src_dir}/src -DHALHOME=SRCHOME

0 comments on commit df0e43e

Please sign in to comment.