Bladeren bron

Updates to STM32F7 HAL, for completeness (#11770)

Sam Lane 6 jaren geleden
bovenliggende
commit
d783400330

+ 2
- 7
Marlin/src/HAL/HAL_STM32F4/HAL.h Bestand weergeven

@@ -124,6 +124,8 @@
124 124
 #define ISRS_ENABLED() (!__get_PRIMASK())
125 125
 #define ENABLE_ISRS()  __enable_irq()
126 126
 #define DISABLE_ISRS() __disable_irq()
127
+#define cli() __disable_irq()
128
+#define sei() __enable_irq()
127 129
 
128 130
 // On AVR this is in math.h?
129 131
 #define square(x) ((x)*(x))
@@ -163,12 +165,6 @@ extern uint16_t HAL_adc_result;
163 165
 // Public functions
164 166
 // --------------------------------------------------------------------------
165 167
 
166
-// Disable interrupts
167
-#define cli() do {  DISABLE_TEMPERATURE_INTERRUPT(); DISABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
168
-
169
-// Enable interrupts
170
-#define sei() do {  ENABLE_TEMPERATURE_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
171
-
172 168
 // Memory related
173 169
 #define __bss_end __bss_end__
174 170
 
@@ -209,7 +205,6 @@ void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
209 205
 /** Read single byte from specified SPI channel */
210 206
 uint8_t spiRec(uint32_t chan);
211 207
 
212
-
213 208
 // EEPROM
214 209
 
215 210
 /**

+ 2
- 4
Marlin/src/HAL/HAL_STM32F7/HAL.h Bestand weergeven

@@ -114,6 +114,8 @@
114 114
 #define ISRS_ENABLED() (!__get_PRIMASK())
115 115
 #define ENABLE_ISRS()  __enable_irq()
116 116
 #define DISABLE_ISRS() __disable_irq()
117
+#define cli() __disable_irq()
118
+#define sei() __enable_irq()
117 119
 
118 120
 // On AVR this is in math.h?
119 121
 #define square(x) ((x)*(x))
@@ -151,11 +153,7 @@ extern uint16_t HAL_adc_result;
151 153
 // Public functions
152 154
 // --------------------------------------------------------------------------
153 155
 
154
-// Disable interrupts
155
-#define cli() do {  DISABLE_TEMPERATURE_INTERRUPT(); DISABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
156 156
 
157
-// Enable interrupts
158
-#define sei() do {  ENABLE_TEMPERATURE_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
159 157
 
160 158
 // Memory related
161 159
 #define __bss_end __bss_end__

+ 1
- 1
Marlin/src/HAL/HAL_STM32F7/HAL_spi_STM32F7.cpp Bestand weergeven

@@ -41,7 +41,7 @@
41 41
 #include "pins_arduino.h"
42 42
 #include "spi_pins.h"
43 43
 #include "../../core/macros.h"
44
-
44
+#include <SPI.h>
45 45
 
46 46
 // --------------------------------------------------------------------------
47 47
 // Public Variables

+ 5
- 0
Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.cpp Bestand weergeven

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

+ 3
- 0
Marlin/src/HAL/HAL_STM32F7/HAL_timers_STM32F7.h Bestand weergeven

@@ -61,6 +61,8 @@
61 61
 #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
62 62
 #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
63 63
 
64
+#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
65
+#define TEMP_ISR_ENABLED() HAL_timer_interrupt_enabled(TEMP_TIMER_NUM)
64 66
 // TODO change this
65 67
 
66 68
 
@@ -92,6 +94,7 @@ typedef struct {
92 94
 void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
93 95
 void HAL_timer_enable_interrupt(const uint8_t timer_num);
94 96
 void HAL_timer_disable_interrupt(const uint8_t timer_num);
97
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
95 98
 
96 99
 void HAL_timer_set_compare(const uint8_t timer_num, const uint32_t compare);
97 100
 hal_timer_t HAL_timer_get_compare(const uint8_t timer_num);

+ 2
- 2
Marlin/src/HAL/HAL_STM32F7/TMC2660.cpp Bestand weergeven

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

Laden…
Annuleren
Opslaan