ashv2 1.2.2

Implementation of the Asynchronous Serial Host (ASH) protocol by Silicon Labs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Common types used in the `ASHv2` protocol implementation.

use crate::frame::Data;

/// In the wost-case, all frame bytes are stuffed (*2) and we append the FLAG byte (+1).
pub const MAX_FRAME_SIZE: usize = Data::BUFFER_SIZE * 2 + 1;

/// A stack-allocated buffer that can hold bytes of an `ASHv2` frame up to its maximum size with stuffing.
pub type RawFrame = heapless::Vec<u8, MAX_FRAME_SIZE>;

/// The minimum payload size of an `ASHv2` `DATA` frame.
pub const MIN_PAYLOAD_SIZE: usize = Data::MIN_PAYLOAD_SIZE;

/// The maximum payload size of an `ASHv2` `DATA` frame.
pub const MAX_PAYLOAD_SIZE: usize = Data::MAX_PAYLOAD_SIZE;

/// A stack-allocated buffer that can hold payload for an `ASHv2` `DATA` frame up to its maximum size.
pub type Payload = heapless::Vec<u8, MAX_PAYLOAD_SIZE>;