diff options
| author | erwin <[email protected]> | 2025-08-18 12:16:30 +0200 |
|---|---|---|
| committer | erwin <[email protected]> | 2025-08-18 14:39:18 +0200 |
| commit | bbc3e49c585a2bf58091add9aeac3628d9044297 (patch) | |
| tree | 300bd5a2e8236b5233760bd4e3d4c7ed0bdfe50d /examples/rp/src/bin | |
| parent | 39e75bb02f0c566b08ba75133c9e67c8d71b5b01 (diff) | |
Add configurable internal pullups for rp i2c
- Example updated to demonstrate enabling internal pullups
- Add `sda_pullup` and `scl_pullup` fields to I2C Config
Diffstat (limited to 'examples/rp/src/bin')
| -rw-r--r-- | examples/rp/src/bin/i2c_blocking.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/rp/src/bin/i2c_blocking.rs b/examples/rp/src/bin/i2c_blocking.rs index c9c8a2760..6a57ded20 100644 --- a/examples/rp/src/bin/i2c_blocking.rs +++ b/examples/rp/src/bin/i2c_blocking.rs | |||
| @@ -49,7 +49,11 @@ async fn main(_spawner: Spawner) { | |||
| 49 | let scl = p.PIN_15; | 49 | let scl = p.PIN_15; |
| 50 | 50 | ||
| 51 | info!("set up i2c "); | 51 | info!("set up i2c "); |
| 52 | let mut i2c = i2c::I2c::new_blocking(p.I2C1, scl, sda, Config::default()); | 52 | let mut config = Config::default(); |
| 53 | // by default internal pullup resitors are disabled | ||
| 54 | config.sda_pullup = true; | ||
| 55 | config.scl_pullup = true; | ||
| 56 | let mut i2c = i2c::I2c::new_blocking(p.I2C1, scl, sda, config); | ||
| 53 | 57 | ||
| 54 | use mcp23017::*; | 58 | use mcp23017::*; |
| 55 | 59 | ||
