Skip to main content

Crate litz_core

Crate litz_core 

Source
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§

Drive
What a pin is doing to its net right now.
PartId
Identifier of a device instance in a [Board].
PinId
Identifier of one pin of a Part.

Enums§

Level
A digital pin level.
PartState
The externally observable state of a part.
Strength
How hard a node is driven.

Constants§

RADIO_LAST_BYTES
How much of a radio’s last payload PartState::Radio carries. Longer frames are truncated in the state only; the part still moves every byte.
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.