make modem main args generic

This commit is contained in:
Vladan Popovic 2023-02-10 11:41:39 +01:00
parent e7c51f2b61
commit 576bcfc590
1 changed files with 15 additions and 7 deletions

View File

@ -499,15 +499,23 @@ impl<UART: serial::Uart> std::io::Read for Modem<UART> {
} }
} }
pub fn main<T: Sync + Send>( pub fn main<PRx,PTx, DPK, DR, DP>
rx: esp_idf_hal::gpio::Gpio26<T>, (
tx: esp_idf_hal::gpio::Gpio27<T>, rx: PRx,
tx: PTx,
uart: serial::UART1, uart: serial::UART1,
pwrkey: esp_idf_hal::gpio::Gpio4<esp_idf_hal::gpio::Output>, pwrkey: DPK,
rst: esp_idf_hal::gpio::Gpio5<esp_idf_hal::gpio::Output>, rst: DR,
power: esp_idf_hal::gpio::Gpio23<esp_idf_hal::gpio::Output>, power: DP,
receiver: Receiver<Msg>, 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 { let serial_pins = serial::Pins {
tx, tx,
rx, rx,