mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-09-02 10:53:01 +02:00
Changed "ss" to "cs" everywhere
This commit is contained in:
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
namespace Machine {
|
namespace Machine {
|
||||||
void SPIBus::validate() const {
|
void SPIBus::validate() const {
|
||||||
if (_ss.defined() || _miso.defined() || _mosi.defined() || _sck.defined()) {
|
if (_cs.defined() || _miso.defined() || _mosi.defined() || _sck.defined()) {
|
||||||
Assert(_ss.defined(), "SPI SS pin should be configured once");
|
Assert(_cs.defined(), "SPI CS pin should be configured once");
|
||||||
Assert(_miso.defined(), "SPI MISO 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(_mosi.defined(), "SPI MOSI pin should be configured once");
|
||||||
Assert(_sck.defined(), "SPI SCK pin should be configured once");
|
Assert(_sck.defined(), "SPI SCK pin should be configured once");
|
||||||
@@ -31,30 +31,30 @@ namespace Machine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SPIBus::init() {
|
void SPIBus::init() {
|
||||||
if (_ss.defined()) { // validation ensures the rest is also defined.
|
if (_cs.defined()) { // validation ensures the rest is also defined.
|
||||||
auto ssPin = _ss.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native);
|
auto csPin = _cs.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native);
|
||||||
auto mosiPin = _mosi.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 sckPin = _sck.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native);
|
||||||
auto misoPin = _miso.getNative(Pin::Capabilities::Input | 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) {
|
void SPIBus::group(Configuration::HandlerBase& handler) {
|
||||||
handler.item("ss", _ss);
|
handler.item("cs", _cs);
|
||||||
handler.item("miso", _miso);
|
handler.item("miso", _miso);
|
||||||
handler.item("mosi", _mosi);
|
handler.item("mosi", _mosi);
|
||||||
handler.item("sck", _sck);
|
handler.item("sck", _sck);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPIBus::afterParse() {
|
void SPIBus::afterParse() {
|
||||||
if (_ss.undefined() && _miso.undefined() && _mosi.undefined() && _sck.undefined()) {
|
if (_cs.undefined() && _miso.undefined() && _mosi.undefined() && _sck.undefined()) {
|
||||||
// Default SPI miso, mosi, sck, ss pins to the "standard" gpios 19, 23, 18, 5
|
// Default SPI miso, mosi, sck, cs pins to the "standard" gpios 19, 23, 18, 5
|
||||||
_miso = Pin::create("gpio.19");
|
_miso = Pin::create("gpio.19");
|
||||||
_mosi = Pin::create("gpio.23");
|
_mosi = Pin::create("gpio.23");
|
||||||
_sck = Pin::create("gpio.18");
|
_sck = Pin::create("gpio.18");
|
||||||
_ss = Pin::create("gpio.5");
|
_cs = Pin::create("gpio.5");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ namespace Machine {
|
|||||||
public:
|
public:
|
||||||
SPIBus() = default;
|
SPIBus() = default;
|
||||||
|
|
||||||
Pin _ss;
|
Pin _cs;
|
||||||
Pin _miso;
|
Pin _miso;
|
||||||
Pin _mosi;
|
Pin _mosi;
|
||||||
Pin _sck;
|
Pin _sck;
|
||||||
|
@@ -106,12 +106,12 @@ namespace Motors {
|
|||||||
|
|
||||||
auto spiConfig = config->_spi;
|
auto spiConfig = config->_spi;
|
||||||
if (spiConfig != nullptr) {
|
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 mosiPin = spiConfig->_mosi.getNative(Pin::Capabilities::Output | Pin::Capabilities::Native);
|
||||||
auto sckPin = spiConfig->_sck.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);
|
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();
|
tmcstepper->begin();
|
||||||
|
|
||||||
|
@@ -143,7 +143,7 @@ SDCard::State SDCard::get_state(bool refresh) {
|
|||||||
auto spiConfig = config->_spi;
|
auto spiConfig = config->_spi;
|
||||||
|
|
||||||
if (spiConfig != nullptr) {
|
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
|
//no need to go further if SD detect is not correct
|
||||||
if (config->_sdCard->_cardDetect.defined() && !config->_sdCard->_cardDetect.read()) {
|
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
|
//using default value for speed ? should be parameter
|
||||||
//refresh content if card was removed
|
//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) {
|
if (SD.cardSize() > 0) {
|
||||||
_state = SDCard::State::Idle;
|
_state = SDCard::State::Idle;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user