1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-08-27 16:19:57 +02:00

Add SPI pin customization support

This commit is contained in:
Luc
2019-08-29 16:25:17 +02:00
parent b3cd36b1b1
commit 55165a7908
4 changed files with 14 additions and 2 deletions

View File

@@ -36,6 +36,14 @@
*/
//Set your pine definition
//let -1 to use default board pin
#define GRBL_SPI_SS -1
#define GRBL_SPI_MOSI -1
#define GRBL_SPI_MIS0 -1
#define GRBL_SPI_SCK -1
//Set you frequency
#define GRBL_SPI_FREQ 4000000
#ifdef CPU_MAP_ESP32
// This is the CPU Map for the ESP32 CNC Controller R2

View File

@@ -20,7 +20,7 @@
// Grbl versioning system
#define GRBL_VERSION "1.1f"
#define GRBL_VERSION_BUILD "20190708"
#define GRBL_VERSION_BUILD "20190829"
//#include <sdkconfig.h>
#include <Arduino.h>

View File

@@ -200,7 +200,7 @@ uint8_t get_sd_state(bool refresh)
sd_state = SDCARD_NOT_PRESENT;
//using default value for speed ? should be parameter
//refresh content if card was removed
if (SD.begin()) {
if (SD.begin((GRBL_SPI_SS == -1)?SS:GRBL_SPI_SS, SPI, GRBL_SPI_FREQ)) {
if ( SD.cardSize() > 0 )sd_state = SDCARD_IDLE;
}
return sd_state;

View File

@@ -43,6 +43,10 @@ void system_ini() // Renamed from system_init() due to conflict with esp32 files
attachInterrupt(digitalPinToInterrupt(CONTROL_CYCLE_START_PIN), isr_control_inputs, CHANGE);
#endif
#endif
//customize pin definition if needed
#if (GRBL_SPI_SS != -1) || (GRBL_SPI_MIS0 != -1) || (GRBL_SPI_MOSI != -1) || (GRBL_SPI_SCK != -1)
SPI.begin(GRBL_SPI_SCK, GRBL_SPI_MIS0, GRBL_SPI_MOSI, GRBL_SPI_SS);
#endif
}