mirror of
https://github.com/stakwork/sphinx-key.git
synced 2026-02-08 09:15:13 +01:00
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:
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user