diff --git a/CHANGELOG.md b/CHANGELOG.md index f19723a..ca9bc2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Fixed encoding of IN instruction with `bit_count` == 32 + ## [0.2.1] [Crates.io](https://crates.io/crates/pio-rs/0.2.1) [Github](https://github.com/rp-rs/pio-rs/releases/tag/v0.2.1) - Fixed the search path for `pio_file` when using relative paths diff --git a/src/lib.rs b/src/lib.rs index e5de4c7..99bdb6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -233,7 +233,10 @@ impl InstructionOperands { *index | (if *relative { 0b10000 } else { 0 }), ) } - InstructionOperands::IN { source, bit_count } => (*source as u8, *bit_count), + InstructionOperands::IN { + source, + bit_count , + } => (*source as u8, *bit_count & 0b11111), InstructionOperands::OUT { destination, bit_count,