Sfoglia il codice sorgente

Clean up SPI and ST7920 defines (#19956)

Scott Lahteine 4 anni fa
parent
commit
22bf2b49c6
Nessun account collegato all'indirizzo email del committer

+ 1
- 5
Marlin/src/HAL/STM32F1/spi_pins.h Vedi File

@@ -49,10 +49,6 @@
49 49
 #undef SDSS
50 50
 #define SDSS       SS_PIN
51 51
 
52
-#if ENABLED(ENABLE_SPI3)
53
-  #define SPI_DEVICE 3
54
-#elif ENABLED(ENABLE_SPI2)
55
-  #define SPI_DEVICE 2
56
-#else
52
+#ifndef SPI_DEVICE
57 53
   #define SPI_DEVICE 1
58 54
 #endif

+ 32
- 0
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp Vedi File

@@ -33,6 +33,38 @@
33 33
 
34 34
 #include "ultralcd_st7920_u8glib_rrd_AVR.h"
35 35
 
36
+#if F_CPU >= 20000000
37
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
38
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
39
+  #define CPU_ST7920_DELAY_3 DELAY_NS(50)
40
+#elif MB(3DRAG, K8200, K8400)
41
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
42
+  #define CPU_ST7920_DELAY_2 DELAY_NS(188)
43
+  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
44
+#elif MB(MINIRAMBO, EINSY_RAMBO, EINSY_RETRO, SILVER_GATE)
45
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
46
+  #define CPU_ST7920_DELAY_2 DELAY_NS(250)
47
+  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
48
+#elif MB(RAMBO)
49
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
50
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
51
+  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
52
+#elif MB(BQ_ZUM_MEGA_3D)
53
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
54
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
55
+  #define CPU_ST7920_DELAY_3 DELAY_NS(189)
56
+#elif defined(ARDUINO_ARCH_STM32)
57
+  #define CPU_ST7920_DELAY_1 DELAY_NS(300)
58
+  #define CPU_ST7920_DELAY_2 DELAY_NS(40)
59
+  #define CPU_ST7920_DELAY_3 DELAY_NS(340)
60
+#elif F_CPU == 16000000
61
+  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
62
+  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
63
+  #define CPU_ST7920_DELAY_3 DELAY_NS(63)
64
+#else
65
+  #error "No valid condition for delays in 'ultralcd_st7920_u8glib_rrd_AVR.h'"
66
+#endif
67
+
36 68
 #ifndef ST7920_DELAY_1
37 69
   #ifdef BOARD_ST7920_DELAY_1
38 70
     #define ST7920_DELAY_1 BOARD_ST7920_DELAY_1

+ 2
- 39
Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.h Vedi File

@@ -37,43 +37,6 @@
37 37
 
38 38
 #include <U8glib.h>
39 39
 
40
-// If you want you can define your own set of delays in Configuration.h
41
-//#define ST7920_DELAY_1 DELAY_NS(0)
42
-//#define ST7920_DELAY_2 DELAY_NS(0)
43
-//#define ST7920_DELAY_3 DELAY_NS(0)
44
-
45
-#if F_CPU >= 20000000
46
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
47
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
48
-  #define CPU_ST7920_DELAY_3 DELAY_NS(50)
49
-#elif MB(3DRAG, K8200, K8400)
50
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
51
-  #define CPU_ST7920_DELAY_2 DELAY_NS(188)
52
-  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
53
-#elif MB(MINIRAMBO, EINSY_RAMBO, EINSY_RETRO, SILVER_GATE)
54
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
55
-  #define CPU_ST7920_DELAY_2 DELAY_NS(250)
56
-  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
57
-#elif MB(RAMBO)
58
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
59
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
60
-  #define CPU_ST7920_DELAY_3 DELAY_NS(0)
61
-#elif MB(BQ_ZUM_MEGA_3D)
62
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
63
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
64
-  #define CPU_ST7920_DELAY_3 DELAY_NS(189)
65
-#elif defined(ARDUINO_ARCH_STM32)
66
-  #define CPU_ST7920_DELAY_1 DELAY_NS(300)
67
-  #define CPU_ST7920_DELAY_2 DELAY_NS(40)
68
-  #define CPU_ST7920_DELAY_3 DELAY_NS(340)
69
-#elif F_CPU == 16000000
70
-  #define CPU_ST7920_DELAY_1 DELAY_NS(0)
71
-  #define CPU_ST7920_DELAY_2 DELAY_NS(0)
72
-  #define CPU_ST7920_DELAY_3 DELAY_NS(63)
73
-#else
74
-  #error "No valid condition for delays in 'ultralcd_st7920_u8glib_rrd_AVR.h'"
75
-#endif
76
-
77 40
 void ST7920_SWSPI_SND_8BIT(uint8_t val);
78 41
 
79 42
 #if DOGM_SPI_DELAY_US > 0
@@ -82,8 +45,8 @@ void ST7920_SWSPI_SND_8BIT(uint8_t val);
82 45
   #define U8G_DELAY() DELAY_US(10)
83 46
 #endif
84 47
 
85
-#define ST7920_CS()              { WRITE(ST7920_CS_PIN,1); U8G_DELAY(); }
86
-#define ST7920_NCS()             { WRITE(ST7920_CS_PIN,0); }
48
+#define ST7920_CS()              { WRITE(ST7920_CS_PIN, HIGH); U8G_DELAY(); }
49
+#define ST7920_NCS()             { WRITE(ST7920_CS_PIN, LOW); }
87 50
 #define ST7920_SET_CMD()         { ST7920_SWSPI_SND_8BIT(0xF8); U8G_DELAY(); }
88 51
 #define ST7920_SET_DAT()         { ST7920_SWSPI_SND_8BIT(0xFA); U8G_DELAY(); }
89 52
 #define ST7920_WRITE_BYTE(a)     { ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xF0u)); ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4U)); U8G_DELAY(); }

+ 3
- 0
Marlin/src/pins/pins_postprocess.h Vedi File

@@ -871,6 +871,9 @@
871 871
   #undef ST7920_DELAY_1
872 872
   #undef ST7920_DELAY_2
873 873
   #undef ST7920_DELAY_3
874
+  #undef BOARD_ST7920_DELAY_1
875
+  #undef BOARD_ST7920_DELAY_2
876
+  #undef BOARD_ST7920_DELAY_3
874 877
 #endif
875 878
 
876 879
 #undef HAS_FREE_AUX2_PINS

+ 1
- 2
Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h Vedi File

@@ -210,14 +210,13 @@
210 210
 #endif
211 211
 
212 212
 #if SD_CONNECTION_IS(LCD)
213
-  #define ENABLE_SPI3
213
+  #define SPI_DEVICE                           3
214 214
   #define SD_DETECT_PIN                     PB9
215 215
   #define SCK_PIN                           PB3
216 216
   #define MISO_PIN                          PB4
217 217
   #define MOSI_PIN                          PB5
218 218
   #define SS_PIN                            PA15
219 219
 #elif SD_CONNECTION_IS(ONBOARD)
220
-  #define ENABLE_SPI1
221 220
   #define SD_DETECT_PIN                     PA3
222 221
   #define SCK_PIN                           PA5
223 222
   #define MISO_PIN                          PA6

+ 0
- 1
Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h Vedi File

@@ -165,7 +165,6 @@
165 165
 // SD-NAND
166 166
 //
167 167
 #if SD_CONNECTION_IS(ONBOARD)
168
-  #define ENABLE_SPI1
169 168
   #define SD_DETECT_PIN                     -1
170 169
   #define SCK_PIN                           PA5
171 170
   #define MISO_PIN                          PA6

+ 1
- 1
Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h Vedi File

@@ -185,7 +185,7 @@
185 185
 
186 186
 // SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
187 187
 // Needs to use SPI2
188
-#define ENABLE_SPI2
188
+#define SPI_DEVICE                             2
189 189
 #define SCK_PIN                             PB13
190 190
 #define MISO_PIN                            PB14
191 191
 #define MOSI_PIN                            PB15

+ 1
- 1
Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h Vedi File

@@ -200,7 +200,7 @@
200 200
 
201 201
 // SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
202 202
 // so SPI2 is required.
203
-#define ENABLE_SPI2
203
+#define SPI_DEVICE                             2
204 204
 #define SCK_PIN                             PB13
205 205
 #define MISO_PIN                            PB14
206 206
 #define MOSI_PIN                            PB15

+ 1
- 1
Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h Vedi File

@@ -56,7 +56,7 @@
56 56
 // SPI
57 57
 // Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface.
58 58
 //
59
-#define ENABLE_SPI2
59
+#define SPI_DEVICE                             2
60 60
 
61 61
 // SPI Flash
62 62
 #define HAS_SPI_FLASH                          1

+ 1
- 1
Marlin/src/pins/stm32f1/pins_FLY_MINI.h Vedi File

@@ -132,7 +132,7 @@
132 132
 //
133 133
 // LCD / Controller
134 134
 //
135
-#define ENABLE_SPI2
135
+#define SPI_DEVICE                             2
136 136
 #define SS_PIN                              PB12
137 137
 #define SCK_PIN                             PB13
138 138
 #define MISO_PIN                            PB14

+ 1
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h Vedi File

@@ -166,7 +166,7 @@
166 166
 #endif
167 167
 
168 168
 // SPI1(PA7) & SPI3(PB5) not available
169
-#define ENABLE_SPI2
169
+#define SPI_DEVICE                             2
170 170
 
171 171
 #if ENABLED(SDIO_SUPPORT)
172 172
   #define SCK_PIN                           PB13  // SPI2

+ 1
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h Vedi File

@@ -55,8 +55,7 @@
55 55
 //
56 56
 // Note: MKS Robin board is using SPI2 interface.
57 57
 //
58
-//#define SPI_MODULE                           2
59
-#define ENABLE_SPI2
58
+#define SPI_DEVICE                             2
60 59
 
61 60
 //
62 61
 // Limit Switches

+ 1
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h Vedi File

@@ -167,7 +167,7 @@
167 167
 //
168 168
 // SD Card
169 169
 //
170
-#define ENABLE_SPI2
170
+#define SPI_DEVICE                             2
171 171
 #define SD_DETECT_PIN                       PC10
172 172
 #define SCK_PIN                             PB13
173 173
 #define MISO_PIN                            PB14

+ 5
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h Vedi File

@@ -34,7 +34,6 @@
34 34
 
35 35
 //#define DISABLE_DEBUG
36 36
 #define DISABLE_JTAG
37
-#define ENABLE_SPI2
38 37
 
39 38
 //
40 39
 // Limit Switches
@@ -135,8 +134,12 @@
135 134
 //
136 135
 // SD Card
137 136
 //
138
-#define ENABLE_SPI2
139 137
 #define SD_DETECT_PIN                       PC10
138
+
139
+//
140
+// SPI
141
+//
142
+#define SPI_DEVICE                             2
140 143
 #define SCK_PIN                             PB13
141 144
 #define MISO_PIN                            P1B4
142 145
 #define MOSI_PIN                            P1B5

+ 12
- 15
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h Vedi File

@@ -38,7 +38,6 @@
38 38
 
39 39
 //#define DISABLE_DEBUG
40 40
 #define DISABLE_JTAG
41
-#define ENABLE_SPI2
42 41
 
43 42
 //
44 43
 // Servos
@@ -87,9 +86,9 @@
87 86
 //
88 87
 // Temperature Sensors
89 88
 //
90
-#define TEMP_BED_PIN                        PA1   //TB
91
-#define TEMP_0_PIN                          PA0   //TH1
92
-#define TEMP_1_PIN                          PA2   //TH2
89
+#define TEMP_BED_PIN                        PA1   // TB
90
+#define TEMP_0_PIN                          PA0   // TH1
91
+#define TEMP_1_PIN                          PA2   // TH2
93 92
 
94 93
 #define FIL_RUNOUT_PIN                      PB10  // MT_DET
95 94
 
@@ -132,24 +131,22 @@
132 131
 
133 132
   #endif // !MKS_MINI_12864
134 133
 
134
+  #define BOARD_ST7920_DELAY_1     DELAY_NS(125)
135
+  #define BOARD_ST7920_DELAY_2     DELAY_NS(125)
136
+  #define BOARD_ST7920_DELAY_3     DELAY_NS(125)
137
+
135 138
 #endif // HAS_WIRED_LCD
136 139
 
137 140
 //
138 141
 // SD Card
139 142
 //
140
-#define ENABLE_SPI2
141 143
 #define SD_DETECT_PIN                       PC10
144
+
145
+//
146
+// SPI
147
+//
148
+#define SPI_DEVICE                             2
142 149
 #define SCK_PIN                             PB13
143 150
 #define MISO_PIN                            PB14
144 151
 #define MOSI_PIN                            PB15
145 152
 #define SS_PIN                              PA15
146
-
147
-#ifndef BOARD_ST7920_DELAY_1
148
-  #define BOARD_ST7920_DELAY_1     DELAY_NS(125)
149
-#endif
150
-#ifndef BOARD_ST7920_DELAY_2
151
-  #define BOARD_ST7920_DELAY_2     DELAY_NS(125)
152
-#endif
153
-#ifndef BOARD_ST7920_DELAY_3
154
-  #define BOARD_ST7920_DELAY_3     DELAY_NS(125)
155
-#endif

+ 1
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h Vedi File

@@ -48,7 +48,7 @@
48 48
   #define MARLIN_EEPROM_SIZE    EEPROM_PAGE_SIZE  // 2KB
49 49
 #endif
50 50
 
51
-#define ENABLE_SPI2
51
+#define SPI_DEVICE                             2
52 52
 
53 53
 //
54 54
 // Limit Switches

+ 1
- 1
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h Vedi File

@@ -48,7 +48,7 @@
48 48
   #define MARLIN_EEPROM_SIZE    EEPROM_PAGE_SIZE  // 2KB
49 49
 #endif
50 50
 
51
-#define ENABLE_SPI2
51
+#define SPI_DEVICE                             2
52 52
 
53 53
 //
54 54
 // Limit Switches

+ 1
- 2
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h Vedi File

@@ -55,8 +55,7 @@
55 55
 //
56 56
 // Note: MKS Robin board is using SPI2 interface.
57 57
 //
58
-//#define SPI_MODULE                           2
59
-#define ENABLE_SPI2
58
+#define SPI_DEVICE                             2
60 59
 
61 60
 //
62 61
 // Limit Switches

+ 1
- 3
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h Vedi File

@@ -41,8 +41,7 @@
41 41
 //
42 42
 // Note: MKS Robin board is using SPI2 interface.
43 43
 //
44
-//#define SPI_MODULE                           2
45
-#define ENABLE_SPI2
44
+#define SPI_DEVICE                             2
46 45
 
47 46
 //
48 47
 // Servos
@@ -191,7 +190,6 @@
191 190
 #endif
192 191
 
193 192
 #if SD_CONNECTION_IS(LCD)
194
-  #define ENABLE_SPI2
195 193
   #define SD_DETECT_PIN                     PG3
196 194
   #define SCK_PIN                           PB13
197 195
   #define MISO_PIN                          PB14

+ 1
- 1
Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h Vedi File

@@ -173,7 +173,7 @@
173 173
 #endif
174 174
 
175 175
 // SPI1(PA7) & SPI3(PB5) not available
176
-#define ENABLE_SPI2
176
+#define SPI_DEVICE                             2
177 177
 
178 178
 #if ENABLED(SDIO_SUPPORT)
179 179
   #define SCK_PIN                           PB13  // SPI2 ok

+ 0
- 2
Marlin/src/pins/stm32f4/pins_RUMBA32_MKS.h Vedi File

@@ -46,8 +46,6 @@
46 46
   #define FLASH_EEPROM_LEVELING
47 47
 #endif
48 48
 
49
-#define ENABLE_SPI1
50
-
51 49
 #include "pins_RUMBA32_common.h"
52 50
 
53 51
 #if HAS_TMC_UART

Loading…
Annulla
Salva