embedded_registers/i2c/codecs/
no_codec.rs1use crate::{ReadableRegister, WritableRegister};
2
3#[derive(Default)]
15pub struct NoCodec {}
16
17#[maybe_async_cfg::maybe(
18 idents(hal(sync = "embedded_hal", async = "embedded_hal_async"), Codec, I2cBoundBus),
19 sync(feature = "sync"),
20 async(feature = "async"),
21 keep_self
22)]
23impl crate::i2c::Codec for NoCodec {
24 #[inline]
25 async fn read_register<R, I, A>(_bound_bus: &mut crate::i2c::I2cBoundBus<I, A>) -> Result<R, I::Error>
26 where
27 R: ReadableRegister,
28 I: hal::i2c::I2c<A> + hal::i2c::ErrorType,
29 A: hal::i2c::AddressMode + Copy,
30 {
31 panic!("i2c::codecs::NoCodec cannot be used at runtime! Please specify a real codec to access this register.");
32 }
33
34 #[inline]
35 async fn write_register<R, I, A>(
36 _bound_bus: &mut crate::i2c::I2cBoundBus<I, A>,
37 _register: impl AsRef<R>,
38 ) -> Result<(), I::Error>
39 where
40 R: WritableRegister,
41 I: hal::i2c::I2c<A> + hal::i2c::ErrorType,
42 A: hal::i2c::AddressMode + Copy,
43 {
44 panic!("i2c::codecs::NoCodec cannot be used at runtime! Please specify a real codec to access this register.");
45 }
46}