pub struct SimpleCodec<const HEADER_SIZE: usize> {}
Expand description
This codec represents the most commonly found codecs for I2C devices. The main variable is the size of register addresses in bytes.
This codec has no information over register sizes or the existence of read/write address-auto-increment which some devices support. It will always send one header and then receive/send the associated register data, so it’s compatible with auto-increment usage, but cannot be used to read or write registers that require interspersing the address between bytes.
Devices often use a mixed mode, where some registers allow auto-increment while others don’t, or where the address is directly associated with a specific, but varying, register size. Therefore, it is up to the user to make sure that accessing a register via this codec is supported by the hardware.
The following generic parameters are available:
Parameter | Type | Description |
---|---|---|
HEADER_SIZE | usize | The size of the command header (register address) in bytes |