Skip to main content

Module hal

Module hal 

Source
Expand description

Minimal hardware abstraction for IoT hosts.

Host firmware implements these traits and registers matching FFI callbacks. The simulated implementation below is used for desktop demos and tests.

Structs§

SimulatedHal
Desktop/simulator HAL: 32 virtual GPIO pins + a tick counter for delay.

Traits§

Adc
Delay
Gpio

Functions§

builtin_adc_read
adc_read(channel) → int raw
builtin_delay_ms
delay_ms(ms) — simulated; advances the HAL clock only.
builtin_gpio_read
gpio_read(pin) → bool
builtin_gpio_write
gpio_write(pin, high) — pin: int, high: bool
sim_drive_pin
Test/demo helper: force an external pin level.
sim_elapsed_ms
Test/demo helper: read simulated elapsed ms.
sim_set_adc
Test/demo helper: inject a simulated ADC reading.

Type Aliases§

Pin