🎨 Update MKSPWC, some other pins (#22557)

This commit is contained in:
Scott Lahteine 2021-08-13 16:32:25 -05:00 committed by Scott Lahteine
parent e62486a610
commit eb0d80cb19
41 changed files with 279 additions and 321 deletions

View file

@ -367,6 +367,7 @@
//#define PSU_NAME "Power Supply"
#if ENABLED(PSU_CONTROL)
//#define MKS_PWC // Using the MKS PWC add-on
//#define PS_OFF_CONFIRM // Confirm dialog when power off
//#define PS_OFF_SOUND // Beep 1s when power off
#define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box

View file

@ -594,18 +594,14 @@
SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS);
SPI_Enable(SPI0);
SET_OUTPUT(DAC0_SYNC);
SET_OUTPUT(DAC0_SYNC_PIN);
#if HAS_MULTI_EXTRUDER
SET_OUTPUT(DAC1_SYNC);
WRITE(DAC1_SYNC, HIGH);
OUT_WRITE(DAC1_SYNC_PIN, HIGH);
#endif
SET_OUTPUT(SPI_EEPROM1_CS);
SET_OUTPUT(SPI_EEPROM2_CS);
SET_OUTPUT(SPI_FLASH_CS);
WRITE(DAC0_SYNC, HIGH);
WRITE(SPI_EEPROM1_CS, HIGH);
WRITE(SPI_EEPROM2_CS, HIGH);
WRITE(SPI_FLASH_CS, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
OUT_WRITE(SPI_EEPROM1_CS_PIN, HIGH);
OUT_WRITE(SPI_EEPROM2_CS_PIN, HIGH);
OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
WRITE(SD_SS_PIN, HIGH);
OUT_WRITE(SDSS, LOW);

View file

@ -44,7 +44,7 @@ bool PersistentStore::access_start() {
SET_OUTPUT(BOARD_SPI1_SCK_PIN);
SET_OUTPUT(BOARD_SPI1_MOSI_PIN);
SET_INPUT(BOARD_SPI1_MISO_PIN);
SET_OUTPUT(SPI_EEPROM1_CS);
SET_OUTPUT(SPI_EEPROM1_CS_PIN);
#endif
spiInit(0);
#endif

View file

@ -49,8 +49,8 @@ static void _eeprom_begin(uint8_t * const pos, const uint8_t cmd) {
(unsigned(pos) >> 8) & 0xFF, // Address High
unsigned(pos) & 0xFF // Address Low
};
WRITE(SPI_EEPROM1_CS, HIGH); // Usually free already
WRITE(SPI_EEPROM1_CS, LOW); // Activate the Bus
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Usually free already
WRITE(SPI_EEPROM1_CS_PIN, LOW); // Activate the Bus
spiSend(SPI_CHAN_EEPROM1, eeprom_temp, 3);
// Leave the Bus in-use
}
@ -60,23 +60,23 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
const uint8_t v = spiRec(SPI_CHAN_EEPROM1); // After READ a value sits on the Bus
WRITE(SPI_EEPROM1_CS, HIGH); // Done with device
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with device
return v;
}
void eeprom_write_byte(uint8_t *pos, uint8_t value) {
const uint8_t eeprom_temp = CMD_WREN;
WRITE(SPI_EEPROM1_CS, LOW);
WRITE(SPI_EEPROM1_CS_PIN, LOW);
spiSend(SPI_CHAN_EEPROM1, &eeprom_temp, 1); // Write Enable
WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus
delay(1); // For a small amount of time
_eeprom_begin(pos, CMD_WRITE); // Set write address and begin transmission
spiSend(SPI_CHAN_EEPROM1, value); // Send the value to be written
WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus
delay(EEPROM_WRITE_DELAY); // Give page write time to complete
}

View file

@ -1192,7 +1192,7 @@ void setup() {
#if HAS_SUICIDE
SETUP_LOG("SUICIDE_PIN");
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE);
#endif
#ifdef JTAGSWD_RESET

View file

@ -84,7 +84,7 @@ extern bool wait_for_heatup;
bool pin_is_protected(const pin_t pin);
#if HAS_SUICIDE
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_STATE); }
#endif
#if HAS_KILL

View file

