STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
idle.c File Reference
#include "idle.h"
#include <string.h>
Include dependency graph for idle.c:

Go to the source code of this file.

Macros

#define IDLE_ADC_FULL_SCALE   65535U
#define IDLE_MV_AT_FULL_SCALE   10624U

Functions

uint16_t idle_counts_to_mv (uint32_t raw_counts)
static bool config_valid (const idle_config_t *c)
static bool port_valid (const idle_port_t *p)
bool idle_init (idle_t *idle, const idle_config_t *config, const idle_port_t *port, void *context)
bool idle_enter (idle_t *idle, uint32_t now_ms)
static idle_battery_state_t band_fresh (const idle_config_t *c, uint16_t mv)
static idle_battery_state_t band_next (const idle_config_t *c, idle_battery_state_t previous, uint16_t mv)
static void read_battery (idle_t *idle, uint32_t now_ms)
static void send_heartbeat (idle_t *idle, uint32_t now_ms)
static int32_t ms_until (uint32_t now_ms, uint32_t target_ms)
idle_result_t idle_on_wake (idle_t *idle, uint32_t now_ms)
const idle_heartbeat_t * idle_last_heartbeat (const idle_t *idle)

Macro Definition Documentation

◆ IDLE_ADC_FULL_SCALE

#define IDLE_ADC_FULL_SCALE   65535U

Definition at line 10 of file idle.c.

Referenced by idle_counts_to_mv(), and read_battery().

◆ IDLE_MV_AT_FULL_SCALE

#define IDLE_MV_AT_FULL_SCALE   10624U

Definition at line 11 of file idle.c.

Referenced by idle_counts_to_mv().

Function Documentation

◆ band_fresh()

idle_battery_state_t band_fresh ( const idle_config_t * c,
uint16_t mv )
static

Definition at line 81 of file idle.c.

References IDLE_BATT_FAIL, IDLE_BATT_OK, and IDLE_BATT_WARN.

Referenced by band_next().

◆ band_next()

◆ config_valid()

◆ idle_counts_to_mv()

uint16_t idle_counts_to_mv ( uint32_t raw_counts)

Definition at line 13 of file idle.c.

References IDLE_ADC_FULL_SCALE, and IDLE_MV_AT_FULL_SCALE.

Referenced by read_battery(), and test_conversion().

◆ idle_enter()

bool idle_enter ( idle_t * idle,
uint32_t now_ms )

Definition at line 70 of file idle.c.

References idle, and NULL.

Referenced by idle_task(), anonymous_namespace{idle_e2e.cpp}::run(), setup(), and test_wake_before_enter_is_error().

◆ idle_init()

bool idle_init ( idle_t * idle,
const idle_config_t * config,
const idle_port_t * port,
void * context )

◆ idle_last_heartbeat()

◆ idle_on_wake()

◆ ms_until()

int32_t ms_until ( uint32_t now_ms,
uint32_t target_ms )
static

Definition at line 164 of file idle.c.

Referenced by idle_on_wake().

◆ port_valid()

bool port_valid ( const idle_port_t * p)
static

Definition at line 45 of file idle.c.

References NULL, and p.

Referenced by idle_init().

◆ read_battery()

◆ send_heartbeat()

void send_heartbeat ( idle_t * idle,
uint32_t now_ms )
static

Definition at line 145 of file idle.c.

References idle, reply(), and SELF_TEST_PASS.

Referenced by idle_on_wake(), and idle_task().