From 0fe4634af0777ffda92e3e9fc4ec4e093c06c8eb Mon Sep 17 00:00:00 2001 From: Mathias Koch Date: Tue, 29 Aug 2023 08:50:12 +0200 Subject: [PATCH] chore(*): add feature gates for module timing for lara-r6 & toby-r2 (#81) * Add feature gates for module timing for lara-r6 & toby-r2 * Bump embedded-hal to rc.1 --- ublox-cellular/Cargo.toml | 2 +- ublox-cellular/src/client.rs | 1 + ublox-cellular/src/module_timing.rs | 14 +++++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ublox-cellular/Cargo.toml b/ublox-cellular/Cargo.toml index ae16902..d202223 100644 --- a/ublox-cellular/Cargo.toml +++ b/ublox-cellular/Cargo.toml @@ -17,7 +17,7 @@ doctest = false [dependencies] # atat = { version = "0.18", features = ["derive", "bytes"] } atat = { git = "https://github.com/BlackbirdHQ/atat", rev = "70283be", features = ["derive", "defmt", "bytes"] } -embedded-hal = "=1.0.0-alpha.10" +embedded-hal = "=1.0.0-rc.1" embedded-nal = "0.6" fugit = { version = "0.3" } fugit-timer = { version = "0.1.3" } diff --git a/ublox-cellular/src/client.rs b/ublox-cellular/src/client.rs index 510e34f..d8c1177 100644 --- a/ublox-cellular/src/client.rs +++ b/ublox-cellular/src/client.rs @@ -280,6 +280,7 @@ where false, )?; + #[cfg(any(feature = "lara-r6"))] self.network.send_internal( &SetGpioConfiguration { gpio_id: 42, diff --git a/ublox-cellular/src/module_timing.rs b/ublox-cellular/src/module_timing.rs index 0a9dac9..5f2f7dc 100644 --- a/ublox-cellular/src/module_timing.rs +++ b/ublox-cellular/src/module_timing.rs @@ -7,6 +7,8 @@ use fugit::TimerDurationU32; pub fn pwr_on_time() -> TimerDurationU32 { if cfg!(feature = "lara-r6") { 150.millis() + } else if cfg!(feature = "toby-r2") { + 50.micros() } else { 50.micros() } @@ -16,6 +18,8 @@ pub fn pwr_on_time() -> TimerDurationU32 { pub fn pwr_off_time() -> TimerDurationU32 { if cfg!(feature = "lara-r6") { 1500.millis() + } else if cfg!(feature = "toby-r2") { + 1.secs() } else { 1.secs() } @@ -25,16 +29,20 @@ pub fn pwr_off_time() -> TimerDurationU32 { pub fn reset_time() -> TimerDurationU32 { if cfg!(feature = "lara-r6") { 10.millis() + } else if cfg!(feature = "toby-r2") { + 50.millis() } else { 50.millis() } } /// Low time of `RESET_N` pin to trigger module abrupt emergency switch off -pub fn kill_time() -> TimerDurationU32 { +/// +/// NOTE: Not all modules support this operation from `RESET_N` +pub fn kill_time() -> Option> { if cfg!(feature = "lara-r6") { - 10.secs() + Some(10.secs()) } else { - 10.secs() + None } }