Skip to main content

Register

Trait Register 

Source
pub trait Register:
    Default
    + Clone
    + Pod {
    type Bitfield;
    type SpiCodec: CodecSync + CodecAsync;
    type I2cCodec: CodecSync + CodecAsync;

    const REGISTER_SIZE: usize;
    const ADDRESS: u64;

    // Required methods
    fn data(&self) -> &[u8];
    fn data_mut(&mut self) -> &mut [u8] ⓘ;
}
Expand description

The basis trait for all registers. A register is a type that maps to a specific register on an embedded device and should own the raw data required for this register.

Additionally, a register knows the virtual address ossociated to the embedded device, and a bitfield representation of the data content.

Required Associated Constants§

Source

const REGISTER_SIZE: usize

The size of the register in bytes

Source

const ADDRESS: u64

The virtual address of this register

Required Associated Types§

Source

type Bitfield

The associated bondrewd bitfield type

Source

type SpiCodec: CodecSync + CodecAsync

Source

type I2cCodec: CodecSync + CodecAsync

Required Methods§

Source

fn data(&self) -> &[u8]

Provides immutable access to the raw data.

Source

fn data_mut(&mut self) -> &mut [u8] ⓘ

Provides mutable access to the raw data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§