Updates to STM32F7 HAL, for completeness (#11770)

This commit is contained in:
Sam Lane 2018-09-09 09:26:15 +01:00 committed by Scott Lahteine
parent 72af8e0f02
commit d783400330
6 changed files with 15 additions and 14 deletions

View file

@ -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
/** /**

View file

@ -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__

View file

@ -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

View file

@ -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

View file

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

View file

@ -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.