Skip to main content

Crate pamoja_sensors

Crate pamoja_sensors 

Source
Expand description

Concrete sensor drivers for the pamoja SDK.

pamoja-gpio builds the address and mode bytes a controller puts on an I2C or SPI bus; this crate is the layer just above it, the per-part knowledge that turns the raw register bytes a specific sensor returns into a physical reading. Each module is one named part: it knows that part’s register map, builds the bytes that configure it, and decodes what it sends back, applying the exact conversion the manufacturer’s datasheet specifies.

Like the rest of the SDK’s hardware crates, these are the decode-and-configure half ahead of the actual bus driver: pure logic with no I/O, so the same code runs on a microcontroller and in a test. A caller pairs a module here with whatever performs the transfers (a pamoja-gpio Linux backend, an embedded-hal bus, or a simulator) and gets calibrated readings without re-deriving a datasheet.

The conversions are anchored to each datasheet’s own reference values, since they are where memory-driven bugs hide. The BME280 compensation is ported from Bosch’s published reference code and cross-checked against its floating-point form; the DS18B20 decode is pinned to the datasheet’s temperature/data table and its CRC to the Maxim 1-Wire polynomial; the INA219 math is checked against the datasheet’s worked design example; the ADS1115 full-scale conversion against its per-gain LSB sizes.

  • bme280 - Bosch temperature, pressure, and humidity over I2C or SPI.
  • ds18b20 - Maxim 1-Wire digital thermometer, with CRC-checked scratchpads.
  • ina219 - Texas Instruments high-side current, voltage, and power monitor.
  • ads1115 - Texas Instruments 16-bit I2C analog-to-digital converter.

Modules§

ads1115
Texas Instruments ADS1115 16-bit I2C analog-to-digital converter.
bme280
Bosch BME280 temperature, pressure, and humidity sensor.
ds18b20
Maxim DS18B20 1-Wire digital thermometer.
ina219
Texas Instruments INA219 high-side current, voltage, and power monitor.

Enums§

SensorError
What can go wrong turning a part’s raw bytes into a reading.