Browse Source

Clean up section comments

pull/1/head
Scott Lahteine 5 years ago
parent
commit
056efaba91
  1. 40
      Marlin/src/HAL/HAL_AVR/HAL.cpp
  2. 20
      Marlin/src/HAL/HAL_AVR/HAL.h
  3. 4
      Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp
  4. 6
      Marlin/src/HAL/HAL_AVR/pinsDebug_plus_70.h
  5. 44
      Marlin/src/HAL/HAL_DUE/HAL.cpp
  6. 23
      Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp
  7. 37
      Marlin/src/HAL/HAL_DUE/HAL_timers_Due.cpp
  8. 20
      Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h
  9. 44
      Marlin/src/HAL/HAL_ESP32/HAL.cpp
  10. 20
      Marlin/src/HAL/HAL_ESP32/HAL.h
  11. 20
      Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp
  12. 37
      Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp
  13. 20
      Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h
  14. 4
      Marlin/src/HAL/HAL_LINUX/HAL.cpp
  15. 4
      Marlin/src/HAL/HAL_LINUX/HAL.h
  16. 8
      Marlin/src/HAL/HAL_LINUX/HAL_timers.h
  17. 8
      Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp
  18. 12
      Marlin/src/HAL/HAL_LPC1768/HAL_timers.h
  19. 41
      Marlin/src/HAL/HAL_STM32/HAL.cpp
  20. 20
      Marlin/src/HAL/HAL_STM32/HAL.h
  21. 20
      Marlin/src/HAL/HAL_STM32/HAL_spi_STM32.cpp
  22. 35
      Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.cpp
  23. 20
      Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h
  24. 12
      Marlin/src/HAL/HAL_STM32/fastio_STM32.h
  25. 46
      Marlin/src/HAL/HAL_STM32F1/HAL.cpp
  26. 20
      Marlin/src/HAL/HAL_STM32F1/HAL.h
  27. 4
      Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp
  28. 16
      Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.h
  29. 21
      Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp
  30. 36
      Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.cpp
  31. 27
      Marlin/src/HAL/HAL_STM32F1/HAL_timers_STM32F1.h
  32. 4
      Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h
  33. 52
      Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp
  34. 44
      Marlin/src/HAL/HAL_STM32F4/HAL.cpp
  35. 20
      Marlin/src/HAL/HAL_STM32F4/HAL.h
  36. 20
      Marlin/src/HAL/HAL_STM32F4/HAL_spi_STM32F4.cpp
  37. 36
      Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.cpp
  38. 20
      Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h
  39. 4
      Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h
  40. 52
      Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp
  41. 44
      Marlin/src/HAL/HAL_STM32F7/HAL.cpp
  42. 20
      Marlin/src/HAL/HAL_STM32F7/HAL.h
  43. 20
      Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp
  44. 37
      Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp
  45. 20
      Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h
  46. 8
      Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h
  47. 8
      Marlin/src/HAL/HAL_TEENSY35_36/HAL.h
  48. 8
      Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h
  49. 42
      Marlin/src/HAL/shared/I2cEeprom.cpp
  50. 4
      buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.cpp
  51. 2
      buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp

40
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

20
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 <avr/interrupt.h>
#include <avr/io.h>
// --------------------------------------------------------------------------
// ------------------------
// 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);

4
Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp

@ -31,10 +31,6 @@
#ifdef __AVR__
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../../inc/MarlinConfig.h"
void spiBegin(void) {

6
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

44
Marlin/src/HAL/HAL_DUE/HAL.cpp

@ -25,53 +25,21 @@
#ifdef ARDUINO_ARCH_SAM
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../../inc/MarlinConfig.h"
#include "HAL.h"
#include <Wire.h>
#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);

23
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) {

37
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

20
Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h

@ -26,15 +26,11 @@
* For ARDUINO_ARCH_SAM
*/
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
// --------------------------------------------------------------------------
// ------------------------
// 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);

44
Marlin/src/HAL/HAL_ESP32/HAL.cpp

@ -22,10 +22,6 @@
#ifdef ARDUINO_ARCH_ESP32
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "HAL.h"
#include <rom/rtc.h>
#include <driver/adc.h>
@ -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) {

20
Marlin/src/HAL/HAL_ESP32/HAL.h

@ -24,10 +24,6 @@
#define CPU_32_BIT
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#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);

20
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 <pins_arduino.h>
@ -34,28 +30,28 @@
#include "../../core/macros.h"
#include <SPI.h>
// --------------------------------------------------------------------------
// ------------------------
// 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)

37
Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.cpp

@ -22,10 +22,6 @@
#ifdef ARDUINO_ARCH_ESP32
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdio.h>
#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;

20
Marlin/src/HAL/HAL_ESP32/HAL_timers_ESP32.h

@ -21,10 +21,6 @@
*/
#pragma once
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#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);

4
Marlin/src/HAL/HAL_LINUX/HAL.cpp

@ -47,9 +47,9 @@ int freeMemory() {
return 0;
}
// --------------------------------------------------------------------------
// ------------------------
// ADC
// --------------------------------------------------------------------------
// ------------------------
void HAL_adc_init(void) {

4
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 <iostream>

8
Marlin/src/HAL/HAL_LINUX/HAL_timers.h

@ -24,15 +24,11 @@
* HAL timers for Linux X86_64
*/
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
// --------------------------------------------------------------------------
// ------------------------
// Defines
// --------------------------------------------------------------------------
// ------------------------
#define FORCE_INLINE __attribute__((always_inline)) inline

8
Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp

@ -49,15 +49,11 @@
#ifdef TARGET_LPC1768
#include "../../inc/MarlinConfig.h"
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <SPI.h>
// --------------------------------------------------------------------------
// ------------------------
// Public functions
// --------------------------------------------------------------------------
// ------------------------
#if ENABLED(LPC_SOFTWARE_SPI)
#include "SoftwareSPI.h"

12
Marlin/src/HAL/HAL_LPC1768/HAL_timers.h

@ -25,10 +25,6 @@
* HAL For LPC1768
*/
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#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);

41
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);

20
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 <USBSerial.h>
#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__

20
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 <SPI.h>
// --------------------------------------------------------------------------
// ------------------------
// 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

35
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 };

