https://github.com/thenewwazoo/elatec-twn4-simple
Elatec TWN4 simple protocol client implementation using embedded-hal
https://github.com/thenewwazoo/elatec-twn4-simple
Last synced: 21 days ago
JSON representation
Elatec TWN4 simple protocol client implementation using embedded-hal
- Host: GitHub
- URL: https://github.com/thenewwazoo/elatec-twn4-simple
- Owner: thenewwazoo
- License: 0bsd
- Created: 2018-06-26T16:35:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-04T18:20:17.000Z (over 6 years ago)
- Last Synced: 2025-04-05T02:21:58.489Z (about 1 month ago)
- Language: Rust
- Size: 696 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
`elatec-twn4-simple`
====================This is an implementation of the Simple Protocol for the [Elatec TWN4](https://www.elatec-rfid.com/en/products/rfid-readerwriter-with-antenna/multi-frequency/twn4-multitech/) family of devices, based on [embedded-hal](https://github.com/japaric/embedded-hal).
It is an incomplete implementation, and contains only what the author has needed. Contributions are welcomed!
Example
-------Because `elatec-twn4-simple` uses `embedded-hal`, we can use `serial-embedded-hal` to test functionality on a desktop computer the same way we would on an embedded device.
```rust
extern crate elatec_multitec_nano_simple as reader;
extern crate embedded_hal;
extern crate serial_embedded_hal as serial;use std::time::Duration;
fn main() {
env_logger::init();let settings = serial::PortSettings {
baud_rate: serial::BaudRate::Baud9600,
char_size: serial::CharSize::Bits8,
parity: serial::Parity::ParityNone,
stop_bits: serial::StopBits::Stop1,
flow_control: serial::FlowControl::FlowNone,
};
let (tx, rx) = serial::Serial::new("/dev/tty.usbmodem142331", &settings).unwrap().split();let mut reader = reader::new(rx, tx);
let mut ver_buf = [0u8; 0xFF];
let v_len = reader.get_version_string(&mut ver_buf).unwrap();
println!(
"ver: {} \"{}\"",
v_len,
std::str::from_utf8(&ver_buf[..v_len as usize]).unwrap()
);
}
```