Skip to main content

Module sample

Module sample 

Source
Expand description

The embedded demo project: a realistic two-ECU powertrain description and the CAN database that binds it.

These are the fixtures the crate’s own tests, doctests, and the calibrate example run against. They are embedded (include_str!) so every downstream user gets a working example without a data directory, and they are deliberately realistic: vendor IF_DATA, AXIS_DESCR, and COMPU_TAB blocks the A2L parser must skip, every conversion type, and limits on every adjustable.

§COMPU_TAB points are registered, not parsed

The A2L text carries its COMPU_TAB/COMPU_VTAB blocks for fidelity, but a2l_parse skips them (they are unknown sub-blocks of COMPU_METHOD). tables holds the same points as data; sample_project registers them so the TABLE conversions resolve.

§Element counts are declared

a2l_parse does not retain the ASAP2 NUMBER/NO_AXIS_PTS keywords, so element_counts carries them for CalibrationProject::declare_elements — again, a declaration rather than a guess.

Constants§

SAMPLE_A2L
A realistic two-ECU A2L description: 15 characteristics (including a CURVE, two MAPs, a VAL_BLK, and an ASCII identifier), 5 measurements, and COMPU_METHODs covering every conversion type (LINEAR, RAT_FUNC in both its reducible and quadratic forms, TABLE in both interpolated and stepped form, and IDENTITY).
SAMPLE_DBC
The CAN database that binds SAMPLE_A2L’s characteristics to message signals — Intel and Motorola layouts, UWORD/UBYTE widths.

Functions§

complete
Register tables and declare element_counts on an already-parsed project.
element_counts
The element counts of the sample project’s multi-element characteristics — the NUMBER/NO_AXIS_PTS declarations that a2l_parse does not retain.
sample_project
Build the demo project: SAMPLE_A2L parsed, completed by complete.
seed_memory
The ECU memory the demo project starts from: (address, bytes) seeds, one per address the tests and example read before their first write.
tables
The COMPU_TAB points of SAMPLE_A2L, as (name, points) pairs.