Module capsules_extra::bus

source ·
Expand description

Abstraction Interface for several busses. Useful for devices that support multiple protocols

§Usage

I2C example

let bus = components::bus::I2CMasterBusComponent::new(i2c_mux, address)
    .finalize(components::spi_bus_component_helper!());

SPI example

let bus =
    components::bus::SpiMasterBusComponent::new().finalize(components::spi_bus_component_helper!(
        // spi type
        nrf52840::spi::SPIM,
        // chip select
        &nrf52840::gpio::PORT[GPIO_D4],
         // spi mux
        spi_mux
    ));

Structs§

Enums§

  • The DataWidth enum and associated BusAddr structs define the width of the data transmitted over a bus. The `BusAddr::bytes`` function transforms the address into the specified endianness and returns an iterator.

Traits§

  • The BusAddr trait is implemented for each BusAddr struct. It provides information about the data width and a way to access the underlying byte representation.