make modem main args generic

This commit is contained in:
Vladan Popovic 2023-02-10 11:41:39 +01:00
parent e7c51f2b61
commit 576bcfc590

View file

@ -499,15 +499,23 @@ impl<UART: serial::Uart> std::io::Read for Modem<UART> {
}
}
pub fn main<T: Sync + Send>(
rx: esp_idf_hal::gpio::Gpio26<T>,
tx: esp_idf_hal::gpio::Gpio27<T>,
pub fn main<PRx,PTx, DPK, DR, DP>
(
rx: PRx,
tx: PTx,
uart: serial::UART1,
pwrkey: esp_idf_hal::gpio::Gpio4<esp_idf_hal::gpio::Output>,
rst: esp_idf_hal::gpio::Gpio5<esp_idf_hal::gpio::Output>,
power: esp_idf_hal::gpio::Gpio23<esp_idf_hal::gpio::Output>,
pwrkey: DPK,
rst: DR,
power: DP,
receiver: Receiver<Msg>,
) -> std::result::Result<(), anyhow::Error> {
) -> std::result::Result<(), anyhow::Error>
where
PRx: esp_idf_hal::gpio::Pin + esp_idf_hal::gpio::InputPin + esp_idf_hal::gpio::OutputPin,
PTx: esp_idf_hal::gpio::Pin + esp_idf_hal::gpio::InputPin + esp_idf_hal::gpio::OutputPin,
DPK: embedded_hal::digital::v2::OutputPin,
DR: embedded_hal::digital::v2::OutputPin,
DP: embedded_hal::digital::v2::OutputPin,
{
let serial_pins = serial::Pins {
tx,
rx,