Skip to content

Power & temperature push

Single push entry-point for values that have no portable platform binding (battery rail, on-die temperature, ...). Integrators that sample these via ADC/sensor pass them in here whenever they have a fresh reading; libcoldwave caches the values and the connection loop publishes them on the DeviceService at the next sync.

Types

Name
structcw_power_info_t

Functions Overview

Name
intcoldwave_set_power_info(const cw_power_info_t * info)

Defines

Name
CW_POWER_INFO_BATTERY_MVBitmask values for [cw_power_info_t::fields](/embed/2.2.0/API//group__coldwave.md#variable-fields).
CW_POWER_INFO_BATTERY_PCT
CW_POWER_INFO_TEMPERATURE

Function Details

function coldwave_set_power_info

cpp
int coldwave_set_power_info(
    const cw_power_info_t * info
)

Warning: No sentinel-clear exists: passing battery_mv = UINT16_MAX with the CW_POWER_INFO_BATTERY_MV bit does not mark the value unknown — the sentinel is cached and published like any other reading. There is currently no way to retract a field once it has been reported.

Push fresh power/temperature samples. Fields whose bit is missing in info->fields are left untouched, so the cache accumulates across calls; a call with fields == 0 changes nothing.

Macros Documentation

define CW_POWER_INFO_BATTERY_MV

cpp
#define CW_POWER_INFO_BATTERY_MV (1u << 0)

Bitmask values for [cw_power_info_t::fields](/embed/2.2.0/API//group__coldwave.md#variable-fields).

define CW_POWER_INFO_BATTERY_PCT

cpp
#define CW_POWER_INFO_BATTERY_PCT (1u << 1)

define CW_POWER_INFO_TEMPERATURE

cpp
#define CW_POWER_INFO_TEMPERATURE (1u << 2)