Clean up section comments
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,10 +31,6 @@
 | 
			
		||||
 | 
			
		||||
#ifdef __AVR__
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#include "../../inc/MarlinConfig.h"
 | 
			
		||||
 | 
			
		||||
void spiBegin(void) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -47,9 +47,9 @@ int freeMemory() {
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
// ADC
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
 | 
			
		||||
void HAL_adc_init(void) {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,10 +23,6 @@
 | 
			
		||||
 | 
			
		||||
#define CPU_32_BIT
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#define F_CPU 100000000
 | 
			
		||||
#define SystemCoreClock F_CPU
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 
 | 
			
		||||
@@ -24,15 +24,11 @@
 | 
			
		||||
 * HAL timers for Linux X86_64
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
// Defines
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
 | 
			
		||||
#define FORCE_INLINE __attribute__((always_inline)) inline
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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__
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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 };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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); }
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
*/
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
 | 
			
		||||
//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);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,9 +45,9 @@
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
#include "../../../inc/MarlinConfig.h"
 | 
			
		||||
#include "../HAL.h"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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__
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -45,9 +45,9 @@
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
#include "../../../inc/MarlinConfig.h"
 | 
			
		||||
#include "../HAL.h"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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__
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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};
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -28,15 +28,11 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
// Defines
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
 | 
			
		||||
#define FORCE_INLINE __attribute__((always_inline)) inline
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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__)
 | 
			
		||||
 
 | 
			
		||||
@@ -25,15 +25,11 @@
 | 
			
		||||
 * Teensy3.6 (__MK66FX1M0__)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
// Defines
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// ------------------------
 | 
			
		||||
 | 
			
		||||
#define FORCE_INLINE __attribute__((always_inline)) inline
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -29,51 +29,19 @@
 | 
			
		||||
 | 
			
		||||
#if ENABLED(I2C_EEPROM)
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// Includes
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#include "../HAL.h"
 | 
			
		||||
#include <Wire.h>
 | 
			
		||||
 | 
			
		||||
// --------------------------------------------------------------------------
 | 
			
		||||
// 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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user