Refactor handler to external

Moved task handler functions to external functions, signatures are in
tasks.h, each function has its own .c file in Src/tasks
This commit is contained in:
2026-06-02 20:11:07 +02:00
parent 8d1debd69a
commit 22c732be02
7 changed files with 173 additions and 142 deletions

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2026 Hector van der Aa <hector@h3cx.dev>
// Copyright (C) 2026 Pierre Barbier <pierrebarbier741@gmail.com>
// Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include "cmsis_os2.h"
#include "main.h"
#include "ring_buffer.h"
#include "tasks.h"
#ifdef DEBUG
#include "SEGGER_RTT.h"
#endif
void camHandler(void *argument) {
for (;;) {
osThreadFlagsWait(0x01, osFlagsWaitAny, osWaitForever);
#ifdef DEBUG
SEGGER_RTT_printf(0, "Cam pulse detected at: %lu\n\r",
ringBufferRead(&state_g.cam_RB, 0));
#endif /* ifdef DEBUG */
if (state_g.sync == SYNC_OK) {
// TODO complete algorithm for scheduling spark
}
}
}

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2026 Hector van der Aa <hector@h3cx.dev>
// Copyright (C) 2026 Pierre Barbier <pierrebarbier741@gmail.com>
// Copyright (C) 2026 Association Exergie <association.exergie@gmail.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include "cmsis_os2.h"
#include "main.h"
#include "ring_buffer.h"
#include "tasks.h"
#ifdef DEBUG
#include "SEGGER_RTT.h"
#endif
void crankHandler(void *argument) {
for (;;) {
osThreadFlagsWait(0x01, osFlagsWaitAny, osWaitForever);
#ifdef DEBUG
SEGGER_RTT_printf(0, "Crank pulse detected at: %lu\n\r",
ringBufferRead(&state_g.crank_RB, 0));
#endif /* ifdef DEBUG */
if (state_g.sync == SYNC_OK) {
// TODO complete algorithm for scheduling spark
}
}
}