@ -20,35 +20,35 @@ void dac084s085::begin() {
uint8_t externalDac_buf[] = { 0x20, 0x00 }; // all off
// All SPI chip-select HIGH
SET_OUTPUT(DAC0_SYNC);
SET_OUTPUT(DAC0_SYNC_PIN);
#if HAS_MULTI_EXTRUDER
SET_OUTPUT(DAC1_SYNC);
SET_OUTPUT(DAC1_SYNC_PIN);
#endif
cshigh();
spiBegin();
//init onboard DAC
DELAY_US(2);
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
#if HAS_MULTI_EXTRUDER
//init Piggy DAC
DELAY_US(2);
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
#endif
return;
@ -66,18 +66,18 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
cshigh();
if (channel > 3) { // DAC Piggy E1,E2,E3
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC1_SYNC, LOW);
WRITE(DAC1_SYNC_PIN, LOW);
}
else { // DAC onboard X,Y,Z,E0
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);
DELAY_US(2);
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
DELAY_US(2);
WRITE(DAC0_SYNC, LOW);
WRITE(DAC0_SYNC_PIN, LOW);
}
DELAY_US(2);
@ -85,13 +85,13 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
}
void dac084s085::cshigh() {
WRITE(DAC0_SYNC, HIGH);
WRITE(DAC0_SYNC_PIN, HIGH);
#if HAS_MULTI_EXTRUDER
WRITE(DAC1_SYNC, HIGH);
WRITE(DAC1_SYNC_PIN, HIGH);
#endif
WRITE(SPI_EEPROM1_CS, HIGH);
WRITE(SPI_EEPROM2_CS, HIGH);
WRITE(SPI_FLASH_CS, HIGH);
WRITE(SPI_EEPROM1_CS_PIN, HIGH);
WRITE(SPI_EEPROM2_CS_PIN, HIGH);
WRITE(SPI_FLASH_CS_PIN, HIGH);
WRITE(SD_SS_PIN, HIGH);
}

View file

@ -60,7 +60,7 @@
* a print without suicide...
*/
#if HAS_SUICIDE
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE);
#endif
TERN_(HAS_LCD_MENU, ui.reset_status());

View file

@ -3475,6 +3475,13 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
#endif
#endif
/**
* Validate MKS_PWC
*/
#if ENABLED(MKS_PWC) && PSU_ACTIVE_STATE != HIGH
#error "MKS_PWC requires PSU_ACTIVE_STATE to be set HIGH."
#endif
/**
* Ensure this option is set intentionally
*/

View file

@ -30,7 +30,7 @@
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
#define MT_DET_1_PIN 1
#define MT_DET_2_PIN 2
#define MT_DET_PIN_INVERTING false
#define MT_DET_PIN_STATE LOW
#endif
#define MKS_FINSH

View file

