1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! The abstraction boundary between PSICOSE-1B and physical hardware.
//!
//! Everything above this line (frames, state machines, retry policy) is
//! hardware-agnostic. Everything below it is a concrete implementation for
//! UART, SPI, a radio, an in-memory test double, or anything else that can
//! move one byte at a time. The protocol never needs to know which.
/// A byte-oriented, non-blocking, bidirectional link.
///
/// Implementations are expected to be **non-blocking**: [`read_byte`] must
/// return `Ok(None)` immediately if no byte is currently available, rather
/// than blocking the caller. This is what lets [`crate::tx::Sender`] and
/// [`crate::rx::Receiver`] implement their own timeout/retry logic on top,
/// independent of whatever clock or scheduler the host system uses.
///
/// # How to get an implementation
///
/// - **Tests / host examples:** in-memory [`crate::Wire`].
/// - **Hardware:** implement this trait on your UART/SPI/radio, then wrap
/// with [`crate::LinkFace`] so TX and RX do not steal frames; pass the
/// split ends to [`crate::Pump::on`].
/// - No adapter crates — only types from `psicose`.
///
/// [`read_byte`]: ByteTransport::read_byte
/// A read-only source of bytes — e.g. a file, a flash region, or a sensor
/// buffer being streamed out one byte at a time.
///
/// Decoupled from [`ByteTransport`] on purpose: the thing PSICOSE reads
/// application data *from* is a separate concern from the link it sends
/// wire frames *over*, and the two are frequently different types (a file
/// on one side, a UART on the other).
/// A write-only destination for bytes — the mirror image of [`ByteSource`].