From ca4ea67e7b22ffc15b41a927a05fefa7cdbae17e Mon Sep 17 00:00:00 2001 From: rhetenor Date: Fri, 14 Aug 2026 20:36:18 +0000 Subject: [PATCH] update wokwi with buttons --- diagram.json | 117 +++++++++++++++++++++++++++++++++--------------- src/bin/main.rs | 10 ++--- 2 files changed, 86 insertions(+), 41 deletions(-) diff --git a/diagram.json b/diagram.json index 0e14a71..ba005e4 100644 --- a/diagram.json +++ b/diagram.json @@ -1,37 +1,82 @@ { - "version": 1, - "author": "CreatureDex", - "editor": "wokwi", - "parts": [ - { - "type": "board-esp32-s3-devkitc-1", - "id": "esp1", - "top": 67.2, - "left": -263.96, - "attrs": {} - }, - { "type": "wokwi-ili9341", "id": "lcd1", "top": -191.24, "left": -0.38, "attrs": {} }, - { - "type": "wokwi-pushbutton", - "id": "btn1", - "top": 131, - "left": -124.8, - "attrs": { "color": "green", "xray": "1", "key": "1" } - } - ], - "connections": [ - [ "esp1:TX", "$serialMonitor:RX", "", [] ], - [ "esp1:RX", "$serialMonitor:TX", "", [] ], - [ "lcd1:VCC", "esp1:3V3", "red", [ "v19.2", "h-57.6", "v-105.6", "h-124.95" ] ], - [ "lcd1:GND", "esp1:GND.2", "black", [ "v28.8", "h-76.8", "v-76.8" ] ], - [ "lcd1:CS", "esp1:11", "orange", [ "v0" ] ], - [ "lcd1:D/C", "esp1:12", "gold", [ "v0" ] ], - [ "lcd1:RESET", "esp1:10", "brown", [ "v0" ] ], - [ "lcd1:MOSI", "esp1:35", "violet", [ "v105.6", "h-124.8", "v-144" ] ], - [ "lcd1:SCK", "esp1:36", "white", [ "v115.2", "h-144", "v-86.4" ] ], - [ "esp1:37", "lcd1:MISO", "magenta", [ "h57.6", "v105.6", "h172.8" ] ], - [ "btn1:1.l", "esp1:GND.2", "green", [ "h-9.6", "v-48" ] ], - [ "btn1:2.l", "esp1:38", "green", [ "h-9.6", "v19.4" ] ] - ], - "dependencies": {} -} \ No newline at end of file +"version": 1, +"author": "CreatureDex", +"editor": "wokwi", +"parts": [ + { + "type": "board-esp32-s3-devkitc-1", + "id": "esp1", + "top": 67.2, + "left": -263.96, + "attrs": {} + }, + { "type": "wokwi-ili9341", "id": "lcd1", "top": -200.8, "left": 354.9, "attrs": {} }, + { + "type": "wokwi-pushbutton", + "id": "btn-up", + "top": -99.4, + "left": -76.8, + "attrs": { "color": "RebeccaPurple", "xray": "1", "key": "1", "label": "Up" } + }, + { + "type": "wokwi-pushbutton", + "id": "btn-down", + "top": 25.4, + "left": -76.8, + "attrs": { "color": "green", "xray": "1", "key": "1", "label": "Down" } + }, + { + "type": "wokwi-pushbutton", + "id": "btn-left", + "top": -32.2, + "left": -163.2, + "attrs": { "color": "yellow", "xray": "1", "key": "1", "label": "Left" } + }, + { + "type": "wokwi-pushbutton", + "id": "btn-right", + "top": -32.2, + "left": 19.2, + "attrs": { "color": "red", "xray": "1", "key": "1", "label": "Right" } + }, + { + "type": "wokwi-pushbutton", + "id": "btn-ok", + "top": -99.4, + "left": 115.2, + "attrs": { "color": "Magenta", "xray": "1", "key": "1", "label": "Ok" } + }, + { + "type": "wokwi-pushbutton", + "id": "btn-back", + "top": 25.4, + "left": 115.2, + "attrs": { "color": "Lime", "xray": "1", "key": "1", "label": "Back" } + } +], +"connections": [ + [ "esp1:TX", "$serialMonitor:RX", "", [] ], + [ "esp1:RX", "$serialMonitor:TX", "", [] ], + [ "lcd1:VCC", "esp1:3V3", "red", [ "v19.2", "h-57.6", "v-105.6", "h-124.95" ] ], + [ "lcd1:GND", "esp1:GND.2", "black", [ "v28.8", "h-76.8", "v-76.8" ] ], + [ "lcd1:CS", "esp1:11", "orange", [ "v0" ] ], + [ "lcd1:D/C", "esp1:12", "gold", [ "v0" ] ], + [ "lcd1:RESET", "esp1:10", "brown", [ "v0" ] ], + [ "lcd1:MOSI", "esp1:35", "violet", [ "v105.6", "h-124.8", "v-144" ] ], + [ "lcd1:SCK", "esp1:36", "white", [ "v115.2", "h-144", "v-86.4" ] ], + [ "esp1:37", "lcd1:MISO", "magenta", [ "h57.6", "v105.6", "h172.8" ] ], + [ "btn-up:2.l", "esp1:38", "purple", [ "h-9.6", "v19.4" ] ], + [ "btn-up:1.l", "esp1:GND.2", "black", [ "h0" ] ], + [ "btn-down:1.l", "esp1:GND.2", "black", [ "h0" ] ], + [ "btn-down:2.l", "esp1:39", "green", [ "h-19.2", "v115.4" ] ], + [ "btn-left:2.l", "esp1:40", "yellow", [ "h0", "v173" ] ], + [ "btn-left:1.l", "esp1:GND.2", "black", [ "h0" ] ], + [ "btn-right:2.l", "esp1:41", "red", [ "h-19.2", "v153.8" ] ], + [ "btn-right:1.l", "btn-left:1.r", "black", [ "h-96", "v28.8" ] ], + [ "btn-ok:2.l", "esp1:42", "Magenta", [ "h-19.2", "v211.58" ] ], + [ "btn-ok:1.l", "btn-up:1.r", "black", [ "h0" ] ], + [ "btn-back:1.l", "btn-down:1.r", "black", [ "h0" ] ], + [ "btn-back:2.l", "esp1:45", "Lime", [ "h-9.6", "v173" ] ] +], +"dependencies": {} +} diff --git a/src/bin/main.rs b/src/bin/main.rs index 57b6818..b18646d 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -94,11 +94,11 @@ async fn main(spawner: Spawner) { let button_config = InputConfig::default().with_pull(Pull::Up); let inputs = Inputs { up: Input::new(peripherals.GPIO38, button_config.clone()), - down: Input::new(peripherals.GPIO0, button_config.clone()), - left: Input::new(peripherals.GPIO1, button_config.clone()), - right: Input::new(peripherals.GPIO2, button_config.clone()), - back: Input::new(peripherals.GPIO3, button_config.clone()), - ok: Input::new(peripherals.GPIO4, button_config.clone()), + down: Input::new(peripherals.GPIO39, button_config.clone()), + left: Input::new(peripherals.GPIO40, button_config.clone()), + right: Input::new(peripherals.GPIO41, button_config.clone()), + back: Input::new(peripherals.GPIO42, button_config.clone()), + ok: Input::new(peripherals.GPIO45, button_config.clone()), }; spawner.spawn(navigation::run(inputs, display).expect("run task failed"));