20
Marlin/src/HAL/HAL_STM32/HAL_timers_STM32.h

@ -21,16 +21,12 @@
*/
#pragma once
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#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);

12
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))

46
Marlin/src/HAL/HAL_STM32F1/HAL.cpp

@ -27,22 +27,14 @@
#ifdef __STM32F1__
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "HAL.h"
#include "../../inc/MarlinConfig.h"
#include <STM32ADC.h>
// --------------------------------------------------------------------------
// 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

20
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()

4
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); }

16
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);

21
Marlin/src/HAL/HAL_STM32F1/HAL_spi_STM32F1.cpp

@ -32,34 +32,25 @@
#ifdef __STM32F1__
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../../inc/MarlinConfig.h"
#include <SPI.h>
// --------------------------------------------------------------------------
// 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

36
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

27
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 <stdint.h>
#include <libmaple/timer.h>
// --------------------------------------------------------------------------
// ------------------------
// 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);
// --------------------------------------------------------------------------
// Public Variables
// --------------------------------------------------------------------------
/*
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);

4
Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h

@ -45,9 +45,9 @@
******************************************************************************/
#pragma once
// --------------------------------------------------------------------------
// ------------------------
// Includes
// --------------------------------------------------------------------------
// ------------------------
#include "../../../inc/MarlinConfig.h"
#include "../HAL.h"

52
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) {

44
Marlin/src/HAL/HAL_STM32F4/HAL.cpp

@ -23,51 +23,19 @@
#if defined(STM32GENERIC) && defined(STM32F4)
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "HAL.h"
//#include <Wire.h>
// --------------------------------------------------------------------------
// 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);

20
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 <USBSerial.h>
#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__

20
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 <pins_arduino.h>
@ -43,28 +39,28 @@
#include "../../core/macros.h"
#include <SPI.h>
// --------------------------------------------------------------------------
// ------------------------
// 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

36
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};

20
Marlin/src/HAL/HAL_STM32F4/HAL_timers_STM32F4.h

@ -21,15 +21,11 @@
*/
#pragma once
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
// --------------------------------------------------------------------------
// ------------------------
// 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);

4
Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h

@ -45,9 +45,9 @@
*****************************************************************************/
#pragma once
// --------------------------------------------------------------------------
// ------------------------
// Includes
// --------------------------------------------------------------------------
// ------------------------
#include "../../../inc/MarlinConfig.h"
#include "../HAL.h"

52
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) {

44
Marlin/src/HAL/HAL_STM32F7/HAL.cpp

@ -23,51 +23,19 @@
#ifdef STM32F7
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "HAL.h"
//#include <Wire.h>
// --------------------------------------------------------------------------
// 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);

20
Marlin/src/HAL/HAL_STM32F7/HAL.h

@ -28,10 +28,6 @@
#define vsnprintf_P vsnprintf
#endif
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
#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__

20
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 <pins_arduino.h>
@ -43,27 +39,27 @@
#include "../../core/macros.h"
#include <SPI.h>
// --------------------------------------------------------------------------
// ------------------------
// 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

37
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};

20
Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h

@ -21,15 +21,11 @@
*/
#pragma once
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
// --------------------------------------------------------------------------
// ------------------------
// 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);

8
Marlin/src/HAL/HAL_TEENSY31_32/HAL_timers_Teensy.h

@ -28,15 +28,11 @@
#pragma once
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
// --------------------------------------------------------------------------
// ------------------------
// Defines
// --------------------------------------------------------------------------
// ------------------------
#define FORCE_INLINE __attribute__((always_inline)) inline

8
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__)

8
Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h

@ -25,15 +25,11 @@
* Teensy3.6 (__MK66FX1M0__)
*/
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
// --------------------------------------------------------------------------
// ------------------------
// Defines
// --------------------------------------------------------------------------
// ------------------------
#define FORCE_INLINE __attribute__((always_inline)) inline

42
Marlin/src/HAL/shared/I2cEeprom.cpp

@ -29,50 +29,18 @@
#if ENABLED(I2C_EEPROM)
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include "../HAL.h"
#include <Wire.h>
// --------------------------------------------------------------------------
// Externals
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Local defines
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Types
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Variables
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Public Variables
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// ------------------------
// Private Variables
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Function prototypes
// --------------------------------------------------------------------------
// ------------------------
// --------------------------------------------------------------------------
// Private functions
// --------------------------------------------------------------------------
static uint8_t eeprom_device_address = 0x50;
// --------------------------------------------------------------------------
// ------------------------
// Public functions
// --------------------------------------------------------------------------
static uint8_t eeprom_device_address = 0x50;
// ------------------------
static void eeprom_init(void) {
static bool eeprom_initialized = false;

4
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" {

2
buildroot/share/PlatformIO/variants/MARLIN_F407VE/variant.cpp

@ -98,7 +98,7 @@ const PinName digitalPin[] = {
}
#endif
// ----------------------------------------------------------------------------
// ------------------------
#ifdef __cplusplus
extern "C" {

Loading…
Cancel
Save