pub struct Wiring {
pub spi: PathBuf,
pub spi_hz: u32,
pub gpio_chip: PathBuf,
pub reset_line: u32,
pub busy_line: Option<u32>,
}Expand description
Where a radio module is wired on a Linux board.
§Examples
use pamoja_radios::linux::{Wiring, DEFAULT_SPI_HZ};
// An SX1262 board on SPI0's second chip select, BUSY on GPIO24 and reset on GPIO25.
let wiring = Wiring::new("/dev/spidev0.1", "/dev/gpiochip0", 25).with_busy_line(24);
assert_eq!(wiring.busy_line, Some(24));
assert_eq!(wiring.spi_hz, DEFAULT_SPI_HZ);Fields§
§spi: PathBufThe SPI device file, one per chip select, such as /dev/spidev0.0.
spi_hz: u32The SPI clock in hertz.
gpio_chip: PathBufThe GPIO chip the lines are on, /dev/gpiochip0 for a Raspberry Pi’s header.
reset_line: u32The line the module’s reset pin is on: its offset on the chip, which on a Raspberry Pi is the BCM GPIO number.
busy_line: Option<u32>The line an SX126x’s BUSY pin is on. The SX127x has no BUSY pin.
Implementations§
Source§impl Wiring
impl Wiring
Sourcepub fn new(
spi: impl Into<PathBuf>,
gpio_chip: impl Into<PathBuf>,
reset_line: u32,
) -> Wiring
pub fn new( spi: impl Into<PathBuf>, gpio_chip: impl Into<PathBuf>, reset_line: u32, ) -> Wiring
Describes a module on an SPI device with its reset pin on a GPIO line, clocked at
DEFAULT_SPI_HZ and with no BUSY line.
§Arguments
spi- the SPI device file.gpio_chip- the GPIO chip the lines are on.reset_line- the line the reset pin is on.
§Returns
The wiring.
Sourcepub fn with_busy_line(self, line: u32) -> Wiring
pub fn with_busy_line(self, line: u32) -> Wiring
Trait Implementations§
impl Eq for Wiring
impl StructuralPartialEq for Wiring
Auto Trait Implementations§
impl Freeze for Wiring
impl RefUnwindSafe for Wiring
impl Send for Wiring
impl Sync for Wiring
impl Unpin for Wiring
impl UnsafeUnpin for Wiring
impl UnwindSafe for Wiring
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more