Expand description
Foundation types shared by every Litz crate.
Litz is a firmware simulator split along three seams:
Bus— what the CPU sees: an address space, peripherals hang off it.Mcu— a chip: CPU core plus on-chip peripherals, stepped by time.Part— anything on the schematic: LED, button, sensor, display. It only ever sees pin levels, never the MCU’s internals.
Keeping those three apart is what lets litz-esp and litz-avr share the
same parts bin, and what lets the same core compile for a host CLI and for
wasm32-unknown-unknown.
Time is a u64 count of nanoseconds (Tick). Every peripheral declares
its own clock period in ticks; a domain whose period does not divide one
nanosecond (a 160 MHz core is 6.25 ns per cycle) carries a fractional
remainder, which is exactly what a hardware clock divider does. No floating
point anywhere in the schedule, so two runs of one firmware produce the
same trace on every host.
Structs§
Enums§
- Level
- A digital pin level.
Constants§
- TICKS_
PER_ SEC - Ticks in one second. Time is fixed-point by construction.
Traits§
- Bus
- The address space a CPU core sees.
- Mcu
- A microcontroller: a CPU plus the peripherals on its bus.
- Part
- A schematic component. Parts never read MCU registers; they react to pin levels and to time, which is the same contract a real part has.
Type Aliases§
- Tick
- Nanoseconds since simulation start.