Add an option to force SPI into software mode, useful when (#4556)

reusing pins for different purposes.
This commit is contained in:
Witold Krecicki
2023-03-15 23:21:25 +01:00
committed by GitHub
parent 3d4c0e6667
commit a8bb2a42a1
3 changed files with 6 additions and 1 deletions
+2
View File
@@ -74,6 +74,7 @@ class SPIComponent : public Component {
void set_clk(GPIOPin *clk) { clk_ = clk; }
void set_miso(GPIOPin *miso) { miso_ = miso; }
void set_mosi(GPIOPin *mosi) { mosi_ = mosi; }
void set_force_sw(bool force_sw) { force_sw_ = force_sw; }
void setup() override;
@@ -260,6 +261,7 @@ class SPIComponent : public Component {
GPIOPin *miso_{nullptr};
GPIOPin *mosi_{nullptr};
GPIOPin *active_cs_{nullptr};
bool force_sw_{false};
#ifdef USE_SPI_ARDUINO_BACKEND
SPIClass *hw_spi_{nullptr};
#endif // USE_SPI_ARDUINO_BACKEND