Figures¶
Every figure on this site is drawn by a Python module from facts extracted from the code, so it is rebuilt,
not redrawn, when the code changes. CI runs kokeb-docs figures --check and fails when a
committed figure no longer matches the code. Each figure below lists the files it is drawn from.
Inside the BMP581¶
Figure description and sources
The BMP581's function blocks inside its outline. Arrows between blocks carry signals or data in the direction they point (both ways where they have two heads). The package pins stand on the left and right edges with their numbers, each wired to the block it reaches.
Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
BMP581: I2C connection¶
Figure description and sources
A schematic. The MCU is on the left, each of its pins level with the chip pin it connects to; above each wire is the hook of the driver's port that drives or reads it. Supply pins point up to their supply and decoupling, ground pins down. Pins on the right carry the loads and the pins tied to a supply or ground; a cross marks a pin left open. A dot is a junction; wires that cross without a dot are not connected.
Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
BMP581: SPI 4-wire connection¶
Figure description and sources
A schematic. The MCU is on the left, each of its pins level with the chip pin it connects to; above each wire is the hook of the driver's port that drives or reads it. Supply pins point up to their supply and decoupling, ground pins down. Pins on the right carry the loads and the pins tied to a supply or ground; a cross marks a pin left open. A dot is a junction; wires that cross without a dot are not connected.
Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
BMP581 pinout, LGA-10¶
Figure description and sources
The BMP581 seen from the top, in its LGA-10 package. Pin 1 is marked by the dot; the numbers run counter-clockwise from it. Each pad is coloured by the pin's electrical type (legend below). Next to it is the pin's name and, in mono, the hook of the driver's port that drives or reads it; a pin without a hook is not used by the driver.
Drawn from: docs/hardware.yml; inc/bmp581_i2c_interface.hpp; inc/bmp581_spi_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
The layers, one of them yours¶
Figure description and sources
Top to bottom, each arrow is a call. Your application calls one object, whose public calls are listed from the umbrella header in inc/. The core turns each call into register reads and writes and hands them to the port contract (the CRTP base in inc/*_interface.hpp), which forwards them, at compile time, to the hooks of the port class you write; your port moves the bytes on the bus. The notes on the right say which layers stay the same on every MCU and which one you write. A library without a port contract has only the first two layers.
Drawn from: inc/bmp581.hpp public calls; inc/bmp581_i2c_interface.hpp I2cInterface; inc/bmp581_spi_interface.hpp SpiInterface; figure module docs/diagrams/figures/driver-layers.py.
Figure module: docs/diagrams/figures/driver-layers.py
Drawn from:
public callsininc/bmp581.hppI2cInterfaceininc/bmp581_i2c_interface.hppSpiInterfaceininc/bmp581_spi_interface.hpp
From a conversion to a value¶
Figure description and sources
Two entry points at the top. MeasureOnce() runs the reset check (INT_STATUS, then OSR_CONFIG to OSR_EFF in one read), writes ODR_CONFIG with pwr_mode = forced, polls it until it shows forced (at most t_startup) to prove the measurement started, waits the typical conversion time less 5 percent, then polls the same registers until the chip is back in standby, at most the datasheet maximum. In normal or continuous mode, WaitDataReady() polls INT_STATUS until drdy. Both end in the same read: one 12-byte burst of TEMP_DATA to STATUS, so temperature and pressure come from one conversion (data shadowing). The checks below run in order, and each failure has its error card on the right: the reserved registers must read 0x00 and the frame must not be all 0x00 (a stuck or floating line); INT_STATUS goes to the latch, and a por in it runs the reset check; the reset value 0x7F7F7F is no measurement and runs the reset check too; the values must lie in the measurement range. Only then is the value returned, in 1/64 Pa and 1/65536 degrees Celsius.
Drawn from: src/bmp581.ipp MeasureOnce, waitForcedShown, WaitDataReady, readData, settle; inc/bmp581_registers.hpp kDataReset; inc/bmp581_types.hpp kPressureMinPa, kPressureMaxPa, kTemperatureMinC, kTemperatureMaxC; figure module docs/diagrams/figures/measurement.py.
Figure module: docs/diagrams/figures/measurement.py
Drawn from:
MeasureOnce, waitForcedShown, WaitDataReady, readData, settleinsrc/bmp581.ippkDataResetininc/bmp581_registers.hppkPressureMinPa, kPressureMaxPa, kTemperatureMinC, kTemperatureMaxCininc/bmp581_types.hpp
What EnsureInitialized() does¶
Figure description and sources
Top to bottom on the left, the steps of the first EnsureInitialized() call; once it has succeeded a later call runs the reset check (one 3-byte read of OSR_CONFIG to OSR_EFF) and returns Ok, or starts again at the top when the chip reset. The configuration and the I2C address are checked before any I/O. Step 1 waits the power-up time and, on SPI, sends the dummy read that changes the chip from I2C to SPI. Step 2 is the soft reset: standby with deep standby off first (the datasheet does not say that deep standby takes CMD), then CMD = 0xB6, which the chip does not acknowledge over I2C, then the soft reset time, and on SPI the selection read again, since a reset returns the interface to I2C. Step 3 is the datasheet's post-power-up check: CHIP_ID, STATUS polled until the NVM is ready with no error, and INT_STATUS, which must read 0x10 (the reset happened) and then 0x00 (the read cleared it), a check no stuck, floating or looped-back line can pass. Step 4 leaves the deep standby the reset left the chip in (standby with deep standby off, then t_standby), writes the marker to NVM_DATA once, writes the configuration one register per transfer with ODR_CONFIG last, reads all of it and the marker back, reads INT_STATUS once more, and enters the configured power mode, read back too. Each card on the right is the error a step returns; after any failure the driver stays uninitialised and the next call starts at the top.
Drawn from: src/bmp581.ipp EnsureInitialized, initialize, resetChip, identify, waitNvmReady, checkResetFlags, configure; inc/bmp581_registers.hpp kChipIdValue, kIntStatusAfterReset, kCmdSoftReset; inc/bmp581_types.hpp kPowerUpUs, kSoftResetUs; figure module docs/diagrams/figures/start-up.py.
Figure module: docs/diagrams/figures/start-up.py
Drawn from:
EnsureInitialized, initialize, resetChip, identify, waitNvmReady, checkResetFlags, configureinsrc/bmp581.ippkChipIdValue, kIntStatusAfterReset, kCmdSoftResetininc/bmp581_registers.hppkPowerUpUs, kSoftResetUsininc/bmp581_types.hpp