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>2020-01-10 23:38:29 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-10 23:38:29 +0300
commit5ff678917d3eee259687d5ef235c107126330898 (patch)
treedcac02636a9a751ac06c2a98cad33a12f483b262 /src/Hardware/I2C.cpp
parent15d4d43dddd88fcff2591e38dc4bf29c1dfe8abf (diff)
Suspend Network task while waiting for WiFi SPI transfer to complete
Diffstat (limited to 'src/Hardware/I2C.cpp')
-rw-r--r--src/Hardware/I2C.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/Hardware/I2C.cpp b/src/Hardware/I2C.cpp
index aca1c810..c62db5e7 100644
--- a/src/Hardware/I2C.cpp
+++ b/src/Hardware/I2C.cpp
@@ -19,7 +19,7 @@ void I2C::Init() noexcept
if (!i2cInitialised)
{
MutexLocker lock(Tasks::GetI2CMutex());
- if (!i2cInitialised) // test it again, now that we own the mutex
+ if (!i2cInitialised) // test it again, now that we own the mutex
{
I2C_IFACE.BeginMaster(I2cClockFreq);
i2cInitialised = true;
@@ -32,18 +32,13 @@ void I2C::Init() noexcept
#include "RTOSIface/RTOSIface.h"
-static TaskHandle_t twiTask = nullptr; // the task that is waiting for a TWI command to complete
+static TaskHandle twiTask = nullptr; // the task that is waiting for a TWI command to complete
extern "C" void WIRE_ISR_HANDLER() noexcept
{
WIRE_INTERFACE->TWI_IDR = 0xFFFFFFFF;
- if (twiTask != nullptr)
- {
- BaseType_t higherPriorityTaskWoken = pdFALSE;
- vTaskNotifyGiveFromISR(twiTask, &higherPriorityTaskWoken); // wake up the task
- twiTask = nullptr;
- portYIELD_FROM_ISR(higherPriorityTaskWoken);
- }
+ TaskBase::GiveFromISR(twiTask); // wake up the task
+ twiTask = nullptr;
}
uint32_t I2C::statusWaitFunc(Twi *twi, uint32_t bitsToWaitFor) noexcept
@@ -52,7 +47,7 @@ uint32_t I2C::statusWaitFunc(Twi *twi, uint32_t bitsToWaitFor) noexcept
if ((sr & bitsToWaitFor) == 0)
{
// Suspend this task until we get an interrupt indicating that a status bit that we are interested in has been set
- twiTask = xTaskGetCurrentTaskHandle();
+ twiTask = TaskBase::GetCallerTaskHandle();
twi->TWI_IER = bitsToWaitFor;
(void)TaskBase::Take(2);
sr = twi->TWI_SR;