Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2022-09-19 15:51:07 +0300
committerDavid Crocker <dcrocker@eschertech.com>2022-09-23 15:45:06 +0300
commit13376e04d1da83d2010a7728315e7d5b98bf1b52 (patch)
treebf8ab21495c1e2db11a849e64816d2c8b268b1f7
parent7435c50300e113b276c508456286381429c26af7 (diff)
Redirect SPI1 interrupt on MB6HC when SBC interface not being used
-rw-r--r--src/Config/Pins_Duet3_MB6HC.h2
-rw-r--r--src/SBC/DataTransfer.cpp11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/Config/Pins_Duet3_MB6HC.h b/src/Config/Pins_Duet3_MB6HC.h
index 5705b09d..a8d8ae47 100644
--- a/src/Config/Pins_Duet3_MB6HC.h
+++ b/src/Config/Pins_Duet3_MB6HC.h
@@ -392,7 +392,7 @@ constexpr GpioPinFunction SBCPinPeriphMode = GpioPinFunction::C;
#define ESP_SPI SPI1
#define ESP_SPI_INTERFACE_ID ID_SPI1
#define ESP_SPI_IRQn SPI1_IRQn
-#define ESP_SPI_HANDLER SPI1_Handler
+#define ESP_SPI_HANDLER SPI1_WiFi_Handler // SBC interface redirects the interrupt to here
constexpr Pin APIN_ESP_SPI_MOSI = PortCPin(27);
constexpr Pin APIN_ESP_SPI_MISO = PortCPin(26);
diff --git a/src/SBC/DataTransfer.cpp b/src/SBC/DataTransfer.cpp
index 4505f320..2ec9051d 100644
--- a/src/SBC/DataTransfer.cpp
+++ b/src/SBC/DataTransfer.cpp
@@ -57,6 +57,10 @@ constexpr IRQn SBC_SPI_IRQn = SbcSpiSercomIRQn;
# include <spi/spi.h>
#endif
+#if defined(DUET3_MB6HC) && HAS_WIFI_NETWORKING
+extern void ESP_SPI_HANDLER() noexcept;
+#endif
+
#include <RepRapFirmware.h>
#include <GCodes/GCodeMachineState.h>
#include <Movement/Move.h>
@@ -356,6 +360,13 @@ extern "C" void SBC_SPI_HANDLER() noexcept
TaskBase::GiveFromISR(sbcTaskHandle);
}
#else
+# if defined(DUET3_MB6HC) && HAS_WIFI_NETWORKING
+ if (!reprap.UsingSbcInterface())
+ {
+ ESP_SPI_HANDLER();
+ return;
+ }
+# endif
const uint32_t status = SBC_SPI->SPI_SR; // read status and clear interrupt
SBC_SPI->SPI_IDR = SPI_IER_NSSR; // disable the interrupt
if ((status & SPI_SR_NSSR) != 0)