Skip to main content

pamoja_lora_radio_open_sx127x

Function pamoja_lora_radio_open_sx127x 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lora_radio_open_sx127x( spi: *const c_char, spi_hz: u32, gpio_chip: *const c_char, reset_line: u32, pa_boost: bool, tcxo: bool, out_radio: *mut *mut PamojaLoraRadio, ) -> PamojaStatus
Expand description

Opens an SX1276, SX1277, SX1278, or SX1279 module on a Linux board, such as an RFM95W, and resets it into LoRa mode.

§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 reset line is on, such as /dev/gpiochip0.
  • reset_line - the line the reset pin is on.
  • pa_boost - true when the antenna is on the PA_BOOST output, as on the RFM95W, and false for RFO.
  • tcxo - true when a TCXO drives the XTA pin instead of a crystal.
  • 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 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.