Browse Source

Lerdge K EEPROM and TFT (#21812)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
sanek88lbl 3 years ago
parent
commit
f95f18c8e5
No account linked to committer's email address

+ 1
- 0
.github/workflows/test-builds.yml View File

86
         - FLYF407ZG
86
         - FLYF407ZG
87
         - rumba32
87
         - rumba32
88
         - LERDGEX
88
         - LERDGEX
89
+        - LERDGEK
89
         - mks_robin_nano35_stm32
90
         - mks_robin_nano35_stm32
90
         - NUCLEO_F767ZI
91
         - NUCLEO_F767ZI
91
         - REMRAM_V1
92
         - REMRAM_V1

+ 8
- 2
Marlin/src/HAL/shared/eeprom_if_i2c.cpp View File

30
 #if ENABLED(I2C_EEPROM)
30
 #if ENABLED(I2C_EEPROM)
31
 
31
 
32
 #include "eeprom_if.h"
32
 #include "eeprom_if.h"
33
-#include <Wire.h>
33
+
34
+#if ENABLED(SOFT_I2C_EEPROM)
35
+  #include <SlowSoftWire.h>
36
+  SlowSoftWire Wire = SlowSoftWire(I2C_SDA_PIN, I2C_SCL_PIN, true);
37
+#else
38
+  #include <Wire.h>
39
+#endif
34
 
40
 
35
 void eeprom_init() {
41
 void eeprom_init() {
36
   Wire.begin(
42
   Wire.begin(
37
-    #if PINS_EXIST(I2C_SCL, I2C_SDA)
43
+    #if PINS_EXIST(I2C_SCL, I2C_SDA) && DISABLED(SOFT_I2C_EEPROM)
38
       uint8_t(I2C_SDA_PIN), uint8_t(I2C_SCL_PIN)
44
       uint8_t(I2C_SDA_PIN), uint8_t(I2C_SCL_PIN)
39
     #endif
45
     #endif
40
   );
46
   );

+ 3
- 1
Marlin/src/lcd/tft_io/st7796s.h View File

154
 
154
 
155
 static const uint16_t lerdge_st7796s_init[] = {
155
 static const uint16_t lerdge_st7796s_init[] = {
156
   DATASIZE_8BIT,
156
   DATASIZE_8BIT,
157
+  ESC_REG(ST7796S_SWRESET), ESC_DELAY(100),
158
+  ESC_REG(ST7796S_SLPOUT), ESC_DELAY(20),
159
+
157
   ESC_REG(ST7796S_CSCON), 0x00C3,  // enable command 2 part I
160
   ESC_REG(ST7796S_CSCON), 0x00C3,  // enable command 2 part I
158
   ESC_REG(ST7796S_CSCON), 0x0096,  // enable command 2 part II
161
   ESC_REG(ST7796S_CSCON), 0x0096,  // enable command 2 part II
159
 
162
 
165
 
168
 
166
   ESC_REG(ST7796S_PWR2), 0x0015,
169
   ESC_REG(ST7796S_PWR2), 0x0015,
167
   ESC_REG(ST7796S_PWR3), 0x00AF,
170
   ESC_REG(ST7796S_PWR3), 0x00AF,
168
-  ESC_REG(0xC3), 0x0009,       // Register not documented in datasheet
169
   ESC_REG(ST7796S_VCMPCTL), 0x0022,
171
   ESC_REG(ST7796S_VCMPCTL), 0x0022,
170
   ESC_REG(ST7796S_VCMOST), 0x0000,
172
   ESC_REG(ST7796S_VCMOST), 0x0000,
171
   ESC_REG(ST7796S_DOCA), 0x0040, 0x008A, 0x0000, 0x0000, 0x0029, 0x0019, 0x00A5, 0x0033,
173
   ESC_REG(ST7796S_DOCA), 0x0040, 0x008A, 0x0000, 0x0000, 0x0029, 0x0019, 0x00A5, 0x0033,

+ 44
- 18
Marlin/src/pins/stm32f4/pins_LERDGE_K.h View File

28
 #define BOARD_INFO_NAME      "Lerdge K"
28
 #define BOARD_INFO_NAME      "Lerdge K"
29
 #define DEFAULT_MACHINE_NAME "LERDGE"
29
 #define DEFAULT_MACHINE_NAME "LERDGE"
30
 
30
 
31
-#define I2C_EEPROM
31
+// EEPROM
32
+#if NO_EEPROM_SELECTED
33
+  #define I2C_EEPROM
34
+  #define SOFT_I2C_EEPROM                         // Force the use of Software I2C
35
+  #define I2C_SCL_PIN                       PG14
36
+  #define I2C_SDA_PIN                       PG13
37
+  #define MARLIN_EEPROM_SIZE             0x10000
38
+#endif
32
 
39
 
33
 // USB Flash Drive support
40
 // USB Flash Drive support
34
 #define HAS_OTG_USB_HOST_SUPPORT
41
 #define HAS_OTG_USB_HOST_SUPPORT
36
 //
43
 //
37
 // Servos
44
 // Servos
38
 //
45
 //
39
-//#define SERVO0_PIN                        PB11
46
+#define SERVO0_PIN                          PB11
40
 
47
 
41
 //
48
 //
42
 // Limit Switches
49
 // Limit Switches
96
 //  #define E1_CS_PIN                       PE4
103
 //  #define E1_CS_PIN                       PE4
97
 //#endif
104
 //#endif
98
 
105
 
106
+//#define E2_STEP_PIN                       PF4  // best guess
107
+//#define E2_DIR_PIN                        PF3  // best guess
108
+//#define E2_ENABLE_PIN                     PF5  // best guess
109
+//#ifndef E2_CS_PIN
110
+//  #define E2_CS_PIN                       PB2  // best guess
111
+//#endif
112
+
99
 #if HAS_TMC_UART
113
 #if HAS_TMC_UART
100
   /**
114
   /**
101
    * TMC2208/TMC2209 stepper drivers
115
    * TMC2208/TMC2209 stepper drivers
163
 #ifndef FAN_PIN
177
 #ifndef FAN_PIN
164
   #define FAN_PIN                           PF7
178
   #define FAN_PIN                           PF7
165
 #endif
179
 #endif
180
+
166
 #define FAN1_PIN                            PF6
181
 #define FAN1_PIN                            PF6
167
-#define FAN2_PIN                            PF8
168
 
182
 
169
 #ifndef E0_AUTO_FAN_PIN
183
 #ifndef E0_AUTO_FAN_PIN
170
-  #define E0_AUTO_FAN_PIN                   PF6
184
+  #define E0_AUTO_FAN_PIN                   PB1
185
+#endif
186
+
187
+#ifndef E1_AUTO_FAN_PIN
188
+  #define E1_AUTO_FAN_PIN                   PB0
171
 #endif
189
 #endif
172
 
190
 
191
+#define CONTROLLER_FAN_PIN                  PF8
192
+
173
 //
193
 //
174
 // LED / Lighting
194
 // LED / Lighting
175
 //
195
 //
177
 //#define CASE_LIGHT_PIN_DO                 -1
197
 //#define CASE_LIGHT_PIN_DO                 -1
178
 //#define NEOPIXEL_PIN                      -1
198
 //#define NEOPIXEL_PIN                      -1
179
 #ifndef RGB_LED_R_PIN
199
 #ifndef RGB_LED_R_PIN
180
-  #define RGB_LED_R_PIN                     PB7
200
+  #define RGB_LED_R_PIN                     PB8   // swap R and G pin for compatibility with real wires
181
 #endif
201
 #endif
182
 #ifndef RGB_LED_G_PIN
202
 #ifndef RGB_LED_G_PIN
183
-  #define RGB_LED_G_PIN                     PB8
203
+  #define RGB_LED_G_PIN                     PB7
184
 #endif
204
 #endif
185
 #ifndef RGB_LED_B_PIN
205
 #ifndef RGB_LED_B_PIN
186
   #define RGB_LED_B_PIN                     PB9
206
   #define RGB_LED_B_PIN                     PB9
197
 //
217
 //
198
 #define SDSS                                PC11
218
 #define SDSS                                PC11
199
 #define LED_PIN                             PA15  // Alive
219
 #define LED_PIN                             PA15  // Alive
200
-#define PS_ON_PIN                           -1
220
+#define PS_ON_PIN                           PA4
201
 #define KILL_PIN                            -1
221
 #define KILL_PIN                            -1
202
 #define POWER_LOSS_PIN                      PA4   // Power-loss / nAC_FAULT
222
 #define POWER_LOSS_PIN                      PA4   // Power-loss / nAC_FAULT
203
 
223
 
213
 // LCD / Controller
233
 // LCD / Controller
214
 //
234
 //
215
 
235
 
216
-#define TFT_RESET_PIN                       PD6
217
-#define TFT_BACKLIGHT_PIN                   PD3
236
+#if HAS_FSMC_TFT
237
+  //#define TFT_DRIVER             LERDGE_ST7796
218
 
238
 
219
-#define TFT_CS_PIN                          PD7
220
-#define TFT_RS_PIN                          PD11
239
+  #define TFT_RESET_PIN                     PD6
240
+  #define TFT_BACKLIGHT_PIN                 PD3
221
 
241
 
222
-#define TOUCH_CS_PIN                        PG15
223
-#define TOUCH_SCK_PIN                       PB3
224
-#define TOUCH_MOSI_PIN                      PB5
225
-#define TOUCH_MISO_PIN                      PB4
242
+  #define TFT_CS_PIN                        PD7
243
+  #define TFT_RS_PIN                        PD11
226
 
244
 
227
-#define BTN_EN1                             PG10
228
-#define BTN_EN2                             PG11
229
-#define BTN_ENC                             PG9
245
+  #define TOUCH_CS_PIN                      PG15
246
+  #define TOUCH_SCK_PIN                     PB3
247
+  #define TOUCH_MOSI_PIN                    PB5
248
+  #define TOUCH_MISO_PIN                    PB4
249
+#endif
250
+
251
+#if IS_NEWPANEL
252
+  #define BTN_EN1                           PG10
253
+  #define BTN_EN2                           PG11
254
+  #define BTN_ENC                           PG9
255
+#endif

+ 18
- 0
buildroot/tests/LERDGEK View File

1
+#!/usr/bin/env bash
2
+#
3
+# Build tests for LERDGEK environment
4
+#
5
+
6
+# exit on first failure
7
+set -e
8
+
9
+#
10
+# Build with the typical configuration
11
+#
12
+restore_configs
13
+opt_set MOTHERBOARD BOARD_LERDGE_K SERIAL_PORT 1
14
+opt_enable TFT_GENERIC TFT_INTERFACE_FSMC TFT_COLOR_UI
15
+exec_test $1 $2 "LERDGE K with Generic FSMC TFT with ColorUI" "$3"
16
+
17
+# clean up
18
+restore_configs

+ 1
- 0
ini/features.ini View File

41
 HAS_FSMC_TFT                           = src_filter=+<src/HAL/STM32/tft/tft_fsmc.cpp> +<src/HAL/STM32F1/tft/tft_fsmc.cpp>
41
 HAS_FSMC_TFT                           = src_filter=+<src/HAL/STM32/tft/tft_fsmc.cpp> +<src/HAL/STM32F1/tft/tft_fsmc.cpp>
42
 HAS_SPI_TFT                            = src_filter=+<src/HAL/STM32/tft/tft_spi.cpp> +<src/HAL/STM32F1/tft/tft_spi.cpp>
42
 HAS_SPI_TFT                            = src_filter=+<src/HAL/STM32/tft/tft_spi.cpp> +<src/HAL/STM32F1/tft/tft_spi.cpp>
43
 I2C_EEPROM                             = src_filter=+<src/HAL/shared/eeprom_if_i2c.cpp>
43
 I2C_EEPROM                             = src_filter=+<src/HAL/shared/eeprom_if_i2c.cpp>
44
+SOFT_I2C_EEPROM                        = SlowSoftI2CMaster, SlowSoftWire=https://github.com/felias-fogg/SlowSoftWire/archive/master.zip
44
 SPI_EEPROM                             = src_filter=+<src/HAL/shared/eeprom_if_spi.cpp>
45
 SPI_EEPROM                             = src_filter=+<src/HAL/shared/eeprom_if_spi.cpp>
45
 HAS_GRAPHICAL_TFT                      = src_filter=+<src/lcd/tft>
46
 HAS_GRAPHICAL_TFT                      = src_filter=+<src/lcd/tft>
46
 DWIN_CREALITY_LCD                      = src_filter=+<src/lcd/dwin>
47
 DWIN_CREALITY_LCD                      = src_filter=+<src/lcd/dwin>

+ 1
- 2
ini/stm32f4.ini View File

308
 platform             = ${lerdge_common.platform}
308
 platform             = ${lerdge_common.platform}
309
 extends              = lerdge_common
309
 extends              = lerdge_common
310
 board_build.firmware = Lerdge_K_firmware_force.bin
310
 board_build.firmware = Lerdge_K_firmware_force.bin
311
-build_flags          = ${lerdge_common.build_flags}
312
-  -DLERDGEK
311
+build_flags          = ${lerdge_common.build_flags} -DLERDGEK
313
 
312
 
314
 #
313
 #
315
 # Lerdge K with USB Flash Drive Support
314
 # Lerdge K with USB Flash Drive Support

Loading…
Cancel
Save