New HardwareTimer for STM32 5.7.0 (#15655)

This commit is contained in:
Lino Barreca
2019-11-13 02:23:02 +01:00
committed by Scott Lahteine
parent 4762dfe797
commit ac71cdc265
31 changed files with 1290 additions and 520 deletions

View File

@ -1537,7 +1537,7 @@ void Stepper::stepper_pulse_phase_isr() {
uint32_t Stepper::stepper_block_phase_isr() {
// If no queued movements, just wait 1ms for the next move
uint32_t interval = (STEPPER_TIMER_RATE / 1000);
uint32_t interval = (STEPPER_TIMER_RATE) / 1000;
// If there is a current block
if (current_block) {

View File

@ -2290,7 +2290,7 @@ void Temperature::readings_ready() {
HAL_TEMP_TIMER_ISR() {
HAL_timer_isr_prologue(TEMP_TIMER_NUM);
Temperature::isr();
Temperature::tick();
HAL_timer_isr_epilogue(TEMP_TIMER_NUM);
}
@ -2320,11 +2320,21 @@ public:
#endif
};
void Temperature::isr() {
/**
* Handle various ~1KHz tasks associated with temperature
* - Heater PWM (~1KHz with scaler)
* - LCD Button polling (~500Hz)
* - Start / Read one ADC sensor
* - Advance Babysteps
* - Endstop polling
* - Planner clean buffer
*/
void Temperature::tick() {
static int8_t temp_count = -1;
static ADCSensorState adc_sensor_state = StartupDelay;
static uint8_t pwm_count = _BV(SOFT_PWM_SCALE);
// avoid multiple loads of pwm_count
uint8_t pwm_count_tmp = pwm_count;

View File

@ -217,8 +217,8 @@ typedef struct { int16_t raw_min, raw_max; } raw_range_t;
typedef struct { int16_t mintemp, maxtemp; } celsius_range_t;
typedef struct { int16_t raw_min, raw_max, mintemp, maxtemp; } temp_range_t;
#define THERMISTOR_ABS_ZERO_C -273.15f // bbbbrrrrr cold !
#define THERMISTOR_RESISTANCE_NOMINAL_C 25.0f // mmmmm comfortable
#define THERMISTOR_ABS_ZERO_C -273.15f // bbbbrrrrr cold !
#define THERMISTOR_RESISTANCE_NOMINAL_C 25.0f // mmmmm comfortable
#if HAS_USER_THERMISTORS
@ -267,8 +267,6 @@ class Temperature {
public:
static volatile bool in_temp_isr;
#if HOTENDS
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
#define HOTEND_TEMPS (HOTENDS + 1)
@ -513,7 +511,7 @@ class Temperature {
* Called from the Temperature ISR
*/
static void readings_ready();
static void isr();
static void tick();
/**
* Call periodically to manage heaters