@ -1495,17 +1495,17 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) {
break;
case UNRUNOUT_STATUS:
if (READ(MT_DET_1_PIN) == LOW)
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
runout_mks.runout_status = RUNOUT_STATUS;
break;
case RUNOUT_BEGIN_STATUS:
if (READ(MT_DET_1_PIN) == HIGH)
if (READ(MT_DET_1_PIN) != MT_DET_PIN_STATE)
runout_mks.runout_status = RUNOUT_WAITTING_STATUS;
break;
case RUNOUT_WAITTING_STATUS:
if (READ(MT_DET_1_PIN) == LOW)
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
runout_mks.runout_status = RUNOUT_BEGIN_STATUS;
break;

View file

@ -163,7 +163,7 @@ void filament_check() {
#endif
#if PIN_EXISTS(MT_DET_1)
static int fil_det_count_1 = 0;
if (READ(MT_DET_1_PIN) == MT_DET_PIN_INVERTING)
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
fil_det_count_1++;
else if (fil_det_count_1 > 0)
fil_det_count_1--;
@ -171,7 +171,7 @@ void filament_check() {
#if PIN_EXISTS(MT_DET_2)
static int fil_det_count_2 = 0;
if (READ(MT_DET_2_PIN) == MT_DET_PIN_INVERTING)
if (READ(MT_DET_2_PIN) == MT_DET_PIN_STATE)
fil_det_count_2++;
else if (fil_det_count_2 > 0)
fil_det_count_2--;
@ -179,7 +179,7 @@ void filament_check() {
#if PIN_EXISTS(MT_DET_3)
static int fil_det_count_3 = 0;
if (READ(MT_DET_3_PIN) == MT_DET_PIN_INVERTING)
if (READ(MT_DET_3_PIN) == MT_DET_PIN_STATE)
fil_det_count_3++;
else if (fil_det_count_3 > 0)
fil_det_count_3--;

View file

@ -28,26 +28,14 @@
W25QXXFlash W25QXX;
#ifndef SPI_FLASH_MISO_PIN
#define SPI_FLASH_MISO_PIN W25QXX_MISO_PIN
#endif
#ifndef SPI_FLASH_MOSI_PIN
#define SPI_FLASH_MOSI_PIN W25QXX_MOSI_PIN
#endif
#ifndef SPI_FLASH_SCK_PIN
#define SPI_FLASH_SCK_PIN W25QXX_SCK_PIN
#endif
#ifndef SPI_FLASH_CS_PIN
#define SPI_FLASH_CS_PIN W25QXX_CS_PIN
#endif
#ifndef NC
#define NC -1
#endif
MarlinSPI W25QXXFlash::mySPI(SPI_FLASH_MOSI_PIN, SPI_FLASH_MISO_PIN, SPI_FLASH_SCK_PIN, NC);
#define W25QXX_CS_H OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
#define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
#define SPI_FLASH_CS_H() OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
#define SPI_FLASH_CS_L() OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
bool flash_dma_mode = true;
@ -134,24 +122,24 @@ void W25QXXFlash::spi_flash_SendBlock(uint8_t token, const uint8_t *buf) {
uint16_t W25QXXFlash::W25QXX_ReadID(void) {
uint16_t Temp = 0;
W25QXX_CS_L;
SPI_FLASH_CS_L();
spi_flash_Send(0x90);
spi_flash_Send(0x00);
spi_flash_Send(0x00);
spi_flash_Send(0x00);
Temp |= spi_flash_Rec() << 8;
Temp |= spi_flash_Rec();
W25QXX_CS_H;
SPI_FLASH_CS_H();
return Temp;
}
void W25QXXFlash::SPI_FLASH_WriteEnable(void) {
// Select the FLASH: Chip Select low
W25QXX_CS_L;
SPI_FLASH_CS_L();
// Send "Write Enable" instruction
spi_flash_Send(W25X_WriteEnable);
// Deselect the FLASH: Chip Select high
W25QXX_CS_H;
SPI_FLASH_CS_H();
}
/*******************************************************************************
@ -167,7 +155,7 @@ void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) {
uint8_t FLASH_Status = 0;
// Select the FLASH: Chip Select low
W25QXX_CS_L;
SPI_FLASH_CS_L();
// Send "Read Status Register" instruction
spi_flash_Send(W25X_ReadStatusReg);
@ -179,7 +167,7 @@ void W25QXXFlash::SPI_FLASH_WaitForWriteEnd(void) {
while ((FLASH_Status & WIP_Flag) == 0x01); // Write in progress
// Deselect the FLASH: Chip Select high
W25QXX_CS_H;
SPI_FLASH_CS_H();
}
void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
@ -188,7 +176,7 @@ void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
// Sector Erase
// Select the FLASH: Chip Select low
W25QXX_CS_L;
SPI_FLASH_CS_L();
// Send Sector Erase instruction
spi_flash_Send(W25X_SectorErase);
// Send SectorAddr high nybble address byte
@ -199,14 +187,14 @@ void W25QXXFlash::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
spi_flash_Send(SectorAddr & 0xFF);
// Deselect the FLASH: Chip Select high
W25QXX_CS_H;
SPI_FLASH_CS_H();
// Wait the end of Flash writing
SPI_FLASH_WaitForWriteEnd();
}
void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
SPI_FLASH_WriteEnable();
W25QXX_CS_L;
SPI_FLASH_CS_L();
// Send Sector Erase instruction
spi_flash_Send(W25X_BlockErase);
// Send SectorAddr high nybble address byte
@ -216,7 +204,7 @@ void W25QXXFlash::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
// Send SectorAddr low nybble address byte
spi_flash_Send(BlockAddr & 0xFF);
W25QXX_CS_H;
SPI_FLASH_CS_H();
SPI_FLASH_WaitForWriteEnd();
}
@ -234,12 +222,12 @@ void W25QXXFlash::SPI_FLASH_BulkErase(void) {
// Bulk Erase
// Select the FLASH: Chip Select low
W25QXX_CS_L;
SPI_FLASH_CS_L();
// Send Bulk Erase instruction
spi_flash_Send(W25X_ChipErase);
// Deselect the FLASH: Chip Select high
W25QXX_CS_H;
SPI_FLASH_CS_H();
// Wait the end of Flash writing
SPI_FLASH_WaitForWriteEnd();
}
@ -262,7 +250,7 @@ void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint
SPI_FLASH_WriteEnable();
// Select the FLASH: Chip Select low
W25QXX_CS_L;
SPI_FLASH_CS_L();
// Send "Write to Memory " instruction
spi_flash_Send(W25X_PageProgram);
// Send WriteAddr high nybble address byte to write to
@ -283,7 +271,7 @@ void W25QXXFlash::SPI_FLASH_PageWrite(uint8_t *pBuffer, uint32_t WriteAddr, uint
}
// Deselect the FLASH: Chip Select high
W25QXX_CS_H;
SPI_FLASH_CS_H();
// Wait the end of Flash writing
SPI_FLASH_WaitForWriteEnd();
@ -366,7 +354,7 @@ void W25QXXFlash::SPI_FLASH_BufferWrite(uint8_t *pBuffer, uint32_t WriteAddr, ui
*******************************************************************************/
void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
// Select the FLASH: Chip Select low
W25QXX_CS_L;
SPI_FLASH_CS_L();
// Send "Read from Memory " instruction
spi_flash_Send(W25X_ReadData);
@ -389,7 +377,7 @@ void W25QXXFlash::SPI_FLASH_BufferRead(uint8_t *pBuffer, uint32_t ReadAddr, uint
else
spi_flash_Read(pBuffer, NumByteToRead);
W25QXX_CS_H;
SPI_FLASH_CS_H();
}
#endif // HAS_SPI_FLASH

View file

@ -416,10 +416,10 @@
#if HAS_SPI_FLASH
#define SPI_DEVICE 1
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN 31
#define W25QXX_MOSI_PIN SD_MOSI_PIN
#define W25QXX_MISO_PIN SD_MISO_PIN
#define W25QXX_SCK_PIN SD_SCK_PIN
#define SPI_FLASH_CS_PIN 31
#define SPI_FLASH_MOSI_PIN SD_MOSI_PIN
#define SPI_FLASH_MISO_PIN SD_MISO_PIN
#define SPI_FLASH_SCK_PIN SD_SCK_PIN
#endif
#define TFT_BUFFER_SIZE 0xFFFF

View file

@ -138,14 +138,10 @@
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#ifndef PS_ON_PIN
#if ENABLED(MKS_PWC)
#define PS_ON_PIN P0_25 // SERVO
#endif
#ifndef KILL_PIN
#define KILL_PIN P1_29 // Z+
#define KILL_PIN_STATE HIGH
#endif
#endif
//

View file

@ -218,14 +218,10 @@
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#ifndef PS_ON_PIN
#if ENABLED(MKS_PWC)
#define PS_ON_PIN P2_00 // SERVO
#endif
#ifndef KILL_PIN
#define KILL_PIN P1_24 // Z+
#define KILL_PIN_STATE HIGH
#endif
#endif
//

View file

@ -229,14 +229,10 @@
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#ifndef PS_ON_PIN
#define PS_ON_PIN P2_00 // Suggestion (SERVO)
#endif
#ifndef KILL_PIN
#define KILL_PIN P1_24 // Suggestion (Z+)
#if ENABLED(MKS_PWC)
#define PS_ON_PIN P2_00 // SERVO
#define KILL_PIN P1_24 // Z+
#define KILL_PIN_STATE HIGH
#endif
#endif
//

View file

@ -291,11 +291,11 @@
#if PIN_EXISTS(DAC_DISABLE)
REPORT_NAME_DIGITAL(__LINE__, DAC_DISABLE_PIN)
#endif
#if defined(DAC0_SYNC) && DAC0_SYNC >= 0
REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC)
#if PIN_EXISTS(DAC0_SYNC)
REPORT_NAME_DIGITAL(__LINE__, DAC0_SYNC_PIN)
#endif
#if defined(DAC1_SYNC) && DAC1_SYNC >= 0
REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC)
#if PIN_EXISTS(DAC1_SYNC)
REPORT_NAME_DIGITAL(__LINE__, DAC1_SYNC_PIN)
#endif
#if PIN_EXISTS(DEBUG)
REPORT_NAME_DIGITAL(__LINE__, DEBUG_PIN)
@ -974,14 +974,14 @@
#if defined(SPARE_IO) && SPARE_IO >= 0
REPORT_NAME_DIGITAL(__LINE__, SPARE_IO)
#endif
#if defined(SPI_EEPROM1_CS) && SPI_EEPROM1_CS >= 0
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS)
#if PIN_EXISTS(SPI_EEPROM1_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM1_CS_PIN)
#endif
#if defined(SPI_EEPROM2_CS) && SPI_EEPROM2_CS >= 0
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS)
#if PIN_EXISTS(SPI_EEPROM2_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_EEPROM2_CS_PIN)
#endif
#if defined(SPI_FLASH_CS) && SPI_FLASH_CS >= 0
REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS)
#if PIN_EXISTS(SPI_FLASH_CS)
REPORT_NAME_DIGITAL(__LINE__, SPI_FLASH_CS_PIN)
#endif
#if PIN_EXISTS(SPINDLE_DIR)
REPORT_NAME_DIGITAL(__LINE__, SPINDLE_DIR_PIN)

