Expand description
The C ABI for power-aware scheduling.
These functions wrap [pamoja_power] for callers that reach the SDK through
the flat C boundary: the split between working and sleeping that a duty cycle
describes, and the plan that stretches a work interval as a battery falls.
Everything here is arithmetic over scalars, so both types cross by value and nothing allocates. Durations cross as microseconds, which covers intervals from a radio burst to weeks of deep sleep in a 64-bit unsigned integer.
Structs§
- Pamoja
Duty Cycle - The split between the time a node works and the time it sleeps.
- Pamoja
Power Plan - The work intervals a node uses in each mode, and where the modes change.
Enums§
- Pamoja
Power Mode - What a node should be doing at the current state of charge.
Functions§
- pamoja_
duty_ cycle_ fraction - Returns the share of a period a duty cycle spends awake.
- pamoja_
duty_ cycle_ from_ fraction - Creates a duty cycle that spends a fraction of each period awake.
- pamoja_
duty_ cycle_ new - Creates a duty cycle from the time awake and the time asleep.
- pamoja_
duty_ cycle_ period_ us - Returns the whole period of a duty cycle, awake plus asleep.
- pamoja_
power_ plan_ interval_ for_ us - Returns the work interval a plan uses in a mode.
- pamoja_
power_ plan_ interval_ us - Returns the work interval a plan calls for at a state of charge.
- pamoja_
power_ plan_ mode - Returns the mode a plan calls for at a state of charge.
- pamoja_
power_ plan_ mode_ while_ charging - Returns the mode a plan calls for, easing off one step while charging.
- pamoja_
power_ plan_ new - Creates a power plan from its three work intervals, with default thresholds.
- pamoja_
power_ plan_ with_ thresholds - Returns a plan with the state-of-charge thresholds moved.