[][src]Trait radio_sx128x::base::Hal

pub trait Hal<CommsError, PinError> {
    fn reset(&mut self) -> Result<(), Error<CommsError, PinError>>;
fn get_busy(&mut self) -> Result<PinState, Error<CommsError, PinError>>;
fn delay_ms(&mut self, ms: u32);
fn write_cmd(
        &mut self,
        command: u8,
        data: &[u8]
    ) -> Result<(), Error<CommsError, PinError>>;
fn read_cmd(
        &mut self,
        command: u8,
        data: &mut [u8]
    ) -> Result<(), Error<CommsError, PinError>>;
fn write_regs(
        &mut self,
        reg: u16,
        data: &[u8]
    ) -> Result<(), Error<CommsError, PinError>>;
fn read_regs(
        &mut self,
        reg: u16,
        data: &mut [u8]
    ) -> Result<(), Error<CommsError, PinError>>;
fn write_buff(
        &mut self,
        offset: u8,
        data: &[u8]
    ) -> Result<(), Error<CommsError, PinError>>;
fn read_buff(
        &mut self,
        offset: u8,
        data: &mut [u8]
    ) -> Result<(), Error<CommsError, PinError>>; fn wait_busy(&mut self) -> Result<(), Error<CommsError, PinError>> { ... }
fn read_reg(&mut self, reg: u8) -> Result<u8, Error<CommsError, PinError>> { ... }
fn write_reg(
        &mut self,
        reg: u8,
        value: u8
    ) -> Result<(), Error<CommsError, PinError>> { ... }
fn update_reg(
        &mut self,
        reg: u8,
        mask: u8,
        value: u8
    ) -> Result<u8, Error<CommsError, PinError>> { ... } }

Comms implementation can be generic over SPI or UART connections

Required methods

fn reset(&mut self) -> Result<(), Error<CommsError, PinError>>

Reset the device

fn get_busy(&mut self) -> Result<PinState, Error<CommsError, PinError>>

Wait on radio device busy

fn delay_ms(&mut self, ms: u32)

Delay for the specified time

fn write_cmd(
    &mut self,
    command: u8,
    data: &[u8]
) -> Result<(), Error<CommsError, PinError>>

Write the specified command and data

fn read_cmd(
    &mut self,
    command: u8,
    data: &mut [u8]
) -> Result<(), Error<CommsError, PinError>>

Read the specified command and data

fn write_regs(
    &mut self,
    reg: u16,
    data: &[u8]
) -> Result<(), Error<CommsError, PinError>>

Write to the specified register

fn read_regs(
    &mut self,
    reg: u16,
    data: &mut [u8]
) -> Result<(), Error<CommsError, PinError>>

Read from the specified register

fn write_buff(
    &mut self,
    offset: u8,
    data: &[u8]
) -> Result<(), Error<CommsError, PinError>>

Write to the specified buffer

fn read_buff(
    &mut self,
    offset: u8,
    data: &mut [u8]
) -> Result<(), Error<CommsError, PinError>>

Read from the specified buffer

Loading content...

Provided methods

fn wait_busy(&mut self) -> Result<(), Error<CommsError, PinError>>

Wait on radio device busy

fn read_reg(&mut self, reg: u8) -> Result<u8, Error<CommsError, PinError>>

Read a single u8 value from the specified register

fn write_reg(
    &mut self,
    reg: u8,
    value: u8
) -> Result<(), Error<CommsError, PinError>>

Write a single u8 value to the specified register

fn update_reg(
    &mut self,
    reg: u8,
    mask: u8,
    value: u8
) -> Result<u8, Error<CommsError, PinError>>

Update the specified register with the provided value & mask

Loading content...

Implementors

impl<T, CommsError, PinError> Hal<CommsError, PinError> for T where
    T: Transactional<Error = WrapError<CommsError, PinError>>,
    T: Reset<Error = WrapError<CommsError, PinError>>,
    T: Busy<Error = WrapError<CommsError, PinError>>,
    T: DelayMs<u32>, 
[src]

fn reset(&mut self) -> Result<(), Error<CommsError, PinError>>[src]

Reset the radio

fn delay_ms(&mut self, ms: u32)[src]

Delay for the specified time

fn write_cmd(
    &mut self,
    command: u8,
    data: &[u8]
) -> Result<(), Error<CommsError, PinError>>
[src]

Write the specified command and data

fn read_cmd<'a>(
    &mut self,
    command: u8,
    data: &mut [u8]
) -> Result<(), Error<CommsError, PinError>>
[src]

Read the specified command and data

fn write_regs(
    &mut self,
    reg: u16,
    data: &[u8]
) -> Result<(), Error<CommsError, PinError>>
[src]

Write to the specified register

fn read_regs<'a>(
    &mut self,
    reg: u16,
    data: &mut [u8]
) -> Result<(), Error<CommsError, PinError>>
[src]

Read from the specified register

fn write_buff(
    &mut self,
    offset: u8,
    data: &[u8]
) -> Result<(), Error<CommsError, PinError>>
[src]

Write to the specified buffer

fn read_buff<'a>(
    &mut self,
    offset: u8,
    data: &mut [u8]
) -> Result<(), Error<CommsError, PinError>>
[src]

Read from the specified buffer

Loading content...