mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-27 08:14:31 +02:00
Add SPI pin customization support
This commit is contained in:
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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;
|
||||
|
@@ -44,6 +44,10 @@ void system_ini() // Renamed from system_init() due to conflict with esp32 files
|
||||
#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
|
||||
}
|
||||
|
||||
void IRAM_ATTR isr_control_inputs()
|
||||
|
Reference in New Issue
Block a user