mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-31 01:59:54 +02:00
Changed "ss" to "cs" everywhere
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ namespace Machine {
|
||||
public:
|
||||
SPIBus() = default;
|
||||
|
||||
Pin _ss;
|
||||
Pin _cs;
|
||||
Pin _miso;
|
||||
Pin _mosi;
|
||||
Pin _sck;
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user