Skip to main content

pamoja_lora_radio_open_sx126x

Function pamoja_lora_radio_open_sx126x 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lora_radio_open_sx126x( spi: *const c_char, spi_hz: u32, gpio_chip: *const c_char, busy_line: u32, reset_line: u32, board: PamojaSx126xBoard, out_radio: *mut *mut PamojaLoraRadio, ) -> PamojaStatus
Expand description

Opens an SX1261, SX1262, SX1268, or LLCC68 module on a Linux board and resets it.

§Arguments

  • spi - the SPI device file, such as /dev/spidev0.0.
  • spi_hz - the SPI clock in hertz, or 0 for PAMOJA_LORA_RADIO_DEFAULT_SPI_HZ.
  • gpio_chip - the GPIO chip the lines are on, such as /dev/gpiochip0.
  • busy_line - the line the BUSY pin is on.
  • reset_line - the line the reset pin is on.
  • board - how the module wires the chip.
  • out_radio - receives the radio, or null when opening fails.

§Returns

PamojaStatus::Ok with the radio in out_radio; PamojaStatus::Unsupported on any platform but Linux; PamojaStatus::InvalidArgument for a null or non-UTF-8 argument or a TCXO voltage past 7; or PamojaStatus::Io when a device cannot be opened or no chip answers. The last error message says which.

§Safety

spi and gpio_chip must be null-terminated strings or null, and out_radio a writable pointer or null.