Skip to content

Commit

Permalink
MKS Robin Mini uses ONBOARD_SPI_DEVICE (#19460)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjasonsmith authored Sep 23, 2020
1 parent 90bc199 commit 023cb54
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
16 changes: 8 additions & 8 deletions Marlin/src/HAL/STM32F1/onboard_sd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
#include "fastio.h"

#if HAS_SHARED_MEDIA
#ifndef ON_BOARD_SPI_DEVICE
#define ON_BOARD_SPI_DEVICE SPI_DEVICE
#ifndef ONBOARD_SPI_DEVICE
#define ONBOARD_SPI_DEVICE SPI_DEVICE
#endif
#define ONBOARD_SD_SPI SPI
#else
SPIClass OnBoardSPI(ON_BOARD_SPI_DEVICE);
#define ONBOARD_SD_SPI OnBoardSPI
SPIClass OnboardSPI(ONBOARD_SPI_DEVICE);
#define ONBOARD_SD_SPI OnboardSPI
#endif

#if ON_BOARD_SPI_DEVICE == 1
#if ONBOARD_SPI_DEVICE == 1
#define SPI_CLOCK_MAX SPI_BAUD_PCLK_DIV_4
#else
#define SPI_CLOCK_MAX SPI_BAUD_PCLK_DIV_2
#endif

#define CS_LOW() WRITE(ONBOARD_SD_CS_PIN, LOW) /* Set OnBoardSPI cs low */
#define CS_HIGH() WRITE(ONBOARD_SD_CS_PIN, HIGH) /* Set OnBoardSPI cs high */
#define CS_LOW() WRITE(ONBOARD_SD_CS_PIN, LOW) /* Set OnboardSPI cs low */
#define CS_HIGH() WRITE(ONBOARD_SD_CS_PIN, HIGH) /* Set OnboardSPI cs high */

#define FCLK_FAST() ONBOARD_SD_SPI.setClockDivider(SPI_CLOCK_MAX)
#define FCLK_SLOW() ONBOARD_SD_SPI.setClockDivider(SPI_BAUD_PCLK_DIV_256)
Expand Down Expand Up @@ -152,7 +152,7 @@ static int select() { /* 1:OK, 0:Timeout */
/*-----------------------------------------------------------------------*/

static void power_on() { /* Enable SSP module and attach it to I/O pads */
ONBOARD_SD_SPI.setModule(ON_BOARD_SPI_DEVICE);
ONBOARD_SD_SPI.setModule(ONBOARD_SPI_DEVICE);
ONBOARD_SD_SPI.begin();
ONBOARD_SD_SPI.setBitOrder(MSBFIRST);
ONBOARD_SD_SPI.setDataMode(SPI_MODE0);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,5 @@
#error "SD CUSTOM_CABLE is not compatible with SKR E3 DIP."
#endif

#define ON_BOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,5 +236,5 @@
#error "SD CUSTOM_CABLE is not compatible with SKR Mini E3."
#endif

#define ON_BOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,5 @@
#define MOSI_PIN PA7
#define SS_PIN PA4
#endif
#define ON_BOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
#define SS_PIN PA4
#endif

#define ON_BOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SD_CS_PIN PA4 // Chip select for SD-NAND

#endif
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_CREALITY_V4.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
//
#define SD_DETECT_PIN PC7
#define SDCARD_CONNECTION ONBOARD
#define ON_BOARD_SPI_DEVICE 1
#define ONBOARD_SPI_DEVICE 1
#define ONBOARD_SD_CS_PIN PA4 // SDSS
#define SDIO_SUPPORT
#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
#define SDIO_SUPPORT
#define SDIO_CLOCK 4500000 // 4.5 MHz
#define SD_DETECT_PIN PD12
#define ONBOARD_SPI_DEVICE 1 // SPI1
#define ONBOARD_SD_CS_PIN PC11

//
Expand Down

0 comments on commit 023cb54

Please sign in to comment.