Skip to content

Commit ee92520

Browse files
mark9064JF002
authored andcommitted
Remove task to notify
1 parent 079e676 commit ee92520

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
@@ -142,9 +142,6 @@ void DisplayApp::Process(void* instance) {
142142
NRF_LOG_INFO("displayapp task started!");
143143
app->InitHw();
144144

145-
// Send a dummy notification to unlock the lvgl display driver for the first iteration
146-
xTaskNotifyGive(xTaskGetCurrentTaskHandle());
147-
148145
while (true) {
149146
app->Refresh();
150147
}

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
@@ -136,20 +136,14 @@ void SpiMaster::OnEndEvent() {
136136

137137
spiBaseAddress->TASKS_START = 1;
138138
} else {
139-
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
140-
if (taskToNotify != nullptr) {
141-
vTaskNotifyGiveFromISR(taskToNotify, &xHigherPriorityTaskWoken);
142-
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
143-
}
144-
145139
nrf_gpio_pin_set(this->pinCsn);
146140
if (this->TransactionHook != nullptr) {
147141
this->TransactionHook(false);
148142
}
149143
currentBufferAddr = 0;
150-
BaseType_t xHigherPriorityTaskWoken2 = pdFALSE;
151-
xSemaphoreGiveFromISR(mutex, &xHigherPriorityTaskWoken2);
152-
portYIELD_FROM_ISR(xHigherPriorityTaskWoken | xHigherPriorityTaskWoken2);
144+
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
145+
xSemaphoreGiveFromISR(mutex, &xHigherPriorityTaskWoken);
146+
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
153147
}
154148
}
155149

@@ -181,7 +175,6 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, void (*T
181175
return false;
182176
auto ok = xSemaphoreTake(mutex, portMAX_DELAY);
183177
ASSERT(ok == true);
184-
taskToNotify = xTaskGetCurrentTaskHandle();
185178

186179
this->TransactionHook = TransactionHook;
187180
this->pinCsn = pinCsn;
@@ -226,7 +219,6 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, void (*T
226219
bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize) {
227220
xSemaphoreTake(mutex, portMAX_DELAY);
228221

229-
taskToNotify = nullptr;
230222
this->TransactionHook = nullptr;
231223
this->pinCsn = pinCsn;
232224
DisableWorkaroundForFtpan58(spiBaseAddress, 0, 0);
@@ -275,8 +267,6 @@ void SpiMaster::Wakeup() {
275267
bool SpiMaster::WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize) {
276268
xSemaphoreTake(mutex, portMAX_DELAY);
277269

278-
taskToNotify = nullptr;
279-
280270
this->TransactionHook = nullptr;
281271

282272
this->pinCsn = pinCsn;

src/drivers/SpiMaster.h

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ namespace Pinetime {
5757

5858
volatile uint32_t currentBufferAddr = 0;
5959
volatile size_t currentBufferSize = 0;
60-
volatile TaskHandle_t taskToNotify;
6160
SemaphoreHandle_t mutex = nullptr;
6261
};
6362
}

src/recoveryLoader.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ void DisplayLogo() {
121121
Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb));
122122
for (int i = 0; i < displayWidth; i++) {
123123
rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel);
124-
ulTaskNotifyTake(pdTRUE, 500);
125124
lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), displayWidth * bytesPerPixel);
126125
}
127126
}
@@ -130,7 +129,6 @@ void DisplayProgressBar(uint8_t percent, uint16_t color) {
130129
static constexpr uint8_t barHeight = 20;
131130
std::fill(displayBuffer, displayBuffer + (displayWidth * bytesPerPixel), color);
132131
for (int i = 0; i < barHeight; i++) {
133-
ulTaskNotifyTake(pdTRUE, 500);
134132
uint16_t barWidth = std::min(static_cast<float>(percent) * 2.4f, static_cast<float>(displayWidth));
135133
lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast<const uint8_t*>(displayBuffer), barWidth * bytesPerPixel);
136134
}

0 commit comments

Comments
 (0)