SKR Pro 1.1 WiFi and LCD SD card support (#17531)
This commit is contained in:
		
							
								
								
									
										35
									
								
								Marlin/src/HAL/shared/esp_wifi.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Marlin/src/HAL/shared/esp_wifi.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,35 @@ | ||||
| /** | ||||
|  * Marlin 3D Printer Firmware | ||||
|  * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | ||||
|  * | ||||
|  * Based on Sprinter and grbl. | ||||
|  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm | ||||
|  * | ||||
|  * This program is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| #include "../../inc/MarlinConfig.h" | ||||
| #include "Delay.h" | ||||
|  | ||||
| void esp_wifi_init(void) { | ||||
|   #if PIN_EXISTS(ESP_WIFI_MODULE_RESET) | ||||
|     OUT_WRITE(ESP_WIFI_MODULE_RESET_PIN, LOW); | ||||
|     delay(1); | ||||
|     OUT_WRITE(ESP_WIFI_MODULE_RESET_PIN, HIGH); | ||||
|   #endif | ||||
|   #if PIN_EXISTS(ESP_WIFI_MODULE_ENABLE) | ||||
|     OUT_WRITE(ESP_WIFI_MODULE_ENABLE_PIN, HIGH); | ||||
|   #endif | ||||
| } | ||||
							
								
								
									
										24
									
								
								Marlin/src/HAL/shared/esp_wifi.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Marlin/src/HAL/shared/esp_wifi.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| /** | ||||
|  * Marlin 3D Printer Firmware | ||||
|  * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] | ||||
|  * | ||||
|  * Based on Sprinter and grbl. | ||||
|  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm | ||||
|  * | ||||
|  * This program is free software: you can redistribute it and/or modify | ||||
|  * it under the terms of the GNU General Public License as published by | ||||
|  * the Free Software Foundation, either version 3 of the License, or | ||||
|  * (at your option) any later version. | ||||
|  * | ||||
|  * This program is distributed in the hope that it will be useful, | ||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
|  * GNU General Public License for more details. | ||||
|  * | ||||
|  * You should have received a copy of the GNU General Public License | ||||
|  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | ||||
|  * | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| void esp_wifi_init(); | ||||
| @@ -44,6 +44,7 @@ | ||||
| #include "feature/closedloop.h" | ||||
|  | ||||
| #include "HAL/shared/Delay.h" | ||||
| #include "HAL/shared/esp_wifi.h" | ||||
|  | ||||
| #include "module/stepper/indirection.h" | ||||
|  | ||||
| @@ -962,6 +963,8 @@ void setup() { | ||||
|     BOARD_INIT(); | ||||
|   #endif | ||||
|  | ||||
|   SETUP_RUN(esp_wifi_init()); | ||||
|  | ||||
|   // Check startup - does nothing if bootloader sets MCUSR to 0 | ||||
|   byte mcu = HAL_get_reset_source(); | ||||
|   if (mcu &  1) SERIAL_ECHOLNPGM(STR_POWERUP); | ||||
|   | ||||
| @@ -1409,3 +1409,9 @@ | ||||
| #if PIN_EXISTS(CLOSED_LOOP_MOVE_COMPLETE) | ||||
|   REPORT_NAME_DIGITAL(__LINE__, CLOSED_LOOP_MOVE_COMPLETE_PIN) | ||||
| #endif | ||||
| #if PIN_EXISTS(ESP_WIFI_MODULE_RESET) | ||||
|   REPORT_NAME_DIGITAL(__LINE__, ESP_WIFI_MODULE_RESET_PIN) | ||||
| #endif | ||||
| #if PIN_EXISTS(ESP_WIFI_MODULE_ENABLE) | ||||
|   REPORT_NAME_DIGITAL(__LINE__, ESP_WIFI_MODULE_ENABLE_PIN) | ||||
| #endif | ||||
|   | ||||
| @@ -142,7 +142,11 @@ | ||||
| #define SDIO_CK_PIN                         PC12 | ||||
| #define SDIO_CMD_PIN                        PD2 | ||||
|  | ||||
| #if !defined(SDCARD_CONNECTION) || SD_CONNECTION_IS(ONBOARD) | ||||
| #ifndef SDCARD_CONNECTION | ||||
|   #define SDCARD_CONNECTION              ONBOARD | ||||
| #endif | ||||
|  | ||||
| #if SD_CONNECTION_IS(ONBOARD) | ||||
|   #define SDIO_SUPPORT                            // Use SDIO for onboard SD | ||||
|  | ||||
|   #ifndef SDIO_SUPPORT | ||||
|   | ||||
| @@ -31,7 +31,7 @@ | ||||
|  | ||||
| // Use one of these or SDCard-based Emulation will be used | ||||
| //#define SRAM_EEPROM_EMULATION                   // Use BackSRAM-based EEPROM emulation | ||||
| //#define FLASH_EEPROM_EMULATION                  // Use Flash-based EEPROM emulation | ||||
| #define FLASH_EEPROM_EMULATION                    // Use Flash-based EEPROM emulation | ||||
|  | ||||
| // | ||||
| // Servos | ||||
| @@ -215,7 +215,11 @@ | ||||
| #define HEATER_BED_PIN                      PD12  // Hotbed | ||||
| #define FAN_PIN                             PC8   // Fan0 | ||||
| #define FAN1_PIN                            PE5   // Fan1 | ||||
| #define FAN2_PIN                            PE6   // Fan2 | ||||
| #define FAN2_PIN                            PE6 | ||||
|  | ||||
| #ifndef E0_AUTO_FAN_PIN | ||||
|   #define E0_AUTO_FAN_PIN                   PC9 | ||||
| #endif | ||||
|  | ||||
| // | ||||
| // Misc. Functions | ||||
| @@ -227,16 +231,14 @@ | ||||
|  | ||||
| // | ||||
| // Onboard SD card | ||||
| //   NOT compatible with LCD | ||||
| // Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 | ||||
| // | ||||
| #if SDCARD_CONNECTION == ONBOARD && !HAS_SPI_LCD | ||||
| #if SD_CONNECTION_IS(ONBOARD) | ||||
|   #define SOFTWARE_SPI                            // Use soft SPI for onboard SD | ||||
|   #define SDSS                              PA4 | ||||
|   #define SCK_PIN                           PA5 | ||||
|   #define MISO_PIN                          PA6 | ||||
|   #define MOSI_PIN                          PB5 | ||||
| #else | ||||
|   #define SDSS                              PB12 | ||||
| #endif | ||||
|  | ||||
| /** | ||||
| @@ -256,6 +258,9 @@ | ||||
| #if HAS_SPI_LCD | ||||
|   #define BEEPER_PIN                        PG4 | ||||
|   #define BTN_ENC                           PA8 | ||||
|   #if SD_CONNECTION_IS(LCD) | ||||
|     #define SDSS                            PB12  // Uses default hardware SPI for LCD's SD | ||||
|   #endif | ||||
|  | ||||
|   #if ENABLED(CR10_STOCKDISPLAY) | ||||
|     #define LCD_PINS_RS                     PG6 | ||||
| @@ -272,6 +277,10 @@ | ||||
|     #undef ST7920_DELAY_2 | ||||
|     #undef ST7920_DELAY_3 | ||||
|  | ||||
|   #elif ENABLED(MKS_MINI_12864) | ||||
|     #define DOGLCD_A0                       PG6 | ||||
|     #define DOGLCD_CS                       PG3 | ||||
|  | ||||
|   #else | ||||
|  | ||||
|     #define LCD_PINS_RS                     PD10 | ||||
| @@ -321,3 +330,21 @@ | ||||
|   #endif | ||||
|  | ||||
| #endif // HAS_SPI_LCD | ||||
|  | ||||
| // | ||||
| // WIFI | ||||
| // | ||||
|  | ||||
| /** | ||||
|  *          _____ | ||||
|  *      TX | 1 2 | GND      Enable PG1   // Must be high for module to run | ||||
|  *  Enable | 3 4 | GPIO2    Reset  PG0   // Leave as unused (OK to leave floating) | ||||
|  *   Reset | 5 6 | GPIO0    GPIO2  PF15  // Leave as unused (best to leave floating) | ||||
|  *     3.3V| 7 8 | RX       GPIO0  PF14  // Leave as unused (best to leave floating) | ||||
|  *            ̄ ̄ | ||||
|  *            W1 | ||||
|  */ | ||||
| #define ESP_WIFI_MODULE_COM 6                     // must also set SERIAL_PORT or SERIAL_PORT_2 to this | ||||
| #define ESP_WIFI_MODULE_BAUDRATE        BAUDRATE  //115200   // use BAUDRATE ?  would guarantee same baud rate as SERIAL_PORT & SERIAL_PORT_2 | ||||
| #define ESP_WIFI_MODULE_RESET_PIN           -1 | ||||
| #define ESP_WIFI_MODULE_ENABLE_PIN          PG1 | ||||
|   | ||||
| @@ -164,7 +164,11 @@ | ||||
| #define SDIO_CK_PIN                         PC12 | ||||
| #define SDIO_CMD_PIN                        PD2 | ||||
|  | ||||
| #if !defined(SDCARD_CONNECTION) || SD_CONNECTION_IS(ONBOARD) | ||||
| #ifndef SDCARD_CONNECTION | ||||
|   #define SDCARD_CONNECTION              ONBOARD | ||||
| #endif | ||||
|  | ||||
| #if SD_CONNECTION_IS(ONBOARD) | ||||
|   #define SDIO_SUPPORT                            // Use SDIO for onboard SD | ||||
|  | ||||
|   #ifndef SDIO_SUPPORT | ||||
|   | ||||
		Reference in New Issue
	
	Block a user