瀏覽代碼

Allow SDIO clock/retry overrides (#18223)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Victor 5 年之前
父節點
當前提交
215b400038
沒有連結到貢獻者的電子郵件帳戶。
共有 2 個檔案被更改,包括 9 行新增3 行删除
  1. 1
    1
      Marlin/src/HAL/STM32F1/sdio.cpp
  2. 8
    2
      Marlin/src/HAL/STM32F1/sdio.h

+ 1
- 1
Marlin/src/HAL/STM32F1/sdio.cpp 查看文件

@@ -120,7 +120,7 @@ bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
120 120
 }
121 121
 
122 122
 bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
123
-  uint32_t retries = 3;
123
+  uint32_t retries = SDIO_READ_RETRIES;
124 124
   while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
125 125
   return false;
126 126
 }

+ 8
- 2
Marlin/src/HAL/STM32F1/sdio.h 查看文件

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#include "../shared/Marduino.h"
24
+#include "../../inc/MarlinConfig.h" // Allow pins/pins.h to override SDIO clock / retries
25 25
 
26 26
 #include <libmaple/sdio.h>
27 27
 #include <libmaple/dma.h>
@@ -100,7 +100,13 @@
100 100
 #define SDIO_DATA_TIMEOUT                    100U           /* Read data transfer timeout */
101 101
 #define SDIO_WRITE_TIMEOUT                   200U           /* Write data transfer timeout */
102 102
 
103
-#define SDIO_CLOCK                           18000000       /* 18 MHz */
103
+#ifndef SDIO_CLOCK
104
+  #define SDIO_CLOCK                         18000000       /* 18 MHz */
105
+#endif
106
+
107
+#ifndef SDIO_READ_RETRIES
108
+  #define SDIO_READ_RETRIES                  3
109
+#endif
104 110
 
105 111
 // ------------------------
106 112
 // Types

Loading…
取消
儲存