sphinx-key: switch button gpio n from 8 to 9

the latest edition of sphinx-key hardware has the app button on gpio9
This commit is contained in:
irriden
2023-07-29 23:35:00 +00:00
parent b6064579ad
commit 34fac0bce5
3 changed files with 4 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ fn main() -> anyhow::Result<()> {
periph::led::led_control_loop(pins.gpio0, peripherals.rmt.channel0, led_rx);
// BUTTON thread
periph::button::button_loop(pins.gpio8, led_tx.clone());
periph::button::button_loop(pins.gpio9, led_tx.clone());
loop {
thread::sleep(Duration::from_millis(1000));

View File

@@ -44,7 +44,7 @@ fn main() -> Result<()> {
led_control_loop(pins.gpio0, peripherals.rmt.channel0, led_rx);
// BUTTON thread
// button_loop(pins.gpio8, led_tx.clone());
// button_loop(pins.gpio9, led_tx.clone());
// thread::sleep(Duration::from_secs(100));

View File

@@ -9,9 +9,9 @@ const MILLIS: u16 = 10_000;
const PAUSE: u16 = 50;
pub fn button_loop(gpio8: gpio::Gpio8, tx: mpsc::Sender<Status>) {
pub fn button_loop(gpio9: gpio::Gpio9, tx: mpsc::Sender<Status>) {
thread::spawn(move || {
let mut button = PinDriver::input(gpio8).unwrap();
let mut button = PinDriver::input(gpio9).unwrap();
button.set_pull(Pull::Up).unwrap();
let mut pressed = false;
let mut up_times = 0;