Shared heartbeat task implementation for status LEDs.
More...
Go to the source code of this file.
Shared heartbeat task implementation for status LEDs.
- Author
- Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)
◆ DEFINE_HEARTBEAT_TASK
| #define DEFINE_HEARTBEAT_TASK |
( |
| PREFLIGHT_CALLBACK | ) |
|
Value:
.preflight_callback = (PREFLIGHT_CALLBACK), \
}; \
#define ERROR_LED_PIN
Definition main.h:20
#define HEARTBEAT_LED_PIN
Definition main.h:18
#define ERROR_LED_PORT
Definition main.h:19
#define CONNECTION_LED_PIN
Definition main.h:22
#define HEARTBEAT_LED_PORT
Definition main.h:17
#define CONNECTION_LED_PORT
Definition main.h:21
status_leds_t status_leds
@ HEARTBEAT_STATE_PREFLIGHT
Definition heartbeat.h:25
void heartbeat_task(status_leds_t *leds)
Definition heartbeat.c:35
static constexpr uint32_t HEARTBEAT_PERIOD_MS
Definition heartbeat.h:21
@ TASK_PRIORITY_LOW
Definition rtos.h:34
@ STACK_512
Definition rtos.h:26
Definition heartbeat.h:29
Macro to define a heartbeat task with predefined behavior for status LEDs.
Usage:
- Ensure that the macros HEARTBEAT_LED_PORT, HEARTBEAT_LED_PIN, CONNECTION_LED_PORT, CONNECTION_LED_PIN, ERROR_LED_PORT, and ERROR_LED_PIN are defined
- Init the GPIOS for the LEDs as outputs.
- Call DEFINE_HEARTBEAT_TASK() in your source file to define the task.
- Call START_HEARTBEAT_TASK() in your main function after initializing the kernel to start the task.
- Parameters
-
| PREFLIGHT_CALLBACK | optional callback function periodically called during the preflight state. |
◆ START_HEARTBEAT_TASK
| #define START_HEARTBEAT_TASK |
( |
| ) |
|
Value:
#define RTOS_START_TASK(NAME)
Creates and starts a previously defined task.
Definition rtos.h:109
◆ heartbeat_state_t
| Enumerator |
|---|
| HEARTBEAT_STATE_PREFLIGHT | |
| HEARTBEAT_STATE_NORMAL | |
◆ heartbeat_task()
◆ CONN_LED_TIMEOUT_MS
| uint32_t CONN_LED_TIMEOUT_MS = 1000 |
|
staticconstexpr |
◆ HEARTBEAT_PERIOD_MS
| uint32_t HEARTBEAT_PERIOD_MS = 100 |
|
staticconstexpr |
◆ PREFLIGHT_DURATION_MS
| uint32_t PREFLIGHT_DURATION_MS = 1500 |
|
staticconstexpr |