Skip to content

Commit 8ff29b1

Browse files
author
Tobias Antonsson
committed
Adapted to updated uart1 ISR interface
1 parent 481ed23 commit 8ff29b1

3 files changed

Lines changed: 4 additions & 21 deletions

File tree

src/drivers/interface/uart1.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,6 @@ bool uart1GetDataWithDefaultTimeout(uint8_t *c);
132132
*/
133133
void uart1GetBytesWithDefaultTimeout(uint32_t size, uint8_t* data);
134134

135-
/**
136-
* Register a callback that is called for each received byte.
137-
* The callback is called from the UART1 interrupt context, so it should be fast and not block.
138-
*
139-
* @param[in] cb Callback to call from ISR context, or NULL to disable.
140-
*/
141-
void uart1RegisterRxCallback(uart1RxCallback_t cb);
142-
143135
/**
144136
* @brief Get the number of bytes available in the UART1 in queue
145137
*

src/drivers/src/uart1.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,6 @@ void uart1GetBytesWithDefaultTimeout(uint32_t size, uint8_t* data)
285285
}
286286
}
287287

288-
void uart1RegisterRxCallback(uart1RxCallback_t cb)
289-
{
290-
rxCallback = cb;
291-
}
292-
293288
void uart1SendData(uint32_t size, uint8_t* data)
294289
{
295290
uint32_t i;

src/modules/src/lighthouse/lighthouse_core.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static volatile bool deckIsFlashed = false;
151151
// The time (in ms) of the latest received UART frame, sync frames included
152152
static volatile uint32_t lastFrameTs = 0;
153153

154-
static void uart1RxISRCallback(uint8_t rxByte);
154+
static void uart1RxISRCallback(uint8_t rxByte, BaseType_t *xHigherPriorityTaskWoken);
155155

156156
uint8_t lighthouseCoreDeckStatus() {
157157
// If the deck never flashed/booted we can't trust its state to probe it
@@ -188,7 +188,7 @@ void lighthouseCoreInit() {
188188
lighthouseStorageInitializeSystemTypeFromStorage();
189189
lighthousePositionEstInit();
190190

191-
uart1RegisterRxCallback(uart1RxISRCallback);
191+
uart1SetRxCallback(uart1RxISRCallback);
192192

193193
for (int i = 0; i < CONFIG_DECK_LIGHTHOUSE_MAX_N_BS; i++) {
194194
modifyBit(&baseStationAvailabledMap, i, true);
@@ -275,8 +275,7 @@ void lighthouseCoreSetSystemType(const lighthouseBaseStationType_t type)
275275
lighthouseUpdateSystemType();
276276
}
277277

278-
static void uart1RxISRCallback(uint8_t rxByte) {
279-
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
278+
static void uart1RxISRCallback(uint8_t rxByte, BaseType_t *xHigherPriorityTaskWoken) {
280279
static uint8_t data[UART_FRAME_LENGTH];
281280
static int index = 0;
282281
static int syncCounter = 0;
@@ -313,10 +312,7 @@ static void uart1RxISRCallback(uint8_t rxByte) {
313312
bool isFrameValid = (isPaddingZero || frameIsr.isSyncFrame);
314313

315314
if (isFrameValid) {
316-
xQueueSendFromISR(lhFramePacketQueue, &frameIsr, &xHigherPriorityTaskWoken);
317-
#ifndef UNIT_TEST_MODE
318-
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
319-
#endif
315+
xQueueSendFromISR(lhFramePacketQueue, &frameIsr, xHigherPriorityTaskWoken);
320316
}
321317
}
322318
}

0 commit comments

Comments
 (0)