#[cfg(feature = "fire27")]
mod imp {
use esp_hal::{
Blocking,
gpio::AnyPin,
peripherals::UART0,
uart::{Config, UartRx},
};
pub struct SerialCmdResources<'d> {
pub uart: UART0<'d>,
pub rx_pin: AnyPin<'d>,
}
pub type SerialRx<'d> = UartRx<'d, Blocking>;
pub fn take_rx(r: SerialCmdResources<'static>) -> SerialRx<'static> {
UartRx::new(r.uart, Config::default())
.expect("UART0 RX init")
.with_rx(r.rx_pin)
}
}
#[cfg(feature = "cores3")]
mod imp {
use esp_hal::{
Async,
peripherals::USB_DEVICE,
usb_serial_jtag::UsbSerialJtag,
};
pub struct SerialCmdResources<'d> {
pub usb: USB_DEVICE<'d>,
}
pub type SerialRx<'d> = UsbSerialJtag<'d, Async>;
pub fn take_rx(r: SerialCmdResources<'static>) -> SerialRx<'static> {
UsbSerialJtag::new(r.usb).into_async()
}
}
pub use imp::{SerialRx, SerialCmdResources, take_rx};