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