diff options
| author | wackazong <[email protected]> | 2025-01-10 11:50:40 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-09-04 13:38:14 +0200 |
| commit | 9ac8944478d43693da7dce41762c92e9d5777e06 (patch) | |
| tree | 7bc4214c3ca99910456cc4486ac83d2cf4855444 /examples | |
| parent | d1429868cefa319217089f6501cbafa503d6d6ba (diff) | |
Fix offset calculation
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/nrf52840/src/bin/nfct.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/nrf52840/src/bin/nfct.rs b/examples/nrf52840/src/bin/nfct.rs index 0b128c3bd..fafa37f48 100644 --- a/examples/nrf52840/src/bin/nfct.rs +++ b/examples/nrf52840/src/bin/nfct.rs | |||
| @@ -91,7 +91,7 @@ async fn main(_spawner: Spawner) { | |||
| 91 | } | 91 | } |
| 92 | (0, 0xb0, p1, p2) => { | 92 | (0, 0xb0, p1, p2) => { |
| 93 | info!("read"); | 93 | info!("read"); |
| 94 | let offs = u16::from_be_bytes([p1 & 0xef, p2]) as usize; | 94 | let offs = u16::from_be_bytes([p1 & 0x7f, p2]) as usize; |
| 95 | let len = if apdu.le == 0 { usize::MAX } else { apdu.le as usize }; | 95 | let len = if apdu.le == 0 { usize::MAX } else { apdu.le as usize }; |
| 96 | let n = len.min(selected.len() - offs); | 96 | let n = len.min(selected.len() - offs); |
| 97 | buf[..n].copy_from_slice(&selected[offs..][..n]); | 97 | buf[..n].copy_from_slice(&selected[offs..][..n]); |
