Crate avr_tester
source ·Expand description
Functional testing framework for AVR binaries, powered by simavr:
use avr_tester::*;
// Assuming `yourproject` implements an 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 a single 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.
- Manages a single 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.
- Provides access to the UART interface.
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
AvrTesterAsyncfor usage inside components.