View file

@ -391,8 +391,8 @@
#ifndef SUICIDE_PIN
#define SUICIDE_PIN -1
#endif
#ifndef SUICIDE_PIN_INVERTING
#define SUICIDE_PIN_INVERTING false
#ifndef SUICIDE_PIN_STATE
#define SUICIDE_PIN_STATE LOW
#endif
#ifndef NUM_SERVO_PLUGS

View file

@ -34,7 +34,7 @@
#endif
#define RESET_PIN 30
#define SPI_FLASH_CS 83
#define SPI_FLASH_CS_PIN 83
//
// Servos

View file

@ -63,6 +63,6 @@
#define EXP4_PIN 12 // PS_ON_PIN
#define SUICIDE_PIN 12 // Used by CR2020 Industrial series
#ifndef SUICIDE_PIN_INVERTING
#define SUICIDE_PIN_INVERTING true
#ifndef SUICIDE_PIN_STATE
#define SUICIDE_PIN_STATE HIGH
#endif

View file

@ -123,20 +123,20 @@
#define SPI_CHAN_DAC 1
#define DAC0_SYNC 53 // PB14
#define DAC1_SYNC 6 // PC24
#define DAC0_SYNC_PIN 53 // PB14
#define DAC1_SYNC_PIN 6 // PC24
// 64K SPI EEPROM
#define SPI_EEPROM
#define SPI_CHAN_EEPROM1 2
#define SPI_EEPROM1_CS 25 // PD0
#define SPI_EEPROM1_CS_PIN 25 // PD0
// 2K SPI EEPROM
#define SPI_EEPROM2_CS 26 // PD1
#define SPI_EEPROM2_CS_PIN 26 // PD1
// FLASH SPI
// 32Mb
#define SPI_FLASH_CS 23 // PA14
#define SPI_FLASH_CS_PIN 23 // PA14
//
// LCD / Controller

