From 8bd1547c3bb16cdce37412624161fab5b9d5ead6 Mon Sep 17 00:00:00 2001
From: Moritz Wirger <lj.moritorii@web.de>
Date: Fri, 15 Apr 2022 04:43:21 +0200
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20enwi=20ESPNP=20board=20support=20(#?=
 =?UTF-8?q?24029)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Marlin/src/core/boards.h                |   1 +
 Marlin/src/pins/esp32/pins_ENWI_ESPNP.h | 116 ++++++++++++++++++++++++
 Marlin/src/pins/pins.h                  |   2 +
 3 files changed, 119 insertions(+)
 create mode 100644 Marlin/src/pins/esp32/pins_ENWI_ESPNP.h

diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h
index d1cc971e51d..14303754820 100644
--- a/Marlin/src/core/boards.h
+++ b/Marlin/src/core/boards.h
@@ -441,6 +441,7 @@
 #define BOARD_PANDA_ZHU               6006  // Panda_ZHU
 #define BOARD_PANDA_M4                6007  // Panda_M4
 #define BOARD_MKS_TINYBEE             6008  // MKS TinyBee based on ESP32 (with I2S stepper stream)
+#define BOARD_ENWI_ESPNP              6009  // enwi ESPNP based on ESP32 (with I2S stepper stream)
 
 //
 // SAMD51 ARM Cortex M4
diff --git a/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h b/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h
new file mode 100644
index 00000000000..aff7f742edf
--- /dev/null
+++ b/Marlin/src/pins/esp32/pins_ENWI_ESPNP.h
@@ -0,0 +1,116 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2022 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 <https://www.gnu.org/licenses/>.
+ *
+ */
+#pragma once
+
+/**
+ * Espressif ESP32 (Tensilica Xtensa LX6) on ESPNP by enwi
+ * Website https://github.com/enwi/ESPNP
+ */
+
+#include "env_validate.h"
+
+#define BOARD_INFO_NAME      "ESPNP"
+#define DEFAULT_MACHINE_NAME "ESP Pick and Place"
+
+//
+// I2S (steppers & other output-only pins)
+//
+#define I2S_STEPPER_STREAM
+#define I2S_WS                                17
+#define I2S_BCK                               22
+#define I2S_DATA                              21
+
+//
+// Servos
+//
+#define SERVO0_PIN                            26
+#define SERVO1_PIN                            25
+
+//
+// Limit Switches
+//
+#define X_STOP_PIN                            36
+#define Y_STOP_PIN                            39
+#define Z_STOP_PIN                            34
+#define I_STOP_PIN                            35
+#define J_STOP_PIN                            05
+#define K_STOP_PIN                            16
+
+//
+// Steppers
+//
+#define X_ENABLE_PIN                         136
+#define X_DIR_PIN                            137
+#define X_STEP_PIN                           138
+#define X_CS_PIN                             139
+
+#define Y_ENABLE_PIN                         140
+#define Y_DIR_PIN                            141
+#define Y_STEP_PIN                           142
+#define Y_CS_PIN                             143
+
+#define Z_ENABLE_PIN                         144
+#define Z_DIR_PIN                            145
+#define Z_STEP_PIN                           146
+#define Z_CS_PIN                             147
+
+#define I_ENABLE_PIN                         148
+#define I_DIR_PIN                            149
+#define I_STEP_PIN                           150
+#define I_CS_PIN                             151
+
+#define J_ENABLE_PIN                         152
+#define J_DIR_PIN                            153
+#define J_STEP_PIN                           154
+#define J_CS_PIN                             155
+
+#define K_ENABLE_PIN                         156
+#define K_DIR_PIN                            157
+#define K_STEP_PIN                           158
+#define K_CS_PIN                             159
+
+// Reduce baud rate to improve software serial reliability
+#define TMC_BAUD_RATE                      19200
+
+//
+// Temperature Sensors
+//
+//#define TEMP_0_PIN                          36  // Analog Input
+//#define TEMP_BED_PIN                        39  // Analog Input
+
+// General use mosfets, useful for things like pumps and solenoids
+// Shift register pins 128, 129, 130 and 131 are broken out and can be used
+#define FAN_PIN                              132
+#define FAN1_PIN                             134
+#define FAN2_PIN                             135
+#define FAN3_PIN                             136
+
+// #define FAN_SOFT_PWM_REQUIRED // check if needed
+
+// Neopixel Rings
+#define NEOPIXEL_PIN                          14
+#define NEOPIXEL2_PIN                         27
+
+// SPI
+#define MISO_PIN                              19
+#define MOSI_PIN                              23
+#define SCK_PIN                               18
diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h
index 426ce1e48e7..202630ae4aa 100644
--- a/Marlin/src/pins/pins.h
+++ b/Marlin/src/pins/pins.h
@@ -731,6 +731,8 @@
   #include "esp32/pins_PANDA_M4.h"              // ESP32                                  env:PANDA
 #elif MB(MKS_TINYBEE)
   #include "esp32/pins_MKS_TINYBEE.h"           // ESP32                                  env:mks_tinybee
+#elif MB(ENWI_ESPNP)
+  #include "esp32/pins_ENWI_ESPNP.h"            // ESP32                                  env:esp32
 
 //
 // Adafruit Grand Central M4 (SAMD51 ARM Cortex-M4)