// Copyright (C) 2026 Hector van der Aa // Copyright (C) 2026 Pierre Barbier // Copyright (C) 2026 Association Exergie // 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 } } }