11#if defined(STM32F407xx)
13#elif defined(STM32G474xx)
16#error "Unsupported heartbeat target"
24typedef enum : uint8_t {
36 void (*preflight_callback)(void);
53#define DEFINE_HEARTBEAT_TASK(PREFLIGHT_CALLBACK) \
54 status_leds_t status_leds = { \
55 .heartbeat_port = HEARTBEAT_LED_PORT, \
56 .heartbeat_pin = HEARTBEAT_LED_PIN, \
57 .connection_port = CONNECTION_LED_PORT, \
58 .connection_pin = CONNECTION_LED_PIN, \
59 .error_port = ERROR_LED_PORT, \
60 .error_pin = ERROR_LED_PIN, \
61 .preflight_callback = (PREFLIGHT_CALLBACK), \
62 .state = HEARTBEAT_STATE_PREFLIGHT \
64 void heartbeat_wrapper(void) { heartbeat_task(&status_leds); }; \
65 RTOS_DEFINE_TASK(heartbeat_wrapper, HEARTBEAT_PERIOD_MS, TASK_PRIORITY_LOW, STACK_512)
67#define START_HEARTBEAT_TASK() RTOS_START_TASK(heartbeat_wrapper)
heartbeat_state_t
Definition heartbeat.h:24
@ HEARTBEAT_STATE_PREFLIGHT
Definition heartbeat.h:25
@ HEARTBEAT_STATE_NORMAL
Definition heartbeat.h:26
static constexpr uint32_t CONN_LED_TIMEOUT_MS
Definition heartbeat.h:22
void heartbeat_task(status_leds_t *leds)
Definition heartbeat.c:35
static constexpr uint32_t HEARTBEAT_PERIOD_MS
Definition heartbeat.h:21
static constexpr uint32_t PREFLIGHT_DURATION_MS
Definition heartbeat.h:20
GPIO Driver for STM32F4 Devices.
Wrapper macros for FreeRTOS constructs (tasks, queues, semaphores) to simplify static memory allocati...
Definition heartbeat.h:29
heartbeat_state_t state
Definition heartbeat.h:37
uint32_t error_pin
Definition heartbeat.h:35
uint32_t heartbeat_pin
Definition heartbeat.h:31
uint32_t connection_pin
Definition heartbeat.h:33
GPIO_TypeDef * connection_port
Definition heartbeat.h:32
GPIO_TypeDef * error_port
Definition heartbeat.h:34
GPIO_TypeDef * heartbeat_port
Definition heartbeat.h:30