Expand description
Framework for testing AVR binaries, powered by simavr:
use avr_tester::*;
// Assuming `firmware` implements a ROT-13 encoder:
#[test]
fn test() {
let mut avr = AvrTester::atmega328p()
.with_clock_of_16_mhz()
.load("../../firmware/target/avr-none/release/firmware.elf");
// Let's give our firmware a moment to initialize:
avr.run_for_ms(1);
// Now, let's send the string:
avr.uart0().write("Hello, World!");
// ... give the AVR a moment to retrieve it & send back, encoded:
avr.run_for_ms(1);
// ... and, finally, let's assert the outcome:
assert_eq!("Uryyb, Jbeyq!", avr.uart0().read::<String>());
}
See more: <../tests/examples>.
Structs§
- Analog
Pin - Provides access to an analog pin, e.g.
ADC1
. - Analog
PinAsync - Asynchronous equivalent of
AnalogPin
. - AvrDuration
- Like
std::time::Duration
, but in AVR cycles; somewhat approximate¹. - AvrTester
- The Tester; use
AvrTester::atmega328p()
etc. to construct it. - AvrTester
Async - Asynchronous equivalent of
AvrTester
. - AvrTester
Builder - Component
Handle - Components
- Manages components.
- Digital
Pin - Provides access to a digital pin, e.g.
PD4
. - Digital
PinAsync - Asynchronous equivalent of
DigitalPin
. - Pins
- Provides access to analog and digital pins.
- Pins
Async - Asynchronous equivalent of
Pins
. - Spi
- Provides access to the SPI.
- SpiAsync
- Asynchronous equivalent of
Spi
. - Twi
- Provides access to the TWI (aka I2C).
- TwiPacket
- TwiSlave
Id - Uart
- Provides access to the UART.
- Uart
Async - Asynchronous equivalent of
Uart
.
Enums§
Traits§
- AvrDuration
Ext - Into
Cycles - Readable
- Value that can be retrieved from a
Reader
. - Reader
- Object that can be read from, e.g.
crate::Uart
. - Reader
Helper - TwiSlave
- Writable
- Value that can be transmitted through a
Writer
. - Writer
- Object that can be written to, e.g.
crate::Uart
. - Writer
Helper
Functions§
- avr_rt
- Returns
AvrTesterAsync
for usage inside components.