Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Crate map

Every production workspace crate, what it is for, whether it is portable and the dependency direction it must respect. “Portable” crates are no_std, never allocate and build and test on the host. For the dependency picture see Architecture.

CratePurposePortable?std / no_stdMajor public abstractionsMay depend onDoes not own
rohi-halTyped units and measurements, sensor drivers, sensor runtime, MeasurementStoreportableno_stdMeasurementStore, MeasurementsSnapshot, SensorDriver, Runner, EventBus, MeasurementHandleembedded-hal(-async), Embassy syncMCU peripherals, board pins, networking, serialization
rohi-hal-espESP32 backend of the HAL: boards, I²C/UART/I²S setup, clockESPno_stdboard::altruist_urban::{Hardware, AltruistUrban}rohi-hal, esp-halSensor logic, application tasks
rohi-configTransactional CBOR configuration storeportableno_stdConfigSection, ConfigStore, ConfigStorage, MemoryStorageminicborAny concrete section, flash access
rohi-config-derive#[derive(ConfigSection)]portable (proc-macro)std (build time)derive macrosyn, quoteRuntime behaviour
rohi-config-espFlash backend of the storeESPno_stdEspConfigStorage, FlashRegion, layoutrohi-config, esp-storageCBOR, sections, any feature’s configuration
rohi-identityDevice identity: Ed25519 Identity config section, Secret, Signer, IdentitySignerportableno_stdIdentity, Secret, Signer, IdentitySigner, PublicKey, Signaturerohi-config, ed25519-zebraProvisioning transport, key derivation (done on the host by rohi), protocol semantics of signed messages
rohi-netWi-Fi control plane, IP data plane (DNS, TCP, UDP), BLE transport traits, WifiConfig sectionportableno_stdWifiManager, WifiHandle, WifiBackend, NetworkHandle, IpBackend, UdpSocket, NetError, BleTransportrohi-config, Embassy sync, embedded-nal-async, embedded-io-asyncRadio drivers, the IP stack, control protocol
rohi-timeSynchronized wall-clock time: TimeService, TimeSource, validation, background Synchronizerportableno_stdTimeService, TimeSource, TimeSample, UnixTime, TimeStatus, Synchronizerrohi-hal (monotonic Clock, Backoff), Embassy syncNetwork or clock hardware, any concrete source
rohi-time-ntpNTP/SNTP TimeSource over the IP data planeportableno_stdNtpTimeSource, NtpConfigrohi-time, rohi-net, sntpcThe global concept of time, the UDP stack
rohi-net-espESP backend of rohi-netESPno_stdEspWireless, EspWifi, EspIp, EspBle, NetResources, BleResources, wireless_heap!rohi-net, esp-radio, embassy-net, TrouBLEProduct resource sizes, control protocol
rohi-control-protoBounded protobuf schema of the control protocolportableno_stdgenerated messages, PROTOCOL_VERSION, limitsmicropbTransport, behaviour
rohi-controlControl dispatcher, capabilities, authorizationportableno_stdController, ControlServices, Capabilities, AuthorizationPolicyrohi-control-proto, rohi-hal, rohi-net, rohi-identity, rohi-timeBLE, stores, the radio
rohi-control-bleGATT binding: UUIDs, framing, fragmentation, control loopportableno_stdControlBle, framerohi-control, rohi-netThe BLE stack
altruist-urban (firmware)Product composition, tasks, resource budgetproductno_stdconfig, net, control, time, resources, taskseverything aboveReusable library code
rohi-examples (examples/)One hardware example per sensor and a config self-testproductno_stdbinariesrohi-hal(-esp), rohi-config(-esp)
rohi (tools/rohi)Desktop client library and CLI over BLEdesktopstdDevice, Session, BleLinkrohi-control-ble::frame, rohi-control-proto, rohi-net (types), btleplugAnything that runs on the device

Allowed dependency direction

altruist-urban ──► rohi-*-esp ──► rohi-* (portable) ──► embedded-* / embassy-sync
                                                      └─► never esp-*
rohi-control-ble ──► rohi-control ──► rohi-control-proto
rohi-control ──► rohi-net, rohi-hal, rohi-identity   (types only: WifiConfig, MeasurementsSnapshot, Identity)
rohi-net ──► rohi-config                   (owns the WifiConfig section)
rohi-identity ──► rohi-config              (owns the Identity section)
rohi-time-ntp ──► rohi-time, rohi-net      (a source: DNS + UDP samples; rohi-time never depends on it)
rohi-control ──► rohi-time                 (types only: TimeStatus, UnixTime)

Forbidden: a portable crate depending on an *-esp crate; rohi-net* depending on rohi-control*; rohi-hal depending on rohi-net; a platform crate depending on the firmware.

Where does new code go?

You are adding…Put it inNotes
A new sensor driverrohi-hal (sensors/)Add a sensor; a new board only needs wiring in rohi-hal-esp
Pins or bus setup for a boardrohi-hal-esp (board/)Add a board
A new persistent configuration sectionThe crate of the feature that interprets itAdd a ConfigSection; never in rohi-config
Flash or storage backendrohi-config-esp (or a new *-esp crate)Implement ConfigStorage
An absolute-time source (RTC, external time)A new portable crate implementing rohi_time::TimeSourceConsumers keep using TimeService; see Time service
DNS/TCP/UDP behaviour, TLS/HTTP/uplink protocolsA new portable crate over NetworkHandle / the embedded-nal-async traitsNever use embassy-net directly
Another IP stack or radioA platform crate implementing IpBackend / WifiBackendVendor types stay inside
A control operationrohi-control-proto (schema), rohi-control (dispatch, ControlServices), firmware adapterAdd a control operation
Product resource sizes and task wiringThe firmware (resources.rs, tasks/)The product owns the RAM budget
Anything that needs esp-hal / esp-radioA *-esp platform crateKeep the portable API free of vendor types