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 NTC thermistor (generic)¶
Figure description and sources
The NTC thermistor (generic)'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/ntc_thermistor.hpp; inc/ntc_thermistor_adc_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
NTC thermistor (generic): Low-side divider¶
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/ntc_thermistor.hpp; inc/ntc_thermistor_adc_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
NTC thermistor (generic): High-side divider¶
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/ntc_thermistor.hpp; inc/ntc_thermistor_adc_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
NTC thermistor (generic) package, 0603¶
Figure description and sources
The NTC thermistor (generic) package seen from the top and, when the height is known, from the side, drawn to scale: 1.6 x 0.8 x 0.8 mm. The arrows carry the datasheet's dimensions, the dot marks pin 1 and the pads are numbered counter-clockwise from it, coloured by the pin's electrical type (legend below). Pads sit centred on each side, evenly spaced; the datasheet's land pattern is the reference for a board.
Drawn from: docs/hardware.yml; inc/ntc_thermistor.hpp; inc/ntc_thermistor_adc_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
NTC thermistor (generic) pinout, 0603¶
Figure description and sources
The NTC thermistor (generic) seen from the top, in its 0603 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/ntc_thermistor.hpp; inc/ntc_thermistor_adc_interface.hpp.
Hardware description: docs/hardware.yml
Drawn from:
From an ADC code to a temperature¶
Figure description and sources
Top to bottom, each arrow hands one number to the next stage. Read() takes sample_count codes and their mean (the spread check can stop it as Unstable). The mean code is classified: at or above 2^bits is CodeOutOfScale, a code in the margin at the open rail is OpenCircuit, one in the margin at the short rail is ShortCircuit; which rail is which depends on the divider side. The node ratio gives the thermistor's resistance from the series resistor, in 1/256 ohm. The resistance goes through the curve: a table (a bounded binary search, then linear interpolation in ln R) or Steinhart-Hart (a cubic in ln R) or the beta equation (1/T in Q32), any of them with no floating point and no library. The temperature must lie inside the window; the offset is added last. The uncertainty bound is computed from the same code. The stages are the functions of inc/ntc_thermistor_conversion.hpp.
Drawn from: inc/ntc_thermistor_conversion.hpp ConvertCode(); inc/ntc_thermistor_conversion.hpp FineOfCode(); inc/ntc_thermistor_conversion.hpp CurveTemperature(); figure module docs/diagrams/figures/conversion-pipeline.py.
Figure module: docs/diagrams/figures/conversion-pipeline.py
Drawn from:
ConvertCode()ininc/ntc_thermistor_conversion.hppFineOfCode()ininc/ntc_thermistor_conversion.hppCurveTemperature()ininc/ntc_thermistor_conversion.hpp
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/ntc_thermistor.hpp public calls; inc/ntc_thermistor_adc_interface.hpp AdcInterface; figure module docs/diagrams/figures/driver-layers.py.
Figure module: docs/diagrams/figures/driver-layers.py
Drawn from:
public callsininc/ntc_thermistor.hppAdcInterfaceininc/ntc_thermistor_adc_interface.hpp