diff --git a/Grbl_Esp32/src/Machine/SPIBus.cpp b/Grbl_Esp32/src/Machine/SPIBus.cpp index e8644c3a..d57393d0 100644 --- a/Grbl_Esp32/src/Machine/SPIBus.cpp +++ b/Grbl_Esp32/src/Machine/SPIBus.cpp @@ -22,8 +22,8 @@ namespace Machine { void SPIBus::validate() const { - if (_ss.defined() || _miso.defined() || _mosi.defined() || _sck.defined()) { - Assert(_ss.defined(), "SPI SS pin should be configured once"); + if (_cs.defined() || _miso.defined() || _mosi.defined() || _sck.defined()) { + Assert(_cs.defined(), "SPI CS pin should be configured once"); Assert(_miso.defined(), "SPI MISO pin should be configured once"); Assert(_mosi.defined(), "SPI MOSI pin should be configured once"); Assert(_sck.defined(), "SPI SCK pin should be configured once"); @@ -31,30 +31,30 @@ namespace Machine { } void SPIBus::init() { - if (_ss.defined()) { // validation ensures the rest is also defined. - auto ssPin = _ss.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); + if (_cs.defined()) { // validation ensures the rest is also defined. + auto csPin = _cs.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); auto mosiPin = _mosi.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); auto sckPin = _sck.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); auto misoPin = _miso.getNative(Pin::Capabilities::Input | Pin::Capabilities::Native); - SPI.begin(sckPin, misoPin, mosiPin, ssPin); + SPI.begin(sckPin, misoPin, mosiPin, csPin); } } void SPIBus::group(Configuration::HandlerBase& handler) { - handler.item("ss", _ss); + handler.item("cs", _cs); handler.item("miso", _miso); handler.item("mosi", _mosi); handler.item("sck", _sck); } void SPIBus::afterParse() { - if (_ss.undefined() && _miso.undefined() && _mosi.undefined() && _sck.undefined()) { - // Default SPI miso, mosi, sck, ss pins to the "standard" gpios 19, 23, 18, 5 + if (_cs.undefined() && _miso.undefined() && _mosi.undefined() && _sck.undefined()) { + // Default SPI miso, mosi, sck, cs pins to the "standard" gpios 19, 23, 18, 5 _miso = Pin::create("gpio.19"); _mosi = Pin::create("gpio.23"); _sck = Pin::create("gpio.18"); - _ss = Pin::create("gpio.5"); + _cs = Pin::create("gpio.5"); } } } diff --git a/Grbl_Esp32/src/Machine/SPIBus.h b/Grbl_Esp32/src/Machine/SPIBus.h index 52262e43..21e2104e 100644 --- a/Grbl_Esp32/src/Machine/SPIBus.h +++ b/Grbl_Esp32/src/Machine/SPIBus.h @@ -25,7 +25,7 @@ namespace Machine { public: SPIBus() = default; - Pin _ss; + Pin _cs; Pin _miso; Pin _mosi; Pin _sck; diff --git a/Grbl_Esp32/src/Motors/TrinamicDriver.cpp b/Grbl_Esp32/src/Motors/TrinamicDriver.cpp index c34a4a8c..a6164e29 100644 --- a/Grbl_Esp32/src/Motors/TrinamicDriver.cpp +++ b/Grbl_Esp32/src/Motors/TrinamicDriver.cpp @@ -106,12 +106,12 @@ namespace Motors { auto spiConfig = config->_spi; if (spiConfig != nullptr) { - auto ssPin = _cs_pin.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); + auto csPin = _cs_pin.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); auto mosiPin = spiConfig->_mosi.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); auto sckPin = spiConfig->_sck.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); auto misoPin = spiConfig->_miso.getNative(Pin::Capabilities::Input | Pin::Capabilities::Native); - SPI.begin(sckPin, misoPin, mosiPin, ssPin); // this will get called for each motor, but does not seem to hurt anything + SPI.begin(sckPin, misoPin, mosiPin, csPin); // this will get called for each motor, but does not seem to hurt anything tmcstepper->begin(); diff --git a/Grbl_Esp32/src/SDCard.cpp b/Grbl_Esp32/src/SDCard.cpp index 82307a60..b297180e 100644 --- a/Grbl_Esp32/src/SDCard.cpp +++ b/Grbl_Esp32/src/SDCard.cpp @@ -143,7 +143,7 @@ SDCard::State SDCard::get_state(bool refresh) { auto spiConfig = config->_spi; if (spiConfig != nullptr) { - auto ssPin = spiConfig->_ss.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); + auto csPin = spiConfig->_cs.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native); //no need to go further if SD detect is not correct if (config->_sdCard->_cardDetect.defined() && !config->_sdCard->_cardDetect.read()) { @@ -166,7 +166,7 @@ SDCard::State SDCard::get_state(bool refresh) { //using default value for speed ? should be parameter //refresh content if card was removed - if (SD.begin(ssPin, SPI, GRBL_SPI_FREQ, "/sd", 2)) { + if (SD.begin(csPin, SPI, GRBL_SPI_FREQ, "/sd", 2)) { if (SD.cardSize() > 0) { _state = SDCard::State::Idle; }