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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! # PSICOSE-1B
//!
//! A `no_std`, heapless, deterministic, byte-oriented transport protocol.
//! The **payload** is exactly one byte; the **frame** is always four.
//!
//! ```text
//! APPLICATION
//! │
//! ▼
//! ┌────────────────┐
//! │ byte source │
//! └────────┬───────┘
//! │ byte by byte
//! ▼
//! ┌──────────────────┐
//! │ PSICOSE-1B │
//! │ tx::Sender │
//! └────────┬─────────┘
//! │
//! ┌──────┴──────┐
//! │ │
//! DATA ACK/NACK
//! │ │
//! └──────┬──────┘
//! ▼
//! ByteTransport
//! │
//! ┌─────────────┼─────────────┐
//! ▼ ▼ ▼
//! UART SPI RADIO
//! ```
//!
//! ## Non-negotiable properties
//!
//! - **`#![no_std]`, `#![forbid(unsafe_code)]`.** No heap, no `Vec`, no
//! `String`, no `Box`, no `Rc`/`Arc`, no async runtime. Every type in
//! this crate is stack-allocated and has a size known at compile time.
//! - **Constant memory regardless of transfer size.** A 4-byte config blob
//! and a multi-gigabyte file are transferred through the exact same
//! `Sender`/`Receiver` (1 in flight) or [`window::WindowedSender`]
//! (`N ≤ 8` in flight) pair. The protocol never owns the file — only
//! the window of payload bytes currently on the wire.
//! - **The wire frame is fixed at [`protocol::FRAME_LEN`] = 4 bytes:**
//! `TYPE(1) | SEQ(1) | DATA(1) | CRC(1)`. `DATA` is always exactly one
//! byte, by design — see the module docs on [`protocol::frame`] for why.
//! - **Reliability is the protocol's job, not the application's.** ACK,
//! NACK, sequence numbers, CRC-8, and tick-based retransmission are all
//! handled by [`tx::Sender`] / [`rx::Receiver`] so the application only
//! ever sees clean, in-order bytes.
//!
//! ## Minimal example
//!
//! ```
//! use psicose::Frame;
//! let frame = Frame::data(0, 0xAA);
//! assert_eq!(Frame::from_bytes(frame.to_bytes()).unwrap(), frame);
//! ```
//!
//! ## What's here vs. what's next
//!
//! This is **0.2.0**: stop-and-wait (1B) plus selective-repeat
//! [`window`] (`N ≤ 8`, `[Option<T>; N]`, no heap, no `std`). File and
//! UART/SPI stay out. The formal wire spec ships as `PROTOCOL.md`
//! (English) and `PROTOCOL.pt-BR.md` in the crate.
//!
//! **Payload is 1 byte. The frame is 4 bytes.** `DATA` is the only
//! application bit; `TYPE|SEQ|CRC` are overhead (25% before ACKs, 12.5%
//! stop-and-wait). [`actors`] schedules N receivers on one thread.
pub use Error;
pub use ;
pub use ;
pub use RetryPolicy;
pub use ;
pub use ;
pub use ;