11#define EV_MODE (1U << 0)
12#define EV_CMD (1U << 1)
13#define FRAME_HEARTBEAT 0x01U
18 .heartbeat_interval_ms = 10000,
19 .wake_tolerance_ms = 500,
20 .callback_budget_ms = 500,
21 .battery_warn_mv = 7000,
22 .battery_fail_mv = 6600,
23 .battery_hysteresis_mv = 100,
51 (uint8_t)(mv >> 8), (uint8_t)up_s,
52 (uint8_t)(up_s >> 8), (uint8_t)(up_s >> 16),
53 (uint8_t)(up_s >> 24)};
132 uint8_t c = (uint8_t)command;
bool board_bringup_on_usb(void)
self_test_battery_t board_bringup_read_battery(void *context, uint32_t now_ms, uint32_t budget_ms)
uint32_t board_sleep(uint32_t ms, bool(*wake_now)(void))
bool board_sleep_init(void)
board_bringup_t * bringup_task_board(void)
#define osFlagsWaitAny
Wait for any flag (default).
void * osMessageQueueId_t
osMessageQueueId_t osMessageQueueNew(uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr)
Create and Initialize a Message Queue object.
osThreadId_t osThreadNew(osThreadFunc_t func, void *argument, const osThreadAttr_t *attr)
Create a thread and add it to Active Threads.
uint32_t osMessageQueueGetCount(osMessageQueueId_t mq_id)
Get number of queued messages in a Message Queue.
@ osOK
Operation completed successfully.
uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags)
Set the specified Thread Flags of a thread.
uint32_t osKernelGetTickCount(void)
Get the RTOS kernel tick count.
#define osWaitForever
Wait forever timeout value.
osStatus_t osMessageQueuePut(osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)
Put a Message into a Queue or timeout if Queue is full.
uint32_t osThreadFlagsWait(uint32_t flags, uint32_t options, uint32_t timeout)
Wait for one or more Thread Flags of the current running thread to become signaled.
@ osPriorityBelowNormal
Priority: below normal.
osStatus_t osMessageQueueGet(osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)
Get a Message from a Queue or timeout if Queue is empty.
static const emmc_port_t port
flight_state_t flight_state_next(flight_state_t state, flight_event_t event)
static volatile bool want_active
static osThreadId_t thread
void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
idle_result_t idle_on_wake(idle_t *idle, uint32_t now_ms)
static void send_heartbeat(idle_t *idle, uint32_t now_ms)
bool idle_enter(idle_t *idle, uint32_t now_ms)
bool idle_init(idle_t *idle, const idle_config_t *config, const idle_port_t *port, void *context)
static void read_battery(idle_t *idle, uint32_t now_ms)
@ IDLE_EVENT_ARM_REQUESTED
void idle_task_set_active(bool on)
static self_test_battery_t read_battery(void *ctx, uint32_t now_ms, uint32_t budget_ms)
static self_test_reply_t send_heartbeat(void *ctx, const idle_heartbeat_t *hb, uint32_t budget_ms)
static bool work_waiting(void)
static bool on_usb(void *ctx)
const idle_t * idle_task_state(void)
static osMessageQueueId_t commands
bool idle_task_start(void)
static void idle_task(void *argument)
void idle_task_command(mode_command_t command)
static idle_command_t poll_command(void *ctx)
static void led1(bool on)
static const idle_config_t config
void app_set_state(flight_state_t to)
radio_send_result_t radio_task_send_frame(uint8_t type, const uint8_t *payload, uint8_t len)
idle_battery_state_t battery
Attributes structure for thread.