View file

@ -190,11 +190,11 @@
//#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ?
//#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM
//#define SPI_EEPROM2_CS ?
//#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH
//#define SPI_FLASH_CS ?
//#define SPI_FLASH_CS_PIN ?
//
// LCD / Controller

View file

@ -176,11 +176,11 @@
//#define EEPROM_SD // EEPROM on SDCARD
//#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ?
//#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM
//#define SPI_EEPROM2_CS ?
//#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH
//#define SPI_FLASH_CS ?
//#define SPI_FLASH_CS_PIN ?
//
// LCD / Controller

View file

@ -137,13 +137,13 @@
// SPI Buses
//
#define DAC0_SYNC 53 // PB14
#define DAC0_SYNC_PIN 53 // PB14
#define SPI_CHAN_DAC 1
#define SPI_CHAN_EEPROM1 -1
#define SPI_EEPROM1_CS -1
#define SPI_EEPROM2_CS -1
#define SPI_FLASH_CS -1
#define SPI_EEPROM1_CS_PIN -1
#define SPI_EEPROM2_CS_PIN -1
#define SPI_FLASH_CS_PIN -1
#define SD_SCK_PIN 76
#define SD_MISO_PIN 74

View file

@ -179,6 +179,6 @@
#endif
#define SUICIDE_PIN PC13
#ifndef SUICIDE_PIN_INVERTING
#define SUICIDE_PIN_INVERTING false
#ifndef SUICIDE_PIN_STATE
#define SUICIDE_PIN_STATE LOW
#endif

