Skip to content

Commit 569f199

Browse files
committed
Remove task to notify
1 parent 46db973 commit 569f199

7 files changed

+4
-29
lines changed

src/FreeRTOSConfig.h

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#define configUSE_TIME_SLICING 0
7676
#define configUSE_NEWLIB_REENTRANT 0
7777
#define configENABLE_BACKWARD_COMPATIBILITY 1
78+
#define configUSE_TASK_NOTIFICATIONS 0
7879

7980
/* Hook function related definitions. */
8081
#define configUSE_IDLE_HOOK 0

src/displayapp/DisplayApp.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ void DisplayApp::Process(void* instance) {
140140
NRF_LOG_INFO("displayapp task started!");
141141
app->InitHw();
142142

143-
// Send a dummy notification to unlock the lvgl display driver for the first iteration
144-
xTaskNotifyGive(xTaskGetCurrentTaskHandle());
145-
146143
while (true) {
147144
app->Refresh();
148145
}

src/displayapp/DisplayAppRecovery.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ void DisplayApp::Process(void* instance) {
3838
auto* app = static_cast<DisplayApp*>(instance);
3939
NRF_LOG_INFO("displayapp task started!");
4040

41-
// Send a dummy notification to unlock the lvgl display driver for the first iteration
42-
xTaskNotifyGive(xTaskGetCurrentTaskHandle());
43-
4441
app->InitHw();
4542
while (true) {
4643
app->Refresh();
@@ -94,7 +91,6 @@ void DisplayApp::DisplayLogo(uint16_t color) {
9491
Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb), color, colorBlack);
9592
for (int i = 0; i < displayWidth; i++) {
9693
rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel);
97-
ulTaskNotifyTake(pdTRUE, 500);
9894
lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), displayWidth * bytesPerPixel);
9995
}
10096
}
@@ -103,7 +99,6 @@ void DisplayApp::DisplayOtaProgress(uint8_t percent, uint16_t color) {
10399
const uint8_t barHeight = 20;
104100
std::fill(displayBuffer, displayBuffer + (displayWidth * bytesPerPixel), color);
105101
for (int i = 0; i < barHeight; i++) {
106-
ulTaskNotifyTake(pdTRUE, 500);
107102
uint16_t barWidth = std::min(static_cast<float>(percent) * 2.4f, static_cast<float>(displayWidth));
108103
lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), barWidth * bytesPerPixel);
109104
}

src/displayapp/LittleVgl.cpp

-5
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ void LittleVgl::SetFullRefresh(FullRefreshDirections direction) {
152152
void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
153153
uint16_t y1, y2, width, height = 0;
154154

155-
ulTaskNotifyTake(pdTRUE, 200);
156-
// Notification is still needed (even if there is a mutex on SPI) because of the DataCommand pin
157-
// which cannot be set/clear during a transfer.
158-
159155
if ((scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) {
160156
writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines;
161157
} else if ((scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0)) {
@@ -219,7 +215,6 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
219215

220216
if (height > 0) {
221217
lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t*>(color_p), width * height * 2);
222-
ulTaskNotifyTake(pdTRUE, 100);
223218
}
224219

225220
uint16_t pixOffset = width * height;

src/drivers/SpiMaster.cpp

+3-13
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,14 @@ void SpiMaster::OnEndEvent() {
149149

150150
spiBaseAddress->TASKS_START = 1;
151151
} else {
152-
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
153-
if (taskToNotify != nullptr) {
154-
vTaskNotifyGiveFromISR(taskToNotify, &xHigherPriorityTaskWoken);
155-
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
156-
}
157-
158152
nrf_gpio_pin_set(this->pinCsn);
159153
if (this->TransactionHook != nullptr) {
160154
this->TransactionHook(false);
161155
}
162156
currentBufferAddr = 0;
163-
BaseType_t xHigherPriorityTaskWoken2 = pdFALSE;
164-
xSemaphoreGiveFromISR(mutex, &xHigherPriorityTaskWoken2);
165-
portYIELD_FROM_ISR(xHigherPriorityTaskWoken | xHigherPriorityTaskWoken2);
157+
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
158+
xSemaphoreGiveFromISR(mutex, &xHigherPriorityTaskWoken);
159+
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
166160
}
167161
}
168162

@@ -194,7 +188,6 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, void (*T
194188
return false;
195189
auto ok = xSemaphoreTake(mutex, portMAX_DELAY);
196190
ASSERT(ok == true);
197-
taskToNotify = xTaskGetCurrentTaskHandle();
198191

199192
this->TransactionHook = TransactionHook;
200193
this->pinCsn = pinCsn;
@@ -239,7 +232,6 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, void (*T
239232
bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize) {
240233
xSemaphoreTake(mutex, portMAX_DELAY);
241234

242-
taskToNotify = nullptr;
243235
this->TransactionHook = nullptr;
244236
this->pinCsn = pinCsn;
245237
DisableWorkaroundForErratum58();
@@ -288,8 +280,6 @@ void SpiMaster::Wakeup() {
288280
bool SpiMaster::WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize) {
289281
xSemaphoreTake(mutex, portMAX_DELAY);
290282

291-
taskToNotify = nullptr;
292-
293283
this->TransactionHook = nullptr;
294284

295285
this->pinCsn = pinCsn;

src/drivers/SpiMaster.h

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ namespace Pinetime {
5959

6060
volatile uint32_t currentBufferAddr = 0;
6161
volatile size_t currentBufferSize = 0;
62-
volatile TaskHandle_t taskToNotify;
6362
SemaphoreHandle_t mutex = nullptr;
6463
static constexpr nrf_ppi_channel_t workaroundPpi = NRF_PPI_CHANNEL0;
6564
bool workaroundActive = false;

src/recoveryLoader.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ void DisplayLogo() {
124124
Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb));
125125
for (int i = 0; i < displayWidth; i++) {
126126
rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel);
127-
ulTaskNotifyTake(pdTRUE, 500);
128127
lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), displayWidth * bytesPerPixel);
129128
}
130129
}
@@ -133,7 +132,6 @@ void DisplayProgressBar(uint8_t percent, uint16_t color) {
133132
static constexpr uint8_t barHeight = 20;
134133
std::fill(displayBuffer, displayBuffer + (displayWidth * bytesPerPixel), color);
135134
for (int i = 0; i < barHeight; i++) {
136-
ulTaskNotifyTake(pdTRUE, 500);
137135
uint16_t barWidth = std::min(static_cast<float>(percent) * 2.4f, static_cast<float>(displayWidth));
138136
lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), barWidth * bytesPerPixel);
139137
}

0 commit comments

Comments
 (0)