Expand description
CR1140 SDK — app-building conveniences layered on top of cr1140-hal.
This crate is deliberately UI-framework agnostic (no Slint, no rendering): it provides the “batteries” a native CR1140 application needs regardless of how it draws — keypad LED effects, system telemetry, and device/network info.
led— RGB keypad-LED animation modes and aled::LedDriver.metrics— generic Linux telemetry (CPU, memory, load, uptime) plus ametrics::Telemetrycollector returning an aggregatedmetrics::Snapshot.device— device & OS identity and network state.guard—guard::ShutdownGuard: restore backlight/LED on exit (RAII), with opt-in SIGINT/SIGTERM handling for standalone binaries.config— atomicconfig::Storepersistence for the p2 overlay (/home/cds-apps); enabled by the defaultconfigfeature.retain— reflash-survivingretain::Storeon the SPI EEPROM (A/B + CRC32,postcard); enabled by the defaultretainfeature.net— host network-config apply vianmcli(net::apply); off by default behind thenetfeature.
Errors from fallible operations surface as SdkError. This crate is a guest
under host executors (ROS 2 / Apex / Taktora): it logs through the tracing
facade without installing a subscriber, and never grabs signals by default.
Re-exports§
pub use config::Store;pub use config::DEFAULT_APP_DIR;pub use error::SdkError;pub use error::SdkResult;pub use guard::ShutdownFlag;pub use guard::ShutdownGuard;pub use metrics::MemInfo;pub use metrics::Snapshot;pub use metrics::Telemetry;pub use retain::Store as RetainStore;
Modules§
- config
- Atomic config persistence for the writable p2 overlay (
/home/cds-apps). - device
- Device & OS identity and network state: things that describe this unit (model/firmware, hostname, onboard board sensor) and its links (eth0/can0).
- error
- Unified SDK error type. Mirrors
cr1140_hal::HalError’s thiserror pattern so callers — including ROS 2 / Apex nodes — can match on the cause. Metrics parsers/readers stayOption; fallible hardware and config operations returnSdkResult. - guard
- Shutdown/restore for the keypad LED and display backlight.
- led
- Keypad-LED animation. Each
LedModeis a pure brightness curve over time;LedDriverholds the current color + mode and writes the RGB hardware (viacr1140-hal) only when the computed value changes. - metrics
- Generic Linux system telemetry from
/proc. Not CR1140-specific — works on any Linux host. Pure parsers (host-testable) plus thin procfs readers. - net
- Host network-config apply via
nmcli(featurenet, off by default). - retain
- Reflash-surviving persistence on the SPI EEPROM.