hart-link 0.3.0

HART tools for embedded and asynchronous applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Canonical HART frame representation and streaming decoder.

mod address;
mod decoder;
mod frame;

pub use address::{Address, Master};
pub use decoder::{
    ChecksumPolicy, DecodeEvent, DecodeLimits, DecodeLimitsError, DecodeStatistics, FrameDecoder,
    MAXIMUM_DECODE_BUFFER_CAPACITY, MAXIMUM_DECODE_EVENTS_PER_PUSH,
};
pub use frame::{Frame, FrameKind, FrameRepair, MAX_ENCODED_FRAME_SIZE, PhysicalLayer, WireError};

pub(crate) fn xor_checksum(bytes: &[u8]) -> u8 {
    bytes.iter().fold(0, |sum, byte| sum ^ byte)
}