Skip to content

Commit

Permalink
changed pin type
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkamprath committed Sep 29, 2024
1 parent 39227c5 commit 9845930
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use panic_probe as _;
use rp2040_hal::{
gpio::{
bank0::{Gpio0, Gpio2, Gpio3},
FunctionSpi, PullDown,
FunctionI2C, FunctionSpi, Pin, PullDown, PullUp,
},
pac::SPI0,
};
Expand Down Expand Up @@ -100,11 +100,14 @@ fn main() -> ! {
channel_a.output_to(pins.gpio8);
channel_b.output_to(pins.gpio9);

// Configure two pins as being I²C, not GPIO
let sda_pin: Pin<_, FunctionI2C, PullUp> = pins.gpio4.reconfigure();
let scl_pin: Pin<_, FunctionI2C, PullUp> = pins.gpio5.reconfigure();
// set up I2C
let i2c = bsp::hal::I2C::new_controller(
pac.I2C0,
pins.gpio4.into_function::<gpio::FunctionI2c>(),
pins.gpio5.into_function::<gpio::FunctionI2c>(),
sda_pin,
scl_pin,
HertzU32::from_raw(400_000),
&mut pac.RESETS,
clocks.system_clock.freq(),
Expand Down

0 comments on commit 9845930

Please sign in to comment.