#tags #communicating #nfc #mem #devices #high-level #srix4k-cached

bin+lib srix4k

High-level crate for communicating with SRIX4K NFC tags

1 unstable release

Uses old Rust 2015

0.1.0 May 13, 2023

#894 in Hardware support

Download history 3/week @ 2024-02-23 1/week @ 2024-03-01 2/week @ 2024-03-08 86/week @ 2024-03-22 13/week @ 2024-03-29

101 downloads per month

GPL-3.0-only

19KB
214 lines

srix4k

This crate is a higher-level way to read/write to SRIX4K tags.

The most interesting feature about this crate is the Srix4kCached struct. This struct caches memory accesses to the connected SRIX4K tag, speeding up read/write operations. To write data to the tag call the .sync() method on the Srix4kCached struct.

Example

use nfc1::{Result};
use srix4k::{Srix4kCached, mem};

fn main() -> Result<()> {
    let mut context = nfc1::Context::new()?;
    let mut device = context.open()?;
    device.set_property_bool(nfc1::Property::InfiniteSelect, true)?;
    
    let mut tag = Srix4kCached::connect_from(device)?;
    println!("uid: 0x{:X}", tag.uid_get()?);
    
    let block00 = tag.eeprom_get_mut(mem::EEPROM.start)?;
    println!("block 00: {:#010X}", block00);
    *block00 = 0xDEADBEEF;
    
    tag.sync()?;

    Ok(())
}

Dependencies

~1–3MB
~62K SLoC