Browse Source

Updates to STM32F7 HAL, for completeness (#11770)

pull/1/head
Sam Lane 6 years ago
committed by Scott Lahteine
parent
commit
d783400330
  1. 9
      Marlin/src/HAL/HAL_STM32F4/HAL.h
  2. 6
      Marlin/src/HAL/HAL_STM32F7/HAL.h
  3. 2
      Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp
  4. 5
      Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp
  5. 3
      Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h
  6. 4
      Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp

9
Marlin/src/HAL/HAL_STM32F4/HAL.h

@ -124,6 +124,8 @@
#define ISRS_ENABLED() (!__get_PRIMASK()) #define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq() #define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq() #define DISABLE_ISRS() __disable_irq()
#define cli() __disable_irq()
#define sei() __enable_irq()
// On AVR this is in math.h? // On AVR this is in math.h?
#define square(x) ((x)*(x)) #define square(x) ((x)*(x))
@ -163,12 +165,6 @@ extern uint16_t HAL_adc_result;
// Public functions // Public functions
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Disable interrupts
#define cli() do { DISABLE_TEMPERATURE_INTERRUPT(); DISABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
// Enable interrupts
#define sei() do { ENABLE_TEMPERATURE_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
// Memory related // Memory related
#define __bss_end __bss_end__ #define __bss_end __bss_end__
@ -209,7 +205,6 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ /** Read single byte from specified SPI channel */
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
// EEPROM // EEPROM
/** /**

6
Marlin/src/HAL/HAL_STM32F7/HAL.h

@ -114,6 +114,8 @@
#define ISRS_ENABLED() (!__get_PRIMASK()) #define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq() #define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq() #define DISABLE_ISRS() __disable_irq()
#define cli() __disable_irq()
#define sei() __enable_irq()
// On AVR this is in math.h? // On AVR this is in math.h?
#define square(x) ((x)*(x)) #define square(x) ((x)*(x))
@ -151,11 +153,7 @@ extern uint16_t HAL_adc_result;
// Public functions // Public functions
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Disable interrupts
#define cli() do { DISABLE_TEMPERATURE_INTERRUPT(); DISABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
// Enable interrupts
#define sei() do { ENABLE_TEMPERATURE_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
// Memory related // Memory related
#define __bss_end __bss_end__ #define __bss_end __bss_end__

2
Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp

@ -41,7 +41,7 @@
#include "pins_arduino.h" #include "pins_arduino.h"
#include "spi_pins.h" #include "spi_pins.h"
#include "../../core/macros.h" #include "../../core/macros.h"
#include <SPI.h>
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Public Variables // Public Variables

5
Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp

@ -148,4 +148,9 @@ void HAL_timer_isr_prologue(const uint8_t timer_num) {
} }
} }
bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
const uint32_t IRQ_Id = uint32_t(timerConfig[timer_num].IRQ_Id);
return NVIC->ISER[IRQ_Id >> 5] & _BV32(IRQ_Id & 0x1F);
}
#endif // STM32F7 #endif // STM32F7

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

@ -61,6 +61,8 @@
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
#define TEMP_ISR_ENABLED() HAL_timer_interrupt_enabled(TEMP_TIMER_NUM)
// TODO change this // TODO change this
@ -92,6 +94,7 @@ typedef struct {
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
void HAL_timer_enable_interrupt(const uint8_t timer_num); void HAL_timer_enable_interrupt(const uint8_t timer_num);
void HAL_timer_disable_interrupt(const uint8_t timer_num); void HAL_timer_disable_interrupt(const uint8_t timer_num);
bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare); void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare);
hal_timer_t HAL_timer_get_compare(const uint8_t timer_num); hal_timer_t HAL_timer_get_compare(const uint8_t timer_num);

4
Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp

@ -33,7 +33,7 @@
#include <SPI.h> #include <SPI.h>
#include "TMC2660.h" #include "TMC2660.h"
#include "../../HAL/HAL_STM32F7/HAL_STM32F7.h" #include "../../HAL/HAL_STM32F7/HAL.h"
#include "../../core/serial.h" #include "../../core/serial.h"
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "../../Marlin.h" #include "../../Marlin.h"
@ -448,7 +448,7 @@ void TMC26XStepper::setMicrosteps(int number_of_steps) {
/** /**
* returns the effective number of microsteps at the moment * returns the effective number of microsteps at the moment
*/ */
int TMC26XStepper::getMicrosteps(void) { return microsteps } int TMC26XStepper::getMicrosteps(void) { return microsteps; }
/** /**
* constant_off_time: The off time setting controls the minimum chopper frequency. * constant_off_time: The off time setting controls the minimum chopper frequency.

Loading…
Cancel
Save