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§
- Each
BusAddr
struct represents a specific data width and endianness. 8 bit Bus Address - 16 bit Big Endian Bus Address
- 16 bit Little Endian Bus Address
- 32 bit Big Endian Bus Address
- 32 bit Little Endian Bus Address
- 64 bit Big Endian Bus Address
- 64 bit Little Endian Bus Address
Enums§
- The
DataWidth
enum and associatedBusAddr
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.