diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-05-03 00:43:46 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-05-03 00:52:48 +0200 |
commit | 1a3f7879321a13aa9bd42a7058eb909340fa941d (patch) | |
tree | 4de2fff3998435d4cd9969b7639cd7c0a47b4c3b /embassy-nrf | |
parent | 29402fa76be8088b637c21dcaaa9c3b0a1ea9f99 (diff) | |
download | embassy-1a3f7879321a13aa9bd42a7058eb909340fa941d.zip |
nrf/twim: add option for high drive.
Diffstat (limited to 'embassy-nrf')
-rw-r--r-- | embassy-nrf/src/twim.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 9bee16f3..298441be 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs @@ -34,7 +34,9 @@ pub enum Frequency { #[non_exhaustive] pub struct Config { pub frequency: Frequency, + pub sda_high_drive: bool, pub sda_pullup: bool, + pub scl_high_drive: bool, pub scl_pullup: bool, } @@ -42,7 +44,9 @@ impl Default for Config { fn default() -> Self { Self { frequency: Frequency::K100, + scl_high_drive: false, sda_pullup: false, + sda_high_drive: false, scl_pullup: false, } } @@ -87,7 +91,11 @@ impl<'d, T: Instance> Twim<'d, T> { sda.conf().write(|w| { w.dir().input(); w.input().connect(); - w.drive().s0d1(); + if config.sda_high_drive { + w.drive().h0d1(); + } else { + w.drive().s0d1(); + } if config.sda_pullup { w.pull().pullup(); } @@ -96,7 +104,11 @@ impl<'d, T: Instance> Twim<'d, T> { scl.conf().write(|w| { w.dir().input(); w.input().connect(); - w.drive().s0d1(); + if config.scl_high_drive { + w.drive().h0d1(); + } else { + w.drive().s0d1(); + } if config.scl_pullup { w.pull().pullup(); } |