diff --git a/embassy-lora/src/sx126x/mod.rs b/embassy-lora/src/sx126x/mod.rs index 8559574cb1..54599242c0 100644 --- a/embassy-lora/src/sx126x/mod.rs +++ b/embassy-lora/src/sx126x/mod.rs @@ -34,8 +34,8 @@ where spi: SPI, cs: CTRL, reset: CTRL, - antenna_rx: CTRL, - antenna_tx: CTRL, + antenna_rx: Option, + antenna_tx: Option, dio1: WAIT, busy: WAIT, enable_public_network: bool, @@ -110,7 +110,6 @@ where CTRL: 'm, WAIT: 'm, BUS: 'm; - fn rx<'m>(&'m mut self, config: RfConfig, receiving_buffer: &'m mut [u8]) -> Self::RxFuture<'m> { trace!("RX START"); async move { diff --git a/embassy-lora/src/sx126x/sx126x_lora/board_specific.rs b/embassy-lora/src/sx126x/sx126x_lora/board_specific.rs index a7b9e1486a..752e65536d 100644 --- a/embassy-lora/src/sx126x/sx126x_lora/board_specific.rs +++ b/embassy-lora/src/sx126x/sx126x_lora/board_specific.rs @@ -25,9 +25,8 @@ where // Initialize the TCXO power pin pub(super) async fn brd_io_tcxo_init(&mut self) -> Result<(), RadioError> { - let timeout = self.brd_get_board_tcxo_wakeup_time() << 6; - self.sub_set_dio3_as_tcxo_ctrl(TcxoCtrlVoltage::Ctrl1V7, timeout) - .await?; + //let timeout = self.brd_get_board_tcxo_wakeup_time() << 6; + //self.sub_set_dio3_as_tcxo_ctrl(TcxoCtrlVoltage::Ctrl1V7, timeout).await?; Ok(()) } @@ -207,22 +206,34 @@ where // Quiesce the antenna(s). pub(super) fn brd_ant_sleep(&mut self) -> Result<(), RadioError> { - self.antenna_tx.set_low().map_err(|_| AntTx)?; - self.antenna_rx.set_low().map_err(|_| AntRx)?; + if let Some(antenna_tx) = &mut self.antenna_tx { + antenna_tx.set_low().map_err(|_| AntTx)?; + } + if let Some(antenna_rx) = &mut self.antenna_rx { + antenna_rx.set_low().map_err(|_| AntRx)?; + } Ok(()) } // Prepare the antenna(s) for a receive operation pub(super) fn brd_ant_set_rx(&mut self) -> Result<(), RadioError> { - self.antenna_tx.set_low().map_err(|_| AntTx)?; - self.antenna_rx.set_high().map_err(|_| AntRx)?; + if let Some(antenna_tx) = &mut self.antenna_tx { + antenna_tx.set_low().map_err(|_| AntTx)?; + } + if let Some(antenna_rx) = &mut self.antenna_rx { + antenna_rx.set_high().map_err(|_| AntRx)?; + } Ok(()) } // Prepare the antenna(s) for a send operation pub(super) fn brd_ant_set_tx(&mut self) -> Result<(), RadioError> { - self.antenna_rx.set_low().map_err(|_| AntRx)?; - self.antenna_tx.set_high().map_err(|_| AntTx)?; + if let Some(antenna_tx) = &mut self.antenna_tx { + antenna_tx.set_low().map_err(|_| AntTx)?; + } + if let Some(antenna_rx) = &mut self.antenna_rx { + antenna_rx.set_high().map_err(|_| AntRx)?; + } Ok(()) } diff --git a/embassy-lora/src/sx126x/sx126x_lora/mod.rs b/embassy-lora/src/sx126x/sx126x_lora/mod.rs index 280f26d510..9ae9371dbe 100644 --- a/embassy-lora/src/sx126x/sx126x_lora/mod.rs +++ b/embassy-lora/src/sx126x/sx126x_lora/mod.rs @@ -30,8 +30,8 @@ pub struct LoRa { spi: SPI, cs: CTRL, reset: CTRL, - antenna_rx: CTRL, - antenna_tx: CTRL, + antenna_rx: Option, + antenna_tx: Option, dio1: WAIT, busy: WAIT, operating_mode: RadioMode, @@ -52,7 +52,15 @@ where WAIT: Wait, { /// Builds and returns a new instance of the radio. Only one instance of the radio should exist at a time () - pub fn new(spi: SPI, cs: CTRL, reset: CTRL, antenna_rx: CTRL, antenna_tx: CTRL, dio1: WAIT, busy: WAIT) -> Self { + pub fn new( + spi: SPI, + cs: CTRL, + reset: CTRL, + antenna_rx: Option, + antenna_tx: Option, + dio1: WAIT, + busy: WAIT, + ) -> Self { Self { spi, cs,