0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-02-19 23:54:19 +00:00

🚑️ Init FastIO before anything else (#22508)

This commit is contained in:
Tanguy Pruvot 2021-08-09 04:37:27 +02:00 committed by GitHub
parent 76c10b3e02
commit ae846c2cb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 14 deletions

View file

@ -63,8 +63,6 @@ TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
// HAL initialization task // HAL initialization task
void HAL_init() { void HAL_init() {
FastIO_init();
// Ensure F_CPU is a constant expression. // Ensure F_CPU is a constant expression.
// If the compiler breaks here, it means that delay code that should compute at compile time will not work. // If the compiler breaks here, it means that delay code that should compute at compile time will not work.
// So better safe than sorry here. // So better safe than sorry here.

View file

@ -26,7 +26,7 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
GPIO_TypeDef* FastIOPortMap[LastPort + 1]; GPIO_TypeDef* FastIOPortMap[LastPort + 1] = { 0 };
void FastIO_init() { void FastIO_init() {
LOOP_L_N(i, NUM_DIGITAL_PINS) LOOP_L_N(i, NUM_DIGITAL_PINS)

View file

@ -38,6 +38,7 @@ extern GPIO_TypeDef * FastIOPortMap[];
// ------------------------ // ------------------------
void FastIO_init(); // Must be called before using fast io macros void FastIO_init(); // Must be called before using fast io macros
#define FASTIO_INIT() FastIO_init()
// ------------------------ // ------------------------
// Defines // Defines

View file

@ -19,15 +19,15 @@
#pragma once #pragma once
/** /**
* Support routines for STM32GENERIC (Maple) * Support routines for MAPLE_STM32F1
*/ */
/** /**
* Translation of routines & variables used by pinsDebug.h * Translation of routines & variables used by pinsDebug.h
*/ */
#ifndef BOARD_NR_GPIO_PINS // Only in STM32GENERIC (Maple) #ifndef BOARD_NR_GPIO_PINS // Only in MAPLE_STM32F1
#error "Expected BOARD_NR_GPIO_PINS not found" #error "Expected BOARD_NR_GPIO_PINS not found"
#endif #endif
#include "fastio.h" #include "fastio.h"

View file

@ -1131,6 +1131,10 @@ inline void tmc_standby_setup() {
* - Set Marlin to RUNNING State * - Set Marlin to RUNNING State
*/ */
void setup() { void setup() {
#ifdef FASTIO_INIT
FASTIO_INIT();
#endif
#ifdef BOARD_PREINIT #ifdef BOARD_PREINIT
BOARD_PREINIT(); // Low-level init (before serial init) BOARD_PREINIT(); // Low-level init (before serial init)
#endif #endif

View file

@ -99,19 +99,12 @@
// Avoid nozzle heat and fan start before serial init // Avoid nozzle heat and fan start before serial init
#define BOARD_OPENDRAIN_MOSFETS #define BOARD_OPENDRAIN_MOSFETS
#define BOARD_INIT_OD_PINS() { \ #define BOARD_PREINIT() { \
OUT_WRITE_OD(HEATER_0_PIN, 0); \ OUT_WRITE_OD(HEATER_0_PIN, 0); \
OUT_WRITE_OD(HEATER_BED_PIN, 0); \ OUT_WRITE_OD(HEATER_BED_PIN, 0); \
OUT_WRITE_OD(FAN_PIN, 0); \ OUT_WRITE_OD(FAN_PIN, 0); \
} }
#ifdef MAPLE_STM32F1
// Only Maple Framework allow that early
#define BOARD_PREINIT BOARD_INIT_OD_PINS
#else
#define BOARD_INIT BOARD_INIT_OD_PINS
#endif
// //
// PWM for a servo probe // PWM for a servo probe
// Other servo devices are not supported on this board! // Other servo devices are not supported on this board!