Hardware Development
This section contains information for hardware developers working on the Latency Recorder project.
Firmware Documentation
The latency recorder firmware is written in Rust and consists of three main components:
Core Library (latreclib)
A #![no_std]
library providing helper functions and abstractions for the latency recorder hardware.
Recorder Firmware
The main firmware application that runs on the Arduino hardware. This handles:
- ADC sampling at high frequency
- Serial communication with the host computer
- Timing and synchronization
- Hardware control
Simulator
A hardware simulator that allows testing the firmware logic without physical Arduino hardware.
API Documentation
The firmware is documented using Rust's built-in documentation system. The API documentation includes:
- Bit manipulation functions:
bools2num()
andnum2bools()
for converting between boolean arrays and numeric values - Hardware abstractions: Low-level interfaces for AVR microcontroller
- Usage examples: Comprehensive code examples for all functions
View API Documentation
📚 Rust Firmware API Reference
Explore the complete API documentation for all firmware crates: latreclib, recorder, and simulator.
View API Documentation →Generating Documentation
To regenerate the API documentation for the firmware:
./generate-docs.sh
Note: The recorder and simulator documentation requires the AVR toolchain to be properly configured.
Hardware Components
Arduino Nano
- ATmega328P microcontroller
- 16 MHz clock speed
- 10-bit ADC with up to 15 kHz sampling rate
- Serial communication at 115200 baud
Signal Conditioning
- TLV2462 op-amp for signal amplification
- Voltage divider for input protection
- Low-pass filtering for noise reduction
Development Setup
-
Install Rust and required targets:
rustup target add avr-unknown-gnu-atmega328
-
Install AVR toolchain (macOS):
brew tap osx-cross/avr brew install avr-gcc avrdude
-
Build the firmware:
cd firmware/recorder cargo build --release
-
Flash to Arduino:
avrdude -p atmega328p -c arduino -P /dev/tty.usbserial-* -b 115200 -U flash:w:target/avr-atmega328p/release/recorder.elf:e