Explorar el Código

STM32F1: various small changes (#14313)

- init the led pin as output (like other HALs)
- reduce sdio dma priority to normal.. highest is never the best...
- allow fsmc only on compatible STM32F1 (like HAL fsmc)
- fsmc: remove an useless C style cast
Scott Lahteine hace 5 años
padre
commit
21f377d94a
No account linked to committer's email address

+ 5
- 4
Marlin/src/HAL/HAL_STM32F1/HAL.cpp Ver fichero

@@ -45,8 +45,7 @@
45 45
 
46 46
 #define __I
47 47
 #define __IO volatile
48
- typedef struct
49
- {
48
+ typedef struct {
50 49
    __I  uint32_t CPUID;                   /*!< Offset: 0x000 (R/ )  CPUID Base Register                                   */
51 50
    __IO uint32_t ICSR;                    /*!< Offset: 0x004 (R/W)  Interrupt Control and State Register                  */
52 51
    __IO uint32_t VTOR;                    /*!< Offset: 0x008 (R/W)  Vector Table Offset Register                          */
@@ -161,12 +160,11 @@ enum TEMP_PINS : char {
161 160
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
162 161
     FILWIDTH,
163 162
   #endif
164
-    ADC_PIN_COUNT
163
+  ADC_PIN_COUNT
165 164
 };
166 165
 
167 166
 uint16_t HAL_adc_results[ADC_PIN_COUNT];
168 167
 
169
-
170 168
 // --------------------------------------------------------------------------
171 169
 // Function prototypes
172 170
 // --------------------------------------------------------------------------
@@ -209,6 +207,9 @@ static void NVIC_SetPriorityGrouping(uint32_t PriorityGroup) {
209 207
 
210 208
 void HAL_init(void) {
211 209
   NVIC_SetPriorityGrouping(0x3);
210
+  #if PIN_EXISTS(LED)
211
+    OUT_WRITE(LED_PIN, LOW);
212
+  #endif
212 213
 }
213 214
 
214 215
 /* VGPV Done with defines

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp Ver fichero

@@ -40,7 +40,7 @@ bool SDIO_Init(void) {
40 40
 
41 41
   dma_init(SDIO_DMA_DEV);
42 42
   dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
43
-  dma_set_priority(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, DMA_PRIORITY_VERY_HIGH);
43
+  dma_set_priority(SDIO_DMA_DEV, SDIO_DMA_CHANNEL, DMA_PRIORITY_MEDIUM);
44 44
 
45 45
   if (!SDIO_CmdGoIdleState()) return false;
46 46
   if (!SDIO_CmdGoIdleState()) return false; /* Hotplugged cards tends to miss first CMD0, so give them a second chance. */

+ 3
- 3
Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp Ver fichero

@@ -45,7 +45,7 @@
45 45
 
46 46
 void LCD_IO_Init(uint8_t cs, uint8_t rs);
47 47
 void LCD_IO_WriteData(uint16_t RegValue);
48
-void LCD_IO_WriteReg(uint8_t Reg);
48
+void LCD_IO_WriteReg(uint16_t Reg);
49 49
 uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
50 50
 
51 51
 static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT
@@ -250,8 +250,8 @@ void LCD_IO_WriteData(uint16_t RegValue) {
250 250
   __DSB();
251 251
 }
252 252
 
253
-void LCD_IO_WriteReg(uint8_t Reg) {
254
-  LCD->REG = (uint16_t)Reg;
253
+void LCD_IO_WriteReg(uint16_t Reg) {
254
+  LCD->REG = Reg;
255 255
   __DSB();
256 256
 }
257 257
 

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/watchdog_STM32F1.cpp Ver fichero

@@ -34,7 +34,7 @@
34 34
 #include "watchdog_STM32F1.h"
35 35
 
36 36
 void watchdog_reset() {
37
-  #if PIN_EXISTS(LED)
37
+  #if DISABLED(PINS_DEBUGGING) && PIN_EXISTS(LED)
38 38
     TOGGLE(LED_PIN);  // heartbeat indicator
39 39
   #endif
40 40
   iwdg_feed();

+ 1
- 1
Marlin/src/lcd/dogm/HAL_LCD_com_defines.h Ver fichero

@@ -51,7 +51,7 @@
51 51
   uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
52 52
   #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
53 53
 
54
-  #ifdef ARDUINO_ARCH_STM32F1
54
+  #if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS)
55 55
     uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
56 56
     #define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn
57 57
   #else

Loading…
Cancelar
Guardar