Skip to main content

culvert_async/client/
mod.rs

1//! The [`Scdc`] client.
2
3use hdmi_hal_async::scdc::ScdcTransport;
4
5mod ced;
6mod frl;
7mod scrambling;
8mod update;
9mod version;
10
11#[cfg(feature = "plumbob-async")]
12mod plumbob_client;
13
14#[cfg(test)]
15mod test_transport;
16
17/// Async typed client for the HDMI 2.1 SCDC (Status and Control Data Channel) register map.
18///
19/// `Scdc<T>` wraps an async [`ScdcTransport`] and exposes one typed `async fn` per register
20/// group. It holds no protocol state; all sequencing logic belongs in the caller.
21///
22/// # Example
23///
24/// ```rust
25/// use culvert_async::Scdc;
26/// use hdmi_hal_async::scdc::ScdcTransport;
27///
28/// struct StubTransport;
29/// impl ScdcTransport for StubTransport {
30///     type Error = core::convert::Infallible;
31///     async fn read(&self, _reg: u8) -> Result<u8, Self::Error> { Ok(0) }
32///     async fn write(&mut self, _reg: u8, _value: u8) -> Result<(), Self::Error> { Ok(()) }
33/// }
34///
35/// # pollster::block_on(async {
36/// let mut scdc = Scdc::new(StubTransport);
37/// let sink_version = scdc.read_sink_version().await.unwrap();
38/// scdc.write_source_version(1).await.unwrap();
39/// # });
40/// ```
41pub struct Scdc<T> {
42    transport: T,
43}
44
45impl<T: ScdcTransport> Scdc<T> {
46    /// Creates a new `Scdc` client wrapping the given async transport.
47    pub fn new(transport: T) -> Self {
48        Self { transport }
49    }
50
51    /// Consumes the client and returns the underlying transport.
52    pub fn into_transport(self) -> T {
53        self.transport
54    }
55}