Skip to content

Commit

Permalink
🏗️ Define HAL_STM32 for HAL/STM32 (#22537)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored Aug 9, 2021
1 parent 331cc5f commit 76c10b3
Show file tree
Hide file tree
Showing 34 changed files with 105 additions and 57 deletions.
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "HAL.h"
#include "usb_serial.h"
Expand Down Expand Up @@ -165,4 +167,4 @@ void HAL_SYSTICK_Callback() {
if (systick_user_callback) systick_user_callback();
}

#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/HAL_MinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfigPre.h"

Expand Down Expand Up @@ -149,4 +151,4 @@ extern "C" {
#endif

#endif // POSTMORTEM_DEBUGGING
#endif // ARDUINO_ARCH_STM32
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/HAL_SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -224,4 +226,4 @@ static SPISettings spiConfig;

#endif // SOFTWARE_SPI

#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
4 changes: 2 additions & 2 deletions Marlin/src/HAL/STM32/MarlinSPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1) && !defined(STM32H7xx)
#if defined(HAL_STM32) && !defined(STM32H7xx)

#include "MarlinSPI.h"

Expand Down Expand Up @@ -165,4 +165,4 @@ uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc)
return 1;
}

#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1 && !STM32H7xx
#endif // HAL_STM32 && !STM32H7xx
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/MarlinSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"
#include "MarlinSerial.h"
Expand Down Expand Up @@ -101,4 +103,4 @@ void MarlinSerial::_rx_complete_irq(serial_t *obj) {
}
}

#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/Sd2Card_sdio_stm32duino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -320,4 +322,4 @@ extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }

#endif // SDIO_SUPPORT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/Servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -107,4 +109,4 @@ void libServo::setInterruptPriority(uint32_t preemptPriority, uint32_t subPriori
}

#endif // HAS_SERVOS
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/eeprom_flash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -272,4 +274,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
}

#endif // FLASH_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/eeprom_sdcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

/**
* Implementation of EEPROM settings in SD Card
Expand Down Expand Up @@ -88,4 +90,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uin
}

#endif // SDCARD_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/eeprom_sram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -65,4 +67,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
}

#endif // SRAM_EEPROM_EMULATION
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/eeprom_wired.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -75,4 +77,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
}

#endif // USE_WIRED_EEPROM
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/fast_pwm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfigPre.h"

Expand Down Expand Up @@ -56,4 +58,4 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
}

#endif // NEEDS_HARDWARE_PWM
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/fastio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand All @@ -31,4 +33,4 @@ void FastIO_init() {
FastIOPortMap[STM_PORT(digitalPin[i])] = get_GPIO_Port(STM_PORT(digitalPin[i]));
}

#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/msc_sd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfigPre.h"

Expand Down Expand Up @@ -125,4 +127,4 @@ void MSC_SD_init() {
}

#endif // HAS_SD_HOST_DRIVE
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/tft/gt911.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"

#ifdef HAL_STM32

#include "../../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -199,4 +201,4 @@ bool GT911::getPoint(int16_t *x, int16_t *y) {
}

#endif // TFT_TOUCH_DEVICE_GT911
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/tft/tft_fsmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"

#ifdef HAL_STM32

#include "../../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -178,4 +180,4 @@ void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
}

#endif // HAS_FSMC_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/tft/tft_ltdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"

#ifdef HAL_STM32

#include "../../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -384,4 +386,4 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
}

#endif // HAS_LTDC_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/tft/tft_spi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"

#ifdef HAL_STM32

#include "../../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -240,4 +242,4 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
}

#endif // HAS_SPI_TFT
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/tft/xpt2046.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../../platforms.h"

#ifdef HAL_STM32

#include "../../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -167,4 +169,4 @@ uint16_t XPT2046::SoftwareIO(uint16_t data) {
}

#endif // HAS_TFT_XPT2046
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/timers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -319,4 +321,4 @@ static constexpr bool verify_no_timer_conflicts() {
// when hovering over it, making it easy to identify the conflicting timers.
static_assert(verify_no_timer_conflicts(), "One or more timer conflict detected. Examine \"timers_in_use\" to help identify conflict.");

#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
5 changes: 3 additions & 2 deletions Marlin/src/HAL/STM32/usb_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../platforms.h"

#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#ifdef HAL_STM32

#include "../../inc/MarlinConfig.h"

Expand Down Expand Up @@ -114,4 +115,4 @@ uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t b
}

#endif // USE_OTG_USB_HOST && USBHOST
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/usb_serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfigPre.h"

Expand Down Expand Up @@ -51,4 +53,4 @@ void USB_Hook_init() {
}

#endif // EMERGENCY_PARSER && USBD_USE_CDC
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
6 changes: 4 additions & 2 deletions Marlin/src/HAL/STM32/watchdog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
#include "../platforms.h"

#ifdef HAL_STM32

#include "../../inc/MarlinConfigPre.h"

Expand All @@ -46,4 +48,4 @@ void HAL_watchdog_refresh() {
}

#endif // USE_WATCHDOG
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
#endif // HAL_STM32
3 changes: 3 additions & 0 deletions Marlin/src/HAL/platforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32F1/NAME)
#elif defined(ARDUINO_ARCH_STM32)
#ifndef HAL_STM32
#define HAL_STM32
#endif
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32/NAME)
#elif defined(ARDUINO_ARCH_ESP32)
#define HAL_PATH(PATH, NAME) XSTR(PATH/ESP32/NAME)
Expand Down
Loading

0 comments on commit 76c10b3

Please sign in to comment.