View file

@ -120,10 +120,10 @@
#endif
// SPI 2
#define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
//
// TFT with FSMC interface

View file

@ -61,13 +61,13 @@
// SPI
//#define SPI_EEPROM // EEPROM on SPI-0
//#define SPI_CHAN_EEPROM1 ?
//#define SPI_EEPROM1_CS ?
//#define SPI_EEPROM1_CS_PIN ?
// 2K EEPROM
//#define SPI_EEPROM2_CS ?
//#define SPI_EEPROM2_CS_PIN ?
// 32Mb FLASH
//#define SPI_FLASH_CS ?
//#define SPI_FLASH_CS_PIN ?
#endif
//

View file

@ -73,10 +73,10 @@
#if HAS_SPI_FLASH
// SPI 2
#define W25QXX_CS_PIN PB12 // SPI2_NSS / Flash chip-select
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif
//
@ -222,9 +222,11 @@
//#define PS_ON_PIN PA3 // PW_CN /PW_OFF
#endif
#define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_2_PIN PE6 // FALA_CRTL
#define MT_DET_PIN_INVERTING false
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_STATE LOW
#endif
//
// LED / NEOPixel

View file

@ -170,18 +170,18 @@
#if ENABLED(SPI_EEPROM)
// SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits)
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PC5 // pin 34
#define EEPROM_SCK BOARD_SPI1_SCK_PIN // PA5 pin 30
#define EEPROM_MISO BOARD_SPI1_MISO_PIN // PA6 pin 31
#define EEPROM_MOSI BOARD_SPI1_MOSI_PIN // PA7 pin 32
#define SPI_EEPROM1_CS_PIN PC5 // pin 34
#define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 pin 30
#define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 pin 31
#define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#elif HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x40000U // limit to 256KB (M993 will reboot with 512)
#define W25QXX_CS_PIN PC5
#define W25QXX_MOSI_PIN PA7
#define W25QXX_MISO_PIN PA6
#define W25QXX_SCK_PIN PA5
#define SPI_FLASH_CS_PIN PC5
#define SPI_FLASH_MOSI_PIN PA7
#define SPI_FLASH_MISO_PIN PA6
#define SPI_FLASH_SCK_PIN PA5
#elif ENABLED(FLASH_EEPROM_EMULATION)
// SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
#define EEPROM_PAGE_SIZE (0x800U) // 2KB

View file

@ -275,8 +275,8 @@
#define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x800000 // 8MB
#define W25QXX_CS_PIN PG9
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PG9
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif

View file

@ -183,19 +183,19 @@
// Misc. Functions
//
#if HAS_TFT_LVGL_UI
#if ENABLED(PSU_CONTROL) // MKSPWC
#define SUICIDE_PIN PB2 // PW_OFF
#define SUICIDE_PIN_INVERTING false
#define KILL_PIN PA2 // PW_DET
#if ENABLED(MKS_PWC)
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_STATE LOW
#define KILL_PIN PA2
#define KILL_PIN_STATE HIGH
#endif
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#define MT_DET_1_PIN PA4
#define MT_DET_PIN_STATE LOW
#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
#define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN
#define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9
#if ENABLED(MKS_TEST)
#define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
@ -363,10 +363,10 @@
#define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif
#ifndef BEEPER_PIN

View file

@ -129,14 +129,10 @@
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#ifndef PS_ON_PIN
#if ENABLED(MKS_PWC)
#define PS_ON_PIN PA14 // PW_OFF
#endif
#ifndef KILL_PIN
#define KILL_PIN PB10 // PW_DET
#define KILL_PIN_STATE HIGH
#endif
#endif
/**

View file

@ -119,8 +119,10 @@
#define POWER_LOSS_PIN PA2 // PW_DET
#define PS_ON_PIN PA3 // PW_OFF
#define MT_DET_1_PIN PA4
#define MT_DET_PIN_INVERTING false
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_PIN_STATE LOW
#endif
#define WIFI_IO0_PIN PC13
@ -194,8 +196,8 @@
#define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 // Flash chip-select
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12 // Flash chip-select
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif

View file

@ -130,33 +130,30 @@
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#if HAS_TFT_LVGL_UI
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
#if ENABLED(MKS_PWC)
#if ENABLED(TFT_LVGL_UI)
#undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PB2 // PW_OFF
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN PB2 // SUICIDE
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2
#define KILL_PIN_STATE HIGH
#endif
#else
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_INVERTING false
#endif
//
// Misc. Functions
//
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#define MT_DET_1_PIN PA4
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_STATE LOW
#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
#define WIFI_RESET_PIN PA5 // MKS ESP WIFI RESET PIN
#define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PA5
#else
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PB2 // PW_OFF
@ -221,8 +218,8 @@
#define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif

View file

@ -194,34 +194,30 @@
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#if HAS_TFT_LVGL_UI
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
#if ENABLED(MKS_PWC)
#if ENABLED(TFT_LVGL_UI)
#undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PB2 // PW_OFF
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN PB2 // SUICIDE
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2
#define KILL_PIN_STATE HIGH
#endif
#else
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_INVERTING false
#endif
//
// Misc. Functions
//
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_STATE LOW
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
#define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN
#define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9
#if ENABLED(MKS_TEST)
#define MKS_TEST_POWER_LOSS_PIN PA2 // PW_DET
@ -390,10 +386,10 @@
#define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif
#ifndef BEEPER_PIN

View file

@ -186,20 +186,17 @@
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#if HAS_TFT_LVGL_UI
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
#if ENABLED(MKS_PWC)
#if ENABLED(TFT_LVGL_UI)
#undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PG11
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PG11 // PW_OFF
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN PG11 // SUICIDE
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2
#define KILL_PIN_STATE HIGH
#endif
#else
#define SUICIDE_PIN PG11
#define SUICIDE_PIN_INVERTING false
#endif
//
@ -318,8 +315,8 @@
#define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 // Flash chip-select
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12 // Flash chip-select
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif

View file

@ -179,10 +179,10 @@
#if ENABLED(SPI_EEPROM)
// Lerdge has an SPI EEPROM Winbond W25Q128 (128Mbits) https://www.pjrc.com/teensy/W25Q128FV.pdf
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS PB12 // datasheet: /CS pin, found with multimeter, not tested
#define EEPROM_SCK PB13 // datasheet: CLK pin, found with multimeter, not tested
#define EEPROM_MISO PB14 // datasheet: DO pin, found with multimeter, not tested
#define EEPROM_MOSI PB15 // datasheet: DI pin, found with multimeter, not tested
#define SPI_EEPROM1_CS_PIN PB12 // datasheet: /CS pin, found with multimeter, not tested
#define EEPROM_SCK_PIN PB13 // datasheet: CLK pin, found with multimeter, not tested
#define EEPROM_MISO_PIN PB14 // datasheet: DO pin, found with multimeter, not tested
#define EEPROM_MOSI_PIN PB15 // datasheet: DI pin, found with multimeter, not tested
#define EEPROM_PAGE_SIZE 0x1000U // 4KB (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64KB for now...
#else

View file

@ -210,32 +210,24 @@
//
// Misc. Functions
//
#define MT_DET_1 PC5 // Y+
#define MT_DET_2 PB12 // Z+
#define PW_DET PC5 // Y+
#define PW_OFF PB12 // Z+
#define MT_DET_1_PIN PW_DET
#define MT_DET_2_PIN PW_OFF
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN MT_DET_1
#define FIL_RUNOUT_PIN MT_DET_1_PIN
#endif
#ifndef FIL_RUNOUT2_PIN
#define FIL_RUNOUT2_PIN MT_DET_2
#define FIL_RUNOUT2_PIN MT_DET_2_PIN
#endif
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#ifndef PS_ON_PIN
#define PS_ON_PIN MT_DET_2 // Z+
#endif
#ifndef KILL_PIN
#define KILL_PIN MT_DET_1 // Y+
#define KILL_PIN_STATE HIGH
#endif
#else
#define PW_DET MT_DET_1
#define PW_OFF MT_DET_2
#define POWER_LOSS_PIN PW_DET
#if ENABLED(MKS_PWC)
#define PS_ON_PIN PW_OFF
#define KILL_PIN PW_DET
#define KILL_PIN_STATE HIGH
#endif
// Random Info

View file

@ -178,9 +178,11 @@
//
// Misc. Functions
//
#define MT_DET_1_PIN PA4
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
#if HAS_TFT_LVGL_UI
#define MT_DET_1_PIN PA4 // MT_DET
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_STATE LOW
#endif
#ifndef FIL_RUNOUT_PIN
#define FIL_RUNOUT_PIN MT_DET_1_PIN
@ -189,35 +191,29 @@
#define FIL_RUNOUT2_PIN MT_DET_2_PIN
#endif
//
// Enable MKSPWC support
//
#ifndef POWER_LOSS_PIN
#define POWER_LOSS_PIN PA13 // PW_DET
#endif
//#define SUICIDE_PIN PB2
//#define LED_PIN PB2
//#define KILL_PIN PA2
//#define KILL_PIN_STATE HIGH
//#define KILL_PIN_STATE LOW
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
#if HAS_TFT_LVGL_UI
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
#if ENABLED(MKS_PWC)
#if ENABLED(TFT_LVGL_UI)
#undef PSU_CONTROL
#undef MKS_PWC
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_STATE LOW
#else
#define PS_ON_PIN PB2 // PW_OFF
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN PB2 // SUICIDE
#endif
#ifndef KILL_PIN
#define KILL_PIN PA13 // PW_DET
#define KILL_PIN_STATE HIGH
#endif
#else
#define SUICIDE_PIN PB2
#define SUICIDE_PIN_INVERTING false
#endif
#ifndef POWER_LOSS_PIN
#define POWER_LOSS_PIN PA13 // PW_DET
#endif
// Random Info
@ -232,9 +228,9 @@
// MKS WIFI MODULE
#if ENABLED(MKS_WIFI_MODULE)
#define WIFI_IO0_PIN PC13 // MKS ESP WIFI IO0 PIN
#define WIFI_IO1_PIN PC7 // MKS ESP WIFI IO1 PIN
#define WIFI_RESET_PIN PE9 // MKS ESP WIFI RESET PIN
#define WIFI_IO0_PIN PC13
#define WIFI_IO1_PIN PC7
#define WIFI_RESET_PIN PE9
#endif
// MKS TEST
@ -276,10 +272,10 @@
#define SPI_DEVICE 2
#define SPI_FLASH_SIZE 0x1000000
#if ENABLED(SPI_FLASH)
#define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PC3
#define W25QXX_MISO_PIN PC2
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PC3
#define SPI_FLASH_MISO_PIN PC2
#define SPI_FLASH_SCK_PIN PB13
#endif
/**

View file

@ -195,18 +195,18 @@
//
// Misc. Functions
//
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PA3 // PW_OFF
//
// Power Supply Control
//
#if ENABLED(PSU_CONTROL) // MKSPWC
//#define SUICIDE_PIN PB2 // LED
//#define KILL_PIN PA2 // PW_DET
//#define KILL_PIN_STATE HIGH
#if ENABLED(MKS_PWC)
#define SUICIDE_PIN PB2
#define KILL_PIN PA2
#define KILL_PIN_STATE LOW
#else
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define LED_PIN PB2
#define LED_PIN PB2
#endif
#ifndef SDCARD_CONNECTION
@ -255,10 +255,10 @@
#define SPI_DEVICE 2
#define SPI_FLASH_SIZE 0x1000000
#if ENABLED(SPI_FLASH)
#define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#endif
/**