Crate avr_tester
source ·Expand description
Functional testing framework for AVR binaries, powered by simavr:
use avr_tester::*;
// Assuming `yourproject` implements a ROT-13 encoder:
#[test]
fn test() {
let mut avr = AvrTester::atmega328p()
.with_clock_of_16_mhz()
.load("../../yourproject/target/atmega328p/release/yourproject.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>());
}
For more details, please see README.
Structs
- Provides access to an analog pin, e.g.
ADC1
. - Asynchronous equivalent of
AnalogPin
. - Like
std::time::Duration
, but in AVR cycles; somewhat approximate¹. - Simulator’s entry point; you can build it using
AvrTester::atmega328p()
or a similar function. - Asynchronous equivalent of
AvrTester
. - Manages components.
- Provides access to a digital pin, e.g.
PD4
. - Asynchronous equivalent of
DigitalPin
. - Provides access to analog and digital pins.
- Asynchronous equivalent of
Pins
. - Provides access to the SPI interface.
- Asynchronous equivalent of
Spi
. - Provides access to the UART interface.
- Asynchronous equivalent of
Uart
.
Enums
Traits
- Value that can be retrieved from a
Reader
. - Object that can be read from, e.g.
crate::Uart
. - Value that can be transmitted through a
Writer
. - Object that can be written to, e.g.
crate::Uart
.
Functions
- Returns
AvrTesterAsync
for usage inside components.