Skip to content

Commit

Permalink
chore(*): add feature gates for module timing for lara-r6 & toby-r2 (#81
Browse files Browse the repository at this point in the history
)

* Add feature gates for module timing for lara-r6 & toby-r2

* Bump embedded-hal to rc.1
  • Loading branch information
MathiasKoch committed Aug 29, 2023
1 parent 68fc2fa commit 0fe4634
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ublox-cellular/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
1 change: 1 addition & 0 deletions ublox-cellular/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ where
false,
)?;

#[cfg(any(feature = "lara-r6"))]

Check warning on line 283 in ublox-cellular/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

unneeded sub `cfg` when there is only one condition

warning: unneeded sub `cfg` when there is only one condition --> ublox-cellular/src/client.rs:283:15 | 283 | #[cfg(any(feature = "lara-r6"))] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `feature = "lara-r6"` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_minimal_cfg = note: `#[warn(clippy::non_minimal_cfg)]` on by default
self.network.send_internal(
&SetGpioConfiguration {
gpio_id: 42,
Expand Down
14 changes: 11 additions & 3 deletions ublox-cellular/src/module_timing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use fugit::TimerDurationU32;
pub fn pwr_on_time<const TIMER_HZ: u32>() -> TimerDurationU32<TIMER_HZ> {
if cfg!(feature = "lara-r6") {
150.millis()
} else if cfg!(feature = "toby-r2") {
50.micros()
} else {
50.micros()
}
Expand All @@ -16,6 +18,8 @@ pub fn pwr_on_time<const TIMER_HZ: u32>() -> TimerDurationU32<TIMER_HZ> {
pub fn pwr_off_time<const TIMER_HZ: u32>() -> TimerDurationU32<TIMER_HZ> {
if cfg!(feature = "lara-r6") {
1500.millis()
} else if cfg!(feature = "toby-r2") {
1.secs()
} else {
1.secs()
}
Expand All @@ -25,16 +29,20 @@ pub fn pwr_off_time<const TIMER_HZ: u32>() -> TimerDurationU32<TIMER_HZ> {
pub fn reset_time<const TIMER_HZ: u32>() -> TimerDurationU32<TIMER_HZ> {
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<const TIMER_HZ: u32>() -> TimerDurationU32<TIMER_HZ> {
///
/// NOTE: Not all modules support this operation from `RESET_N`
pub fn kill_time<const TIMER_HZ: u32>() -> Option<TimerDurationU32<TIMER_HZ>> {

Check warning on line 42 in ublox-cellular/src/module_timing.rs

View workflow job for this annotation

GitHub Actions / clippy

function `kill_time` is never used

warning: function `kill_time` is never used --> ublox-cellular/src/module_timing.rs:42:8 | 42 | pub fn kill_time<const TIMER_HZ: u32>() -> Option<TimerDurationU32<TIMER_HZ>> { | ^^^^^^^^^

Check warning on line 42 in ublox-cellular/src/module_timing.rs

View workflow job for this annotation

GitHub Actions / Test

function `kill_time` is never used

Check warning on line 42 in ublox-cellular/src/module_timing.rs

View workflow job for this annotation

GitHub Actions / Test

function `kill_time` is never used
if cfg!(feature = "lara-r6") {
10.secs()
Some(10.secs())
} else {
10.secs()
None
}
}

0 comments on commit 0fe4634

Please sign in to comment.