pio-rs
pio-rs copied to clipboard
Fix encoding of IN instruction with bit_count == 32
Thanks to @xeniarose for finding and reporting this bug
Fixes #57 Replaces #60
maybe add a test?
how about 4 tests?
instr_test!(r#in(InSource::Y, 10), 0b010_00000_010_01010);
instr_test!(r#in(InSource::Y, 32), 0b010_00000_010_00000);
instr_test!(out(OutDestination::Y, 10), 0b011_00000_010_01010);
instr_test!(out(OutDestination::Y, 32), 0b011_00000_010_00000);
#[test]
#[should_panic]
fn test_invalid_in_bit_width_should_panic() {
let mut a = Assembler::<32>::new();
a.r#in(InSource::Y, 33);
a.assemble_program();
}
#[test]
#[should_panic]
fn test_invalid_out_bit_width_should_panic() {
let mut a = Assembler::<32>::new();
a.out(OutDestination::X, 33);
a.assemble_program();
}