From 056efaba91d45aa466e38699648c79709c4bfa09 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 9 Jul 2019 22:30:06 -0500 Subject: [PATCH] Clean up section comments --- Marlin/src/HAL/HAL_AVR/HAL.cpp | 40 ++------------ Marlin/src/HAL/HAL_AVR/HAL.h | 20 +++---- Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp | 4 -- Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h | 6 +-- Marlin/src/HAL/HAL_DUE/HAL.cpp | 44 +++------------- Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp | 23 +++----- Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp | 37 +++---------- Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h | 20 +++---- Marlin/src/HAL/HAL_ESP32/HAL.cpp | 44 +++++----------- Marlin/src/HAL/HAL_ESP32/HAL.h | 20 +++---- Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp | 20 +++---- Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp | 37 +++---------- Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h | 20 +++---- Marlin/src/HAL/HAL_LINUX/HAL.cpp | 4 +- Marlin/src/HAL/HAL_LINUX/HAL.h | 4 -- Marlin/src/HAL/HAL_LINUX/HAL_timers.h | 8 +-- Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp | 8 +-- Marlin/src/HAL/HAL_LPC1768/HAL_timers.h | 12 ++--- Marlin/src/HAL/HAL_STM32/HAL.cpp | 41 +++------------ Marlin/src/HAL/HAL_STM32/HAL.h | 20 +++---- Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp | 20 +++---- Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp | 35 +++---------- Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h | 20 +++---- Marlin/src/HAL/HAL_STM32/fastio_STM32.h | 12 ++--- Marlin/src/HAL/HAL_STM32F1/HAL.cpp | 46 +++++++--------- Marlin/src/HAL/HAL_STM32F1/HAL.h | 20 +++---- .../src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp | 4 +- Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h | 16 +++--- .../src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp | 21 +++----- .../HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp | 36 ++----------- .../src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h | 29 ++++------- .../HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h | 4 +- Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp | 52 +++++-------------- Marlin/src/HAL/HAL_STM32F4/HAL.cpp | 44 +++------------- Marlin/src/HAL/HAL_STM32F4/HAL.h | 20 +++---- .../src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp | 20 +++---- .../HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp | 36 +++---------- .../src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h | 20 +++---- .../HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h | 4 +- Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp | 52 +++++-------------- Marlin/src/HAL/HAL_STM32F7/HAL.cpp | 44 +++------------- Marlin/src/HAL/HAL_STM32F7/HAL.h | 20 +++---- .../src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp | 20 +++---- .../HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp | 37 +++---------- .../src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h | 20 +++---- .../HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h | 8 +-- Marlin/src/HAL/HAL_TEENSY35_36/HAL.h | 8 +-- .../HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h | 8 +-- Marlin/src/HAL/shared/I2cEeprom.cpp | 44 +++------------- .../BIGTREE_GENERIC_STM32F407_5X/variant.cpp | 4 +- .../variants/MARLIN_F407VE/variant.cpp | 2 +- 51 files changed, 307 insertions(+), 851 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/HAL.cpp b/Marlin/src/HAL/HAL_AVR/HAL.cpp index adc441cb61..226dd9188a 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.cpp +++ b/Marlin/src/HAL/HAL_AVR/HAL.cpp @@ -22,50 +22,18 @@ #ifdef __AVR__ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../inc/MarlinConfig.h" #include "HAL.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ //uint8_t MCUSR; -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_init(void) { // Init Servo Pins diff --git a/Marlin/src/HAL/HAL_AVR/HAL.h b/Marlin/src/HAL/HAL_AVR/HAL.h index 763b360e98..8912b24eb4 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL.h +++ b/Marlin/src/HAL/HAL_AVR/HAL.h @@ -18,10 +18,6 @@ */ #pragma once -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../shared/Marduino.h" #include "../shared/HAL_SPI.h" #include "fastio_AVR.h" @@ -42,9 +38,9 @@ #include #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ //#define analogInputToDigitalPin(IO) IO @@ -59,9 +55,9 @@ // On AVR this is in math.h? //#define square(x) ((x)*(x)) -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef uint16_t hal_timer_t; #define HAL_TIMER_TYPE_MAX 0xFFFF @@ -71,9 +67,9 @@ typedef int8_t pin_t; #define SHARED_SERVOS HAS_SERVOS #define HAL_SERVO_LIB Servo -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ //extern uint8_t MCUSR; @@ -105,9 +101,9 @@ typedef int8_t pin_t; #endif #endif -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_init(void); diff --git a/Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp b/Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp index 5482523756..82dce1a57d 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp @@ -31,10 +31,6 @@ #ifdef __AVR__ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../inc/MarlinConfig.h" void spiBegin(void) { diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h index 2a2a7bce8a..e5bb82f226 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h @@ -47,7 +47,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM_plus_70[] = { // PORTLIST - // ------------------------------------------- + // ------------------------ PE , // PE 0 ** 0 ** USART0_RX PE , // PE 1 ** 1 ** USART0_TX PE , // PE 4 ** 2 ** PWM2 @@ -140,7 +140,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM_plus_70[] = { const uint8_t PROGMEM digital_pin_to_bit_mask_PGM_plus_70[] = { // PIN IN PORT - // ------------------------------------------- + // ------------------------ _BV( 0 ) , // PE 0 ** 0 ** USART0_RX _BV( 1 ) , // PE 1 ** 1 ** USART0_TX _BV( 4 ) , // PE 4 ** 2 ** PWM2 @@ -234,7 +234,7 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM_plus_70[] = { const uint8_t PROGMEM digital_pin_to_timer_PGM_plus_70[] = { // TIMERS - // ------------------------------------------- + // ------------------------ NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX TIMER3B , // PE 4 ** 2 ** PWM2 diff --git a/Marlin/src/HAL/HAL_DUE/HAL.cpp b/Marlin/src/HAL/HAL_DUE/HAL.cpp index dfe42f6ca3..c98dbbc07c 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL.cpp @@ -25,53 +25,21 @@ #ifdef ARDUINO_ARCH_SAM -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../inc/MarlinConfig.h" #include "HAL.h" #include #include "usb/usb_task.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ // HAL initialization task void HAL_init(void) { @@ -122,9 +90,9 @@ int freeMemory() { return (int)&free_memory - (heap_end ? heap_end : (int)&_ebss); } -// -------------------------------------------------------------------------- +// ------------------------ // ADC -// -------------------------------------------------------------------------- +// ------------------------ void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); diff --git a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp index 82eae9b01e..94f90670c0 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp @@ -37,27 +37,18 @@ #ifdef ARDUINO_ARCH_SAM -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../inc/MarlinConfig.h" #include "../shared/Delay.h" -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ #if EITHER(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI) - // -------------------------------------------------------------------------- - // software SPI - // -------------------------------------------------------------------------- + // ------------------------ + // Software SPI + // ------------------------ // Make sure GCC optimizes this file. // Note that this line triggers a bug in GCC which is fixed by casting. @@ -551,9 +542,9 @@ // slave selects controlled by SPI controller // doesn't support changing SPI speeds for SD card - // -------------------------------------------------------------------------- + // ------------------------ // hardware SPI - // -------------------------------------------------------------------------- + // ------------------------ static bool spiInitialized = false; void spiInit(uint8_t spiRate) { diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp index df51c22d60..64ca0ac0f1 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp @@ -28,36 +28,23 @@ #ifdef ARDUINO_ARCH_SAM -// -------------------------------------------------------------------------- +// ------------------------ // Includes -// -------------------------------------------------------------------------- +// ------------------------ #include "../../inc/MarlinConfig.h" #include "HAL.h" #include "HAL_timers_Due.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ #define NUM_HARDWARE_TIMERS 9 -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- +// ------------------------ const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = { { TC0, 0, TC0_IRQn, 3}, // 0 - [servo timer5] @@ -71,17 +58,9 @@ const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = { { TC2, 2, TC8_IRQn, 0}, // 8 }; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ /* Timer_clock1: Prescaler 2 -> 42MHz diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h index 2c758f3a11..ba1eccb2f9 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h @@ -26,15 +26,11 @@ * For ARDUINO_ARCH_SAM */ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define FORCE_INLINE __attribute__((always_inline)) inline @@ -69,9 +65,9 @@ typedef uint32_t hal_timer_t; #define HAL_TEMP_TIMER_ISR() void TC4_Handler() #define HAL_TONE_TIMER_ISR() void TC6_Handler() -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef struct { Tc *pTimerRegs; @@ -80,15 +76,15 @@ typedef struct { uint8_t priority; } tTimerConfig; -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ extern const tTimerConfig TimerConfig[]; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.cpp b/Marlin/src/HAL/HAL_ESP32/HAL.cpp index 299aee46fe..f37a3a4ef8 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL.cpp @@ -22,10 +22,6 @@ #ifdef ARDUINO_ARCH_ESP32 -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include #include @@ -48,49 +44,33 @@ #endif #endif -// -------------------------------------------------------------------------- +// ------------------------ // Externals -// -------------------------------------------------------------------------- +// ------------------------ portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED; -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ #define V_REF 1100 -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- +// ------------------------ esp_adc_cal_characteristics_t characteristics; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_init(void) { i2s_init(); @@ -128,9 +108,9 @@ void _delay_ms(int delay_ms) { delay(delay_ms); } // return free memory between end of heap (or end bss) and whatever is current int freeMemory() { return ESP.getFreeHeap(); } -// -------------------------------------------------------------------------- +// ------------------------ // ADC -// -------------------------------------------------------------------------- +// ------------------------ #define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL adc1_channel_t get_channel(int pin) { diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index 0fc1d71bc4..5327a8789e 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -24,10 +24,6 @@ #define CPU_32_BIT -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include "../shared/Marduino.h" @@ -43,9 +39,9 @@ #include "WebSocketSerial.h" #include "FlushableHardwareSerial.h" -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ extern portMUX_TYPE spinlock; @@ -69,24 +65,24 @@ extern portMUX_TYPE spinlock; #undef pgm_read_ptr #define pgm_read_ptr(addr) (*(addr)) -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef int16_t pin_t; #define HAL_SERVO_LIB Servo -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ /** result of last ADC conversion */ extern uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ // clear reset reason void HAL_clear_reset_source (void); diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp index 67d7e25972..85c0879712 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp @@ -23,10 +23,6 @@ #ifdef ARDUINO_ARCH_ESP32 -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "../shared/HAL_SPI.h" #include @@ -34,28 +30,28 @@ #include "../../core/macros.h" #include -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ static SPISettings spiConfig; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ #if ENABLED(SOFTWARE_SPI) - // -------------------------------------------------------------------------- + // ------------------------ // Software SPI - // -------------------------------------------------------------------------- + // ------------------------ #error "Software SPI not supported for ESP32. Use Hardware SPI." #else -// -------------------------------------------------------------------------- +// ------------------------ // Hardware SPI -// -------------------------------------------------------------------------- +// ------------------------ void spiBegin() { #if !PIN_EXISTS(SS) diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp index fb95e36e27..27bd42bdf8 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp @@ -22,10 +22,6 @@ #ifdef ARDUINO_ARCH_ESP32 -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include "esp_types.h" #include "soc/timer_group_struct.h" @@ -36,28 +32,15 @@ #include "HAL_timers_ESP32.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ #define NUM_HARDWARE_TIMERS 4 -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- +// ------------------------ static timg_dev_t *TG[2] = {&TIMERG0, &TIMERG1}; @@ -68,17 +51,9 @@ const tTimerConfig TimerConfig [NUM_HARDWARE_TIMERS] = { { TIMER_GROUP_1, TIMER_1, 1, nullptr }, // 3 }; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void IRAM_ATTR timer_group0_isr(void *para) { const int timer_idx = (int)para; diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h index 1a05c04a08..d3da0aef80 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h @@ -21,10 +21,6 @@ */ #pragma once -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include "driver/timer.h" @@ -33,9 +29,9 @@ #include "../../inc/MarlinConfig.h" #include "../../pins/pins.h" -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ // #define FORCE_INLINE __attribute__((always_inline)) inline @@ -81,9 +77,9 @@ extern "C" void tempTC_Handler(void); extern "C" void stepTC_Handler(void); -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef struct { timer_group_t group; @@ -92,15 +88,15 @@ typedef struct { void (*fn)(void); } tTimerConfig; -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ extern const tTimerConfig TimerConfig[]; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_timer_start (const uint8_t timer_num, uint32_t frequency); void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t count); diff --git a/Marlin/src/HAL/HAL_LINUX/HAL.cpp b/Marlin/src/HAL/HAL_LINUX/HAL.cpp index 854d7247f6..0251e2e4e6 100644 --- a/Marlin/src/HAL/HAL_LINUX/HAL.cpp +++ b/Marlin/src/HAL/HAL_LINUX/HAL.cpp @@ -47,9 +47,9 @@ int freeMemory() { return 0; } -// -------------------------------------------------------------------------- +// ------------------------ // ADC -// -------------------------------------------------------------------------- +// ------------------------ void HAL_adc_init(void) { diff --git a/Marlin/src/HAL/HAL_LINUX/HAL.h b/Marlin/src/HAL/HAL_LINUX/HAL.h index a87e400394..fbbce96dbd 100644 --- a/Marlin/src/HAL/HAL_LINUX/HAL.h +++ b/Marlin/src/HAL/HAL_LINUX/HAL.h @@ -23,10 +23,6 @@ #define CPU_32_BIT -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #define F_CPU 100000000 #define SystemCoreClock F_CPU #include diff --git a/Marlin/src/HAL/HAL_LINUX/HAL_timers.h b/Marlin/src/HAL/HAL_LINUX/HAL_timers.h index b7d0f9b2da..e883cb0150 100644 --- a/Marlin/src/HAL/HAL_LINUX/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LINUX/HAL_timers.h @@ -24,15 +24,11 @@ * HAL timers for Linux X86_64 */ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define FORCE_INLINE __attribute__((always_inline)) inline diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp index 78f1672dcc..5652db988b 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp @@ -49,15 +49,11 @@ #ifdef TARGET_LPC1768 #include "../../inc/MarlinConfig.h" -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ #if ENABLED(LPC_SOFTWARE_SPI) #include "SoftwareSPI.h" diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h index 1d68ee8478..29cb8c437e 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h @@ -25,10 +25,6 @@ * HAL For LPC1768 */ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include "../../core/macros.h" @@ -51,9 +47,9 @@ #define SBIT_MR3R 10 #define SBIT_MR3S 11 -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define _HAL_TIMER(T) _CAT(LPC_TIM, T) #define _HAL_TIMER_IRQ(T) TIMER##T##_IRQn @@ -95,9 +91,9 @@ typedef uint32_t hal_timer_t; #define STEP_TIMER _HAL_TIMER(STEP_TIMER_NUM) #define TEMP_TIMER _HAL_TIMER(TEMP_TIMER_NUM) -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_timer_init(void); void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); diff --git a/Marlin/src/HAL/HAL_STM32/HAL.cpp b/Marlin/src/HAL/HAL_STM32/HAL.cpp index 400c8a5e36..dc21069dba 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL.cpp @@ -38,44 +38,15 @@ #endif #endif -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- - +// ------------------------ // Needed for DELAY_NS() / DELAY_US() on CORTEX-M7 #if (defined(__arm__) || defined(__thumb__)) && __CORTEX_M == 7 @@ -129,9 +100,9 @@ extern "C" { extern unsigned int _ebss; // end of bss section } -// -------------------------------------------------------------------------- +// ------------------------ // ADC -// -------------------------------------------------------------------------- +// ------------------------ void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h index a7d607e764..051cab46d9 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.h +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -24,10 +24,6 @@ #define CPU_32_BIT -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../core/macros.h" #include "../shared/Marduino.h" #include "../shared/math_32bit.h" @@ -43,9 +39,9 @@ #include #endif -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #if SERIAL_PORT == 0 #error "Serial port 0 does not exist" @@ -128,24 +124,24 @@ #undef pgm_read_ptr #define pgm_read_ptr(addr) (*(addr)) -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef int16_t pin_t; #define HAL_SERVO_LIB libServo -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ /** result of last ADC conversion */ extern uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ // Memory related #define __bss_end __bss_end__ diff --git a/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp index cde28e7e14..b2df7a16a7 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp @@ -23,35 +23,31 @@ #if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../inc/MarlinConfig.h" #include -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ static SPISettings spiConfig; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ #if ENABLED(SOFTWARE_SPI) - // -------------------------------------------------------------------------- + // ------------------------ // Software SPI - // -------------------------------------------------------------------------- + // ------------------------ #error "Software SPI not supported for STM32. Use Hardware SPI." #else -// -------------------------------------------------------------------------- +// ------------------------ // Hardware SPI -// -------------------------------------------------------------------------- +// ------------------------ /** * VGPV SPI speed start and PCLK2/2, by default 108/2 = 54Mhz diff --git a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp index f309b43f3a..f8e472f885 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp @@ -22,50 +22,27 @@ #if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "HAL_timers_STM32.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ #define NUM_HARDWARE_TIMERS 2 //#define PRESCALER 1 -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- +// ------------------------ stm32f4_timer_t TimerHandle[NUM_HARDWARE_TIMERS]; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ bool timers_initialized[NUM_HARDWARE_TIMERS] = { false }; diff --git a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h index 8cdea0a81e..38f1aa332f 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h @@ -21,16 +21,12 @@ */ #pragma once -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include "../../inc/MarlinConfig.h" -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define FORCE_INLINE __attribute__((always_inline)) inline @@ -128,21 +124,21 @@ extern void Temp_Handler(stimer_t *htim); #define HAL_STEP_TIMER_ISR() void Step_Handler(stimer_t *htim) #define HAL_TEMP_TIMER_ISR() void Temp_Handler(stimer_t *htim) -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef stimer_t stm32f4_timer_t; -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ extern stm32f4_timer_t TimerHandle[]; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); void HAL_timer_enable_interrupt(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h index fd97fd206c..e4bac7a061 100644 --- a/Marlin/src/HAL/HAL_STM32/fastio_STM32.h +++ b/Marlin/src/HAL/HAL_STM32/fastio_STM32.h @@ -27,21 +27,21 @@ * These use GPIO register access for fast port manipulation. */ -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ extern GPIO_TypeDef * FastIOPortMap[]; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void FastIO_init(); // Must be called before using fast io macros -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define _BV32(b) (1UL << (b)) diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp index 16a2a012b6..69ac127a4e 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.cpp @@ -27,22 +27,14 @@ #ifdef __STM32F1__ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "../../inc/MarlinConfig.h" #include -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ #define __I #define __IO volatile @@ -70,13 +62,10 @@ __IO uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ } SCB_Type; -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ + #define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ @@ -89,18 +78,19 @@ #define SCB_AIRCR_PRIGROUP_Pos 8 /*!< SCB AIRCR: PRIGROUP Position */ #define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ + #ifdef SERIAL_USB USBSerial SerialUSB; #endif uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- +// ------------------------ STM32ADC adc(ADC1); uint8_t adc_pins[] = { @@ -166,13 +156,13 @@ enum TEMP_PINS : char { uint16_t HAL_adc_results[ADC_PIN_COUNT]; -// -------------------------------------------------------------------------- +// ------------------------ // Function prototypes -// -------------------------------------------------------------------------- +// ------------------------ -// -------------------------------------------------------------------------- +// ------------------------ // Private functions -// -------------------------------------------------------------------------- +// ------------------------ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) { uint32_t reg_value; uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07); /* only values 0..7 are used */ @@ -185,9 +175,9 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) { SCB->AIRCR = reg_value; } -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ // // Leave PA11/PA12 intact if USBSerial is not used @@ -263,9 +253,9 @@ extern "C" { } */ -// -------------------------------------------------------------------------- +// ------------------------ // ADC -// -------------------------------------------------------------------------- +// ------------------------ // Init the AD in continuous capture mode void HAL_adc_init(void) { // configure the ADC diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index 3f33e3ec1a..5c6426538f 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -32,10 +32,6 @@ #define vsnprintf_P vsnprintf #endif -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../core/macros.h" #include "../shared/Marduino.h" #include "../shared/math_32bit.h" @@ -51,9 +47,9 @@ #include "../../inc/MarlinConfigPre.h" -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #ifdef SERIAL_USB #define UsbSerial Serial @@ -156,22 +152,22 @@ void HAL_init(void); #define RST_SOFTWARE 32 #define RST_BACKUP 64 -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef int8_t pin_t; -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ /** result of last ADC conversion */ extern uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ // Disable interrupts #define cli() noInterrupts() diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp index 7dd1767d2c..24cf6c7676 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp @@ -167,9 +167,9 @@ bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) { inline uint32_t SDIO_GetCardState(void) { return SDIO_CmdSendStatus(SdCard.RelCardAdd << 16U) ? (SDIO_GetResponse(SDIO_RESP1) >> 9U) & 0x0FU : SDIO_CARD_ERROR; } -// -------------------------------------------------------------------------- +// ------------------------ // SD Commands and Responses -// -------------------------------------------------------------------------- +// ------------------------ void SDIO_SendCommand(uint16_t command, uint32_t argument) { SDIO->ARG = argument; SDIO->CMD = (uint32_t)(SDIO_CMD_CPSMEN | command); } uint8_t SDIO_GetCommandResponse(void) { return (uint8_t)(SDIO->RESPCMD); } diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h index 2d4eb5b879..c69f0872bb 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h @@ -21,18 +21,14 @@ */ #pragma once -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../shared/Marduino.h" #include "libmaple/sdio.h" #include "libmaple/dma.h" -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define SDMMC_CMD_GO_IDLE_STATE ((uint8_t)0) /* Resets the SD memory card. */ #define SDMMC_CMD_ALL_SEND_CID ((uint8_t)2) /* Asks any card connected to the host to send the CID numbers on the CMD line. */ @@ -106,9 +102,9 @@ #define SDIO_CLOCK 18000000 /* 18 MHz */ -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef struct { uint32_t CardType; // Card Type @@ -121,9 +117,9 @@ typedef struct { uint32_t LogBlockSize; // Logical block size in bytes } SDIO_CardInfoTypeDef; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ inline uint32_t SDIO_GetCardState(void); diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp index a43a1b4194..21979c1052 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp @@ -32,34 +32,25 @@ #ifdef __STM32F1__ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../../inc/MarlinConfig.h" #include - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ #if ENABLED(SOFTWARE_SPI) - // -------------------------------------------------------------------------- + // ------------------------ // Software SPI - // -------------------------------------------------------------------------- + // ------------------------ #error "Software SPI not supported for STM32F1. Use hardware SPI." #else -// -------------------------------------------------------------------------- +// ------------------------ // Hardware SPI -// -------------------------------------------------------------------------- +// ------------------------ /** * VGPV SPI speed start and F_CPU/2, by default 72/2 = 36Mhz diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp index 8d071dd9c0..5313064a3b 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp @@ -26,45 +26,17 @@ #ifdef __STM32F1__ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "HAL_timers_STM32F1.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ /** * Timer_clock1: Prescaler 2 -> 36 MHz diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h index 39241bcb8a..c114fe5ed4 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h @@ -25,16 +25,12 @@ * HAL for stm32duino.com based on Libmaple and compatible (STM32F1) */ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ /** * TODO: Check and confirm what timer we will use for each Temps and stepper driving. @@ -96,21 +92,16 @@ timer_dev* get_timer_dev(int number); extern "C" void tempTC_Handler(void); extern "C" void stepTC_Handler(void); -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- -/* -static HardwareTimer StepperTimer(STEP_TIMER_NUM); -static HardwareTimer TempTimer(TEMP_TIMER_NUM); -*/ -// -------------------------------------------------------------------------- +// ------------------------ + +//static HardwareTimer StepperTimer(STEP_TIMER_NUM); +//static HardwareTimer TempTimer(TEMP_TIMER_NUM); + +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); void HAL_timer_enable_interrupt(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h index 835c94de90..69852e3bc9 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h @@ -45,9 +45,9 @@ ******************************************************************************/ #pragma once -// -------------------------------------------------------------------------- +// ------------------------ // Includes -// -------------------------------------------------------------------------- +// ------------------------ #include "../../../inc/MarlinConfig.h" #include "../HAL.h" diff --git a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp index 5cd41bd30d..c41366319c 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp @@ -28,58 +28,30 @@ #if ENABLED(EEPROM_SETTINGS) && NONE(I2C_EEPROM, SPI_EEPROM) -// -------------------------------------------------------------------------- +// ------------------------ // Includes -// -------------------------------------------------------------------------- +// ------------------------ #include "HAL.h" #include "EEPROM_Emul/eeprom_emul.h" - -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- -static bool eeprom_initialized = false; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public functions -// -------------------------------------------------------------------------- +// ------------------------ // FLASH_FLAG_PGSERR (Programming Sequence Error) was renamed to // FLASH_FLAG_ERSERR (Erasing Sequence Error) in STM32F4 // #define FLASH_FLAG_PGSERR FLASH_FLAG_ERSERR -// -------------------------------------------------------------------------- -// EEPROM -// -------------------------------------------------------------------------- +// ------------------------ +// Private Variables +// ------------------------ +static bool eeprom_initialized = false; + +// ------------------------ +// Public functions +// ------------------------ void eeprom_init() { if (!eeprom_initialized) { diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp index 3fa2aa2250..a516c0e42d 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp @@ -23,51 +23,19 @@ #if defined(STM32GENERIC) && defined(STM32F4) -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" //#include -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ /* VGPV Done with defines // disable interrupts @@ -118,9 +86,9 @@ extern "C" { } */ -// -------------------------------------------------------------------------- +// ------------------------ // ADC -// -------------------------------------------------------------------------- +// ------------------------ void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.h b/Marlin/src/HAL/HAL_STM32F4/HAL.h index 44fb909598..0812761340 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.h @@ -28,10 +28,6 @@ #define vsnprintf_P vsnprintf #endif -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" @@ -47,9 +43,9 @@ #include #endif -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ //Serial override //extern HalSerial usb_serial; @@ -136,24 +132,24 @@ #undef pgm_read_ptr #define pgm_read_ptr(addr) (*(addr)) -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef int8_t pin_t; #define HAL_SERVO_LIB libServo -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ /** result of last ADC conversion */ extern uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ // Memory related #define __bss_end __bss_end__ diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp index 315995c016..dfbb1f4fdb 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp @@ -32,10 +32,6 @@ #if defined(STM32GENERIC) && defined(STM32F4) -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "../shared/HAL_SPI.h" #include @@ -43,28 +39,28 @@ #include "../../core/macros.h" #include -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ static SPISettings spiConfig; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ #if ENABLED(SOFTWARE_SPI) - // -------------------------------------------------------------------------- + // ------------------------ // Software SPI - // -------------------------------------------------------------------------- + // ------------------------ #error "Software SPI not supported for STM32F4. Use hardware SPI." #else -// -------------------------------------------------------------------------- +// ------------------------ // Hardware SPI -// -------------------------------------------------------------------------- +// ------------------------ /** * VGPV SPI speed start and F_CPU/2, by default 72/2 = 36Mhz diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp index 8f1d2603ee..71ceca91d2 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp @@ -22,52 +22,28 @@ #if defined(STM32GENERIC) && defined(STM32F4) -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "HAL_timers_STM32F4.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ #define NUM_HARDWARE_TIMERS 2 #define STEP_TIMER_IRQ_ID TIM5_IRQn #define TEMP_TIMER_IRQ_ID TIM7_IRQn //#define PRESCALER 1 -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- +// ------------------------ stm32f4_timer_t TimerHandle[NUM_HARDWARE_TIMERS]; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ bool timers_initialized[NUM_HARDWARE_TIMERS] = {false}; diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h index 30161bfc4c..ed9ac49e84 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h @@ -21,15 +21,11 @@ */ #pragma once -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define FORCE_INLINE __attribute__((always_inline)) inline @@ -75,9 +71,9 @@ #endif -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ #ifdef STM32GENERIC typedef struct { @@ -89,15 +85,15 @@ typedef stimer_t stm32f4_timer_t; #endif -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ extern stm32f4_timer_t TimerHandle[]; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); void HAL_timer_enable_interrupt(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h index 8cffdbef77..392e44d3d5 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h @@ -45,9 +45,9 @@ *****************************************************************************/ #pragma once -// -------------------------------------------------------------------------- +// ------------------------ // Includes -// -------------------------------------------------------------------------- +// ------------------------ #include "../../../inc/MarlinConfig.h" #include "../HAL.h" diff --git a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp index a612b89538..2773d9c219 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp @@ -26,58 +26,30 @@ #include "../../inc/MarlinConfig.h" -// -------------------------------------------------------------------------- +// ------------------------ // Includes -// -------------------------------------------------------------------------- +// ------------------------ #include "HAL.h" #include "EEPROM_Emul/eeprom_emul.h" - -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- -static bool eeprom_initialized = false; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public functions -// -------------------------------------------------------------------------- +// ------------------------ // FLASH_FLAG_PGSERR (Programming Sequence Error) was renamed to // FLASH_FLAG_ERSERR (Erasing Sequence Error) in STM32F7 #define FLASH_FLAG_PGSERR FLASH_FLAG_ERSERR -// -------------------------------------------------------------------------- -// EEPROM -// -------------------------------------------------------------------------- +// ------------------------ +// Private Variables +// ------------------------ +static bool eeprom_initialized = false; + +// ------------------------ +// Public functions +// ------------------------ void eeprom_init() { if (!eeprom_initialized) { diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp index e266eabf46..7a7cd900cc 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp @@ -23,51 +23,19 @@ #ifdef STM32F7 -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" //#include -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- -// Private Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ /* VGPV Done with defines // disable interrupts @@ -124,9 +92,9 @@ extern "C" { } */ -// -------------------------------------------------------------------------- +// ------------------------ // ADC -// -------------------------------------------------------------------------- +// ------------------------ void HAL_adc_start_conversion(const uint8_t adc_pin) { HAL_adc_result = analogRead(adc_pin); diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h index be99165111..86a9b69cd0 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h @@ -28,10 +28,6 @@ #define vsnprintf_P vsnprintf #endif -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include "../shared/Marduino.h" @@ -45,9 +41,9 @@ #include "../../inc/MarlinConfigPre.h" -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ //Serial override //extern HalSerial usb_serial; @@ -125,22 +121,22 @@ #undef pgm_read_ptr #define pgm_read_ptr(addr) (*(addr)) -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef int8_t pin_t; -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ /** result of last ADC conversion */ extern uint16_t HAL_adc_result; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ // Memory related #define __bss_end __bss_end__ diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp index 294d90414e..0592c05385 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp @@ -32,10 +32,6 @@ #ifdef STM32F7 -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "../shared/HAL_SPI.h" #include @@ -43,27 +39,27 @@ #include "../../core/macros.h" #include -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ static SPISettings spiConfig; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ #if ENABLED(SOFTWARE_SPI) - // -------------------------------------------------------------------------- + // ------------------------ // Software SPI - // -------------------------------------------------------------------------- + // ------------------------ #error "Software SPI not supported for STM32F7. Use hardware SPI." #else -// -------------------------------------------------------------------------- +// ------------------------ // Hardware SPI -// -------------------------------------------------------------------------- +// ------------------------ /** * VGPV SPI speed start and F_CPU/2, by default 72/2 = 36Mhz diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp index df4d9c07d2..e642e64c8a 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp @@ -22,51 +22,26 @@ #ifdef STM32F7 -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "HAL.h" #include "HAL_timers_STM32F7.h" -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Local defines -// -------------------------------------------------------------------------- +// ------------------------ #define NUM_HARDWARE_TIMERS 2 //#define PRESCALER 1 -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- +// ------------------------ tTimerConfig timerConfig[NUM_HARDWARE_TIMERS]; -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ bool timers_initialized[NUM_HARDWARE_TIMERS] = {false}; diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h index 01fb02d178..7b3b837c11 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h @@ -21,15 +21,11 @@ */ #pragma once -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define FORCE_INLINE __attribute__((always_inline)) inline @@ -69,9 +65,9 @@ extern void TC7_Handler(); #define HAL_STEP_TIMER_ISR() void TC5_Handler() #define HAL_TEMP_TIMER_ISR() void TC7_Handler() -// -------------------------------------------------------------------------- +// ------------------------ // Types -// -------------------------------------------------------------------------- +// ------------------------ typedef struct { TIM_HandleTypeDef timerdef; @@ -79,15 +75,15 @@ typedef struct { uint32_t callback; } tTimerConfig; -// -------------------------------------------------------------------------- +// ------------------------ // Public Variables -// -------------------------------------------------------------------------- +// ------------------------ //extern const tTimerConfig timerConfig[]; -// -------------------------------------------------------------------------- +// ------------------------ // Public functions -// -------------------------------------------------------------------------- +// ------------------------ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); void HAL_timer_enable_interrupt(const uint8_t timer_num); diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h index 8c9836d130..f6c41d6e9e 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h @@ -28,15 +28,11 @@ #pragma once -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define FORCE_INLINE __attribute__((always_inline)) inline diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h index f3a26eb5d8..4a8de159b0 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL.h @@ -27,10 +27,6 @@ #define CPU_32_BIT -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../shared/Marduino.h" #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" @@ -47,9 +43,9 @@ #define ST7920_DELAY_2 DELAY_NS(750) #define ST7920_DELAY_3 DELAY_NS(750) -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define IS_32BIT_TEENSY (defined(__MK64FX512__) || defined(__MK66FX1M0__)) #define IS_TEENSY35 defined(__MK64FX512__) diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h index 8263691947..741f27c0ba 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h @@ -25,15 +25,11 @@ * Teensy3.6 (__MK66FX1M0__) */ -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include -// -------------------------------------------------------------------------- +// ------------------------ // Defines -// -------------------------------------------------------------------------- +// ------------------------ #define FORCE_INLINE __attribute__((always_inline)) inline diff --git a/Marlin/src/HAL/shared/I2cEeprom.cpp b/Marlin/src/HAL/shared/I2cEeprom.cpp index d9faa36da0..c46ea8dff3 100644 --- a/Marlin/src/HAL/shared/I2cEeprom.cpp +++ b/Marlin/src/HAL/shared/I2cEeprom.cpp @@ -29,51 +29,19 @@ #if ENABLED(I2C_EEPROM) -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include "../HAL.h" #include -// -------------------------------------------------------------------------- -// Externals -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Local defines -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Types -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- +// ------------------------ // Private Variables -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Function prototypes -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Private functions -// -------------------------------------------------------------------------- - -// -------------------------------------------------------------------------- -// Public functions -// -------------------------------------------------------------------------- +// ------------------------ static uint8_t eeprom_device_address = 0x50; +// ------------------------ +// Public functions +// ------------------------ + static void eeprom_init(void) { static bool eeprom_initialized = false; if (!eeprom_initialized) { diff --git a/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.cpp b/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.cpp index bd33570254..8e3c92fb04 100644 --- a/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.cpp +++ b/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.cpp @@ -108,7 +108,7 @@ const PinName digitalPin[] = { PE_15, //D64 - 1:FSMC_D12 PD_8, //D65 - 1:FSMC_D13 / USART3_TX PD_9, //D66 - 1:FSMC_D14 / USART3_RX - PD_10, //D67 - 1:FSMC_D15 + PD_10, //D67 - 1:FSMC_D15 PD_11, //D68 - 1:FSMC_A16 PD_12, //D69 - 1:FSMC_A17 / TIM4_CH1 PD_13, //D70 - 1:FSMC_A18 / TIM4_CH2 @@ -220,7 +220,7 @@ const PinName digitalPin[] = { } #endif -// ---------------------------------------------------------------------------- +// ------------------------ #ifdef __cplusplus extern "C" { diff --git a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp index 01523224e1..4ec69543ba 100644 --- a/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp +++ b/buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp @@ -98,7 +98,7 @@ const PinName digitalPin[] = { } #endif -// ---------------------------------------------------------------------------- +// ------------------------ #ifdef __cplusplus extern "C" {