Skip to content

Commit 5323312

Browse files
added gnddetect feature
1 parent 46aaa54 commit 5323312

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ defmt-brtt = { version = "0.1.0", default-features = false }
3232
bbqueue = { version = "0.5", features = ["thumbv6"], optional = true }
3333

3434
[features]
35-
default = [ "defmt-brtt/rtt" ]
35+
default = [ "defmt-brtt/rtt", "gnddetect" ]
3636
defmt-bbq = ["defmt-brtt/bbq", "dep:bbqueue"]
37+
gnddetect = []
3738
usb-serial-reboot = []
3839

3940
# cargo build/run

src/setup.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ pub struct TargetPhysicallyConnected {
225225
impl TargetPhysicallyConnected {
226226
/// This checks for the target being connected via the GND detect pin.
227227
pub fn target_detected(&self) -> bool {
228-
matches!(self.pin.is_low(), Ok(true))
228+
#[cfg(feature = "gnddetect")]
229+
return matches!(self.pin.is_low(), Ok(true));
230+
#[cfg(not(feature = "gnddetect"))]
231+
return true;
229232
}
230233
}
231234

0 commit comments

Comments
 (0)