Skip to main content

open_usb_sx1302

Function open_usb_sx1302 

Source
pub fn open_usb_sx1302(port: impl AsRef<Path>) -> Result<UsbCard, OpenError>
Expand description

Opens a concentrator on a USB card, and brings the card up.

The card enumerates as a serial device, /dev/ttyACM0 on a Raspberry Pi with nothing else plugged in. The port is opened raw, the bridge is asked who it is and how it is, the supply is switched on and both resets are pulsed in the order the reference does them, and then the concentrator is reset once more through the driver, so it is in the same state a concentrator on SPI is left in by open_sx1302.

A bridge running a different firmware than this crate was written for is not refused; the reference warns and carries on, and the caller has UsbCard::identity to do the same.

§Arguments

  • port - the serial device the card is on.

§Returns

The card, with its concentrator answering.

§Errors

OpenError::Unsupported on any platform but Linux, OpenError::Bus when the port cannot be opened, OpenError::Bridge when the bridge does not answer or refuses a pin, and OpenError::ResetLine when the concentrator cannot be reset through it.