Skip to main content

ws63_hal/
private.rs

1//! Private module for sealed traits.
2//!
3//! These traits cannot be implemented outside this crate, enabling
4//! the sealed trait pattern used throughout the HAL.
5
6/// A trait that is sealed (cannot be implemented outside this crate).
7pub trait Sealed {}
8
9// ── DMA-related sealed traits ─────────────────────────────────────
10
11/// Marker trait for types that can be used as DMA transfer words.
12pub trait DmaWord: Sealed + Copy + 'static {}
13
14impl Sealed for u8 {}
15impl DmaWord for u8 {}
16impl Sealed for u16 {}
17impl DmaWord for u16 {}
18impl Sealed for u32 {}
19impl DmaWord for u32 {}
20
21// ── GPIO-related sealed traits ───────────────────────────────────
22
23/// Types that can serve as peripheral inputs (signals from GPIO matrix towards peripherals).
24pub trait PeripheralOutput: Sealed {}
25
26/// Types that can serve as peripheral outputs (signals from peripherals towards GPIO matrix).
27pub trait PeripheralInput: Sealed {}
28
29// The `DriverMode` / `Blocking` / `Async` marker traits were removed: every
30// associated type was the identity (`type Async<D> = D`), nothing referenced
31// them, and they advertised an async capability that does not exist. Re-add a
32// real driver-mode distinction only when an async executor actually backs it
33// (ROADMAP phase 6).