浏览代码

Restore STM32F1 series to working order. (#10229)

The `_O2` attribute is no longer needed on the malyanlcd function, and the macros have broken timer numbers - reset this to a function to return the right device. Also fix the bit order cast in SPI.
xC0000005 7 年前
父节点
当前提交
7dc256432f

+ 1
- 0
Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.cpp 查看文件

@@ -55,6 +55,7 @@
55 55
 // --------------------------------------------------------------------------
56 56
 // Public Variables
57 57
 // --------------------------------------------------------------------------
58
+USBSerial SerialUSB;
58 59
 
59 60
 uint16_t HAL_adc_result;
60 61
 

+ 2
- 0
Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h 查看文件

@@ -69,6 +69,7 @@
69 69
   #error "SERIAL_PORT must be from -1 to 3"
70 70
 #endif
71 71
 #if SERIAL_PORT == -1
72
+extern USBSerial SerialUSB;
72 73
   #define MYSERIAL0 SerialUSB
73 74
 #elif SERIAL_PORT == 0
74 75
   #define MYSERIAL0 Serial
@@ -88,6 +89,7 @@
88 89
   #endif
89 90
   #define NUM_SERIAL 2
90 91
   #if SERIAL_PORT_2 == -1
92
+  extern USBSerial SerialUSB;
91 93
     #define MYSERIAL1 SerialUSB
92 94
   #elif SERIAL_PORT_2 == 0
93 95
     #define MYSERIAL1 Serial

+ 2
- 1
Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp 查看文件

@@ -41,6 +41,7 @@
41 41
 #include "pins_arduino.h"
42 42
 #include "spi_pins.h"
43 43
 #include "../../core/macros.h"
44
+#include <spi.h>
44 45
 
45 46
 // --------------------------------------------------------------------------
46 47
 // Public Variables
@@ -166,7 +167,7 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
166 167
 
167 168
 /** Begin SPI transaction, set clock, bit order, data mode */
168 169
 void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
169
-  spiConfig = SPISettings(spiClock, bitOrder, dataMode);
170
+  spiConfig = SPISettings(spiClock, (BitOrder)bitOrder, dataMode);
170 171
 
171 172
   SPI.beginTransaction(spiConfig);
172 173
 }

+ 47
- 0
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.cpp 查看文件

@@ -163,4 +163,51 @@ bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
163 163
   return false;
164 164
 }
165 165
 
166
+timer_dev* get_timer_dev(int number) {
167
+  switch (number) {
168
+    #if STM32_HAVE_TIMER(1)
169
+    case 1: return &timer1;
170
+    #endif
171
+    #if STM32_HAVE_TIMER(2)
172
+    case 2: return &timer2;
173
+    #endif
174
+    #if STM32_HAVE_TIMER(3)
175
+    case 3: return &timer3;
176
+    #endif
177
+    #if STM32_HAVE_TIMER(4)
178
+    case 4: return &timer4;
179
+    #endif
180
+    #if STM32_HAVE_TIMER(5)
181
+    case 5: return &timer5;
182
+    #endif
183
+    #if STM32_HAVE_TIMER(6)
184
+    case 6: return &timer6;
185
+    #endif
186
+    #if STM32_HAVE_TIMER(7)
187
+    case 7: return &timer7;
188
+    #endif
189
+    #if STM32_HAVE_TIMER(8)
190
+    case 8: return &timer8;
191
+    #endif
192
+    #if STM32_HAVE_TIMER(9)
193
+    case 9: return &timer9;
194
+    #endif
195
+    #if STM32_HAVE_TIMER(10)
196
+    case 10: return &timer10;
197
+    #endif
198
+    #if STM32_HAVE_TIMER(11)
199
+    case 11: return &timer11;
200
+    #endif
201
+    #if STM32_HAVE_TIMER(12)
202
+    case 12: return &timer12;
203
+    #endif
204
+    #if STM32_HAVE_TIMER(13)
205
+    case 13: return &timer14;
206
+    #endif
207
+    #if STM32_HAVE_TIMER(14)
208
+    case 14: return &timer14;
209
+    #endif
210
+    }
211
+}
212
+
166 213
 #endif // __STM32F1__

+ 4
- 3
Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h 查看文件

@@ -32,6 +32,7 @@
32 32
 // --------------------------------------------------------------------------
33 33
 
34 34
 #include <stdint.h>
35
+#include <libmaple/timer.h>
35 36
 
36 37
 // --------------------------------------------------------------------------
37 38
 // Defines
@@ -56,8 +57,9 @@ typedef uint16_t hal_timer_t;
56 57
 #define TEMP_TIMER_NUM 2  // index of timer to use for temperature
57 58
 #define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
58 59
 
59
-#define CAT(a, ...) a ## __VA_ARGS__
60
-#define TIMER_DEV(num) CAT (&timer, num)
60
+timer_dev* get_timer_dev(int number);
61
+
62
+#define TIMER_DEV(num) get_timer_dev(num)
61 63
 
62 64
 #define STEP_TIMER_DEV TIMER_DEV(STEP_TIMER_NUM)
63 65
 #define TEMP_TIMER_DEV TIMER_DEV(TEMP_TIMER_NUM)
@@ -86,7 +88,6 @@ typedef uint16_t hal_timer_t;
86 88
 
87 89
 #define HAL_timer_get_count(timer_num) timer_get_count(TIMER_DEV(timer_num))
88 90
 
89
-
90 91
 #define HAL_ENABLE_ISRs() do { if (thermalManager.in_temp_isr)DISABLE_TEMPERATURE_INTERRUPT(); else ENABLE_TEMPERATURE_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT(); } while(0)
91 92
 // TODO change this
92 93
 

+ 1
- 1
Marlin/src/lcd/malyanlcd.cpp 查看文件

@@ -393,7 +393,7 @@ void update_usb_status(const bool forceUpdate) {
393 393
  * The optimize attribute fixes a register Compile
394 394
  * error for amtel.
395 395
  */
396
-void lcd_update() _O2 {
396
+void lcd_update() {
397 397
   static char inbound_buffer[MAX_CURLY_COMMAND];
398 398
 
399 399
   // First report USB status.

正在加载...
取消
保存