From 6201fcaab132d5df90f7c2bf7871ad463d926c79 Mon Sep 17 00:00:00 2001 From: rhetenor Date: Sun, 26 Jul 2026 19:40:48 +0000 Subject: [PATCH 01/12] initial working version of ili9341 disp --- .cargo/config.toml | 15 + .clippy.toml | 1 + .gitignore | 26 + Cargo.lock | 1784 +++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 66 ++ build.rs | 70 ++ diagram.json | 44 ++ rust-toolchain.toml | 2 + src/bin/main.rs | 134 ++++ src/lib.rs | 1 + wokwi.toml | 5 + 11 files changed, 2148 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .clippy.toml create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 build.rs create mode 100644 diagram.json create mode 100644 rust-toolchain.toml create mode 100644 src/bin/main.rs create mode 100644 src/lib.rs create mode 100644 wokwi.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..e52ddf4 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,15 @@ +[target.xtensa-esp32s3-none-elf] +runner = "espflash flash --monitor --chip esp32s3" + +[env] +ESP_LOG="info" + +[build] +rustflags = [ + "-C", "link-arg=-nostartfiles", +] + +target = "xtensa-esp32s3-none-elf" + +[unstable] +build-std = ["alloc", "core"] diff --git a/.clippy.toml b/.clippy.toml new file mode 100644 index 0000000..76f6c1d --- /dev/null +++ b/.clippy.toml @@ -0,0 +1 @@ +stack-size-threshold = 1024 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..deb0257 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# will have compiled files and executables +debug/ +target/ + +# Editor configuration +.vscode/ +.zed/ +.helix/ +.nvim.lua + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# RustRover +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + + +# Ignore .DS_Store file in mac +**/.DS_Store diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..26a4bd6 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1784 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "allocator-api2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c583acf993cf4245c4acb0a2cc2ab1f9cc097de73411bb6d3647ff6af2b1013d" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "bitfield" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45721c9db4c7a20899d05efb7ad9235f50b256e980db30ffb229abf732934c3" +dependencies = [ + "bitfield-macros", +] + +[[package]] +name = "bitfield-macros" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0cb6f3d4773a2107b94cbeccaa5b5f0b35a88389b5d522d13d659f64317b22d" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byte-slice-cast" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "const-default" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" + +[[package]] +name = "creaturedex" +version = "0.1.0" +dependencies = [ + "critical-section", + "display-interface-spi", + "embedded-graphics", + "embedded-graphics-core", + "embedded-hal 1.0.0", + "embedded-hal-bus", + "embedded-io 0.7.1", + "esp-alloc", + "esp-bootloader-esp-idf", + "esp-hal", + "esp-println", + "esp-radio", + "esp-rtos", + "ili9341", + "log", + "smoltcp", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" +dependencies = [ + "darling_core 0.23.0", + "darling_macro 0.23.0", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_core" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core 0.21.3", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +dependencies = [ + "darling_core 0.23.0", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "defmt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2953bfe4f93bbd20cc71198842756f77d161884c99ebbabc41d80231ded88d1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad9c72e7ca2137e0dc3813245a0d282fd6daad32fd800af018306a9169b5fe8" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "defmt-parser" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" +dependencies = [ + "thiserror", +] + +[[package]] +name = "delegate" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780eb241654bf097afb00fc5f054a09b687dad862e485fdcf8399bb056565370" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "display-interface" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba2aab1ef3793e6f7804162debb5ac5edb93b3d650fbcc5aeb72fcd0e6c03a0" + +[[package]] +name = "display-interface-spi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b9ec30048b1955da2038fcc3c017f419ab21bb0001879d16c0a3749dc6b7a" +dependencies = [ + "byte-slice-cast", + "display-interface", + "embedded-hal 1.0.0", + "embedded-hal-async", +] + +[[package]] +name = "docsplay" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8547ea80db62c5bb9d7796fcce5e6e07d1136bdc1a02269095061e806758fab4" +dependencies = [ + "docsplay-macros", +] + +[[package]] +name = "docsplay-macros" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11772ed3eb3db124d826f3abeadf5a791a557f62c19b123e3f07288158a71fdd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "embassy-embedded-hal" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0641612053b2f34fc250bb63f6630ae75de46e02ade7f457268447081d709ce" +dependencies = [ + "embassy-futures", + "embassy-hal-internal", + "embassy-sync 0.8.0", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +] + +[[package]] +name = "embassy-futures" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" + +[[package]] +name = "embassy-hal-internal" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f10ce10a4dfdf6402d8e9bd63128986b96a736b1a0a6680547ed2ac55d55dba" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-net-driver" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" + +[[package]] +name = "embassy-sync" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async 0.6.1", + "futures-sink", + "futures-util", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-sync" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async 0.6.1", + "futures-core", + "futures-sink", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-sync" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bbd85cf5a5ae56bdf26f618364af642d1d0a4e245cdd75cd9aabda382f65a81" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async 0.7.0", + "futures-core", + "futures-sink", + "heapless 0.9.3", +] + +[[package]] +name = "embassy-time" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "592b0c143ec626e821d4d90da51a2bd91d559d6c442b7c74a47d368c9e23d97a" +dependencies = [ + "cfg-if", + "critical-section", + "document-features", + "embassy-time-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "futures-core", +] + +[[package]] +name = "embassy-time-driver" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee71af1b3a0deaa53eaf2d39252f83504c853646e472400b763060389b9fcc9" +dependencies = [ + "document-features", +] + +[[package]] +name = "embassy-usb-driver" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa675c5f4349b6aa0fcffc4bf9b241f18cd11b97c1f8323273fb9a5449937fbd" +dependencies = [ + "embedded-io-async 0.6.1", + "embedded-io-async 0.7.0", +] + +[[package]] +name = "embassy-usb-synopsys-otg" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb205e26d59e483e8c48f91f637ec217ec7e2cfb0b61d50482301b991b4ff431" +dependencies = [ + "critical-section", + "embassy-sync 0.8.0", + "embassy-time", + "embassy-usb-driver", + "portable-atomic", +] + +[[package]] +name = "embedded-can" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "embedded-graphics" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e8da660bb0c829b34a56a965490597f82a55e767b91f9543be80ce8ccb416fe" +dependencies = [ + "az", + "byteorder", + "embedded-graphics-core", + "float-cmp", + "micromath", +] + +[[package]] +name = "embedded-graphics-core" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95743bef3ff70fcba3930246c4e6872882bbea0dcc6da2ca860112e0cd4bd09f" +dependencies = [ + "az", + "byteorder", +] + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-hal-async" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" +dependencies = [ + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-hal-bus" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513e0b3a8fb7d3013a8ae17a834283f170deaf7d0eeab0a7c1a36ad4dd356d22" +dependencies = [ + "critical-section", + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "embedded-io" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb1aa714776b75c7e67e1da744b81a129b3ff919c8712b5e1b32252c1f07cc7" + +[[package]] +name = "embedded-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" +dependencies = [ + "embedded-io 0.6.1", +] + +[[package]] +name = "embedded-io-async" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2564b9f813c544241430e147d8bc454815ef9ac998878d30cc3055449f7fd4c0" +dependencies = [ + "embedded-io 0.7.1", +] + +[[package]] +name = "embedded-storage" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" + +[[package]] +name = "embedded-storage-async" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" +dependencies = [ + "embedded-storage", +] + +[[package]] +name = "enumset" +version = "1.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccc5801fd11762e24d1e420d01d2ac518f2a2ca4329d4fbb6639f2412b6204e0" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd536557b58c682b217b8fb199afdff47cd3eff260623f19e77074eb073d63a" +dependencies = [ + "darling 0.21.3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "esp-alloc" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46ced060d4085858283df950b80a4da2348e1707d7d07b1e966308582dae79f5" +dependencies = [ + "allocator-api2", + "cfg-if", + "document-features", + "enumset", + "esp-config", + "esp-sync", + "linked_list_allocator", + "rlsf", +] + +[[package]] +name = "esp-bootloader-esp-idf" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ffc117c3a9859835d89d0e90f5ee9886ce2264a71a849a7a22ab5308f6653c" +dependencies = [ + "cfg-if", + "document-features", + "embedded-storage", + "esp-config", + "esp-hal-procmacros", + "esp-metadata-generated", + "esp-rom-sys", + "jiff", + "log", + "strum", +] + +[[package]] +name = "esp-config" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d9b92fd9cfb0b4f8f1b6219b9763269a335571e307b014903b8201619374b80" +dependencies = [ + "document-features", + "esp-metadata-generated", + "serde", + "serde_yaml", + "somni-expr", +] + +[[package]] +name = "esp-hal" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfcf2a0842903717f4663f6a08512c32b0f6b2d7fb7db3c8a6895d2e6d49f72" +dependencies = [ + "bitfield", + "bitflags 2.13.1", + "bytemuck", + "cfg-if", + "critical-section", + "delegate", + "digest", + "document-features", + "embassy-embedded-hal", + "embassy-futures", + "embassy-sync 0.8.0", + "embassy-usb-driver", + "embassy-usb-synopsys-otg", + "embedded-can", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-io 0.6.1", + "embedded-io 0.7.1", + "embedded-io-async 0.6.1", + "embedded-io-async 0.7.0", + "enumset", + "esp-config", + "esp-hal-procmacros", + "esp-metadata-generated", + "esp-riscv-rt", + "esp-rom-sys", + "esp-sync", + "esp-synopsys-usb-otg", + "esp32", + "esp32c2", + "esp32c3", + "esp32c6", + "esp32h2", + "esp32s2", + "esp32s3", + "fugit", + "instability", + "log", + "nb 1.1.0", + "paste", + "portable-atomic", + "rand_core 0.10.1", + "rand_core 0.6.4", + "rand_core 0.9.5", + "riscv", + "strum", + "ufmt-write", + "xtensa-lx", + "xtensa-lx-rt", +] + +[[package]] +name = "esp-hal-procmacros" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aebfabb2c21bec45e575e4f6cb6bb7aa8e1b33e7ac45b5dffa0f9d33ff59105" +dependencies = [ + "document-features", + "object", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", + "termcolor", +] + +[[package]] +name = "esp-metadata-generated" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42c2ee95b945a4780796e4359e72c033aed3b45073880e8029458f538532db8a" + +[[package]] +name = "esp-phy" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c0a29815cd105ae1a02f3d0c6e7aafda9504a41effae17fac4c3f827719228" +dependencies = [ + "cfg-if", + "document-features", + "embassy-sync 0.8.0", + "esp-config", + "esp-hal", + "esp-metadata-generated", + "esp-sync", + "esp-wifi-sys-esp32s3", + "esp32s3", + "log", +] + +[[package]] +name = "esp-println" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42dee1e9ac7c3539bf6464db1707b0edd7557168f98278cf3c84fe70e63c6ce6" +dependencies = [ + "document-features", + "esp-metadata-generated", + "esp-sync", + "log", + "portable-atomic", +] + +[[package]] +name = "esp-radio" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fbff98b06a96b6ce3791ecec5c668524052a068e23aacd23afe17ddba844ce" +dependencies = [ + "allocator-api2", + "cfg-if", + "docsplay", + "document-features", + "embassy-net-driver", + "embassy-sync 0.8.0", + "embedded-io 0.6.1", + "embedded-io 0.7.1", + "embedded-io-async 0.6.1", + "embedded-io-async 0.7.0", + "enumset", + "esp-alloc", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata-generated", + "esp-phy", + "esp-radio-rtos-driver", + "esp-sync", + "esp-wifi-sys-esp32", + "esp-wifi-sys-esp32c2", + "esp-wifi-sys-esp32c3", + "esp-wifi-sys-esp32c6", + "esp-wifi-sys-esp32h2", + "esp-wifi-sys-esp32s2", + "esp-wifi-sys-esp32s3", + "esp32s3", + "heapless 0.9.3", + "instability", + "log", + "num-derive", + "num-traits", + "portable-atomic", + "portable_atomic_enum", + "xtensa-lx-rt", +] + +[[package]] +name = "esp-radio-rtos-driver" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bd75cd9073a90ffaa53db0bf17df7dc14164f2407a6ff36c725d2d1f78ff494" +dependencies = [ + "cfg-if", + "esp-sync", + "portable-atomic", +] + +[[package]] +name = "esp-riscv-rt" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66a814ae91452de56a5e74f69aebfee40579511756837d3774a56fd24cf0ab79" +dependencies = [ + "document-features", + "riscv", + "riscv-rt", +] + +[[package]] +name = "esp-rom-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae852ccb08971155023d1371c96d5490cbc26860f06aee2d629ef73f1a890c3" +dependencies = [ + "cfg-if", + "document-features", + "esp-metadata-generated", + "esp32s3", +] + +[[package]] +name = "esp-rtos" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "551f90766e1527edaa0c91e8d559e9e2a60397b545e93357ac61fb31845e5712" +dependencies = [ + "allocator-api2", + "cfg-if", + "document-features", + "embassy-sync 0.8.0", + "esp-alloc", + "esp-config", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata-generated", + "esp-radio-rtos-driver", + "esp-rom-sys", + "esp-sync", + "log", + "portable-atomic", + "riscv", + "xtensa-lx", +] + +[[package]] +name = "esp-sync" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4736bfbbb9e3f6353344e14fc61b6d18d3b877c3286914cf8c0a037be0ed224" +dependencies = [ + "cfg-if", + "document-features", + "embassy-sync 0.6.2", + "embassy-sync 0.7.2", + "embassy-sync 0.8.0", + "esp-metadata-generated", + "riscv", + "xtensa-lx", +] + +[[package]] +name = "esp-synopsys-usb-otg" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8938451cb19032f13365328ea66ab38c8d16deecdf322067442297110eb74468" +dependencies = [ + "critical-section", + "embedded-hal 0.2.7", + "ral-registers", + "usb-device", + "vcell", +] + +[[package]] +name = "esp-wifi-sys-esp32" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2556f38f5292d9735d4e156e276815fc001c9a0a2be0544a575c5fb867129d24" +dependencies = [ + "log", +] + +[[package]] +name = "esp-wifi-sys-esp32c2" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b3eb3435dae84de611d4384639e61eed862818223e93fa70c525cb6a70127f" +dependencies = [ + "log", +] + +[[package]] +name = "esp-wifi-sys-esp32c3" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b290846b53db9a3965866964260220b67f2c41cc2dbc0b377e7136239fe168a7" +dependencies = [ + "log", +] + +[[package]] +name = "esp-wifi-sys-esp32c6" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57649401fc2f906a16e2268de88693724a125adcd0eba89b594a157affcee2d5" +dependencies = [ + "log", +] + +[[package]] +name = "esp-wifi-sys-esp32h2" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cf1be2e311f4b4e75b5507c6b007ffc3fcb8c6cb57f83cc6a9569ecdcf58484" +dependencies = [ + "log", +] + +[[package]] +name = "esp-wifi-sys-esp32s2" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a9a7f1bc51e7026c3012cda4f11d8799e5e0c0bb3be85797462219def6c26e" +dependencies = [ + "log", +] + +[[package]] +name = "esp-wifi-sys-esp32s3" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8321f44b57d8112cbd8607cc83b85783b9195289acb45532728e3e229e7786" +dependencies = [ + "log", +] + +[[package]] +name = "esp32" +version = "0.40.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5726e07689249d1a2cb7c492077bc424837fb68a64f7eb5d46569325352e9428" +dependencies = [ + "vcell", +] + +[[package]] +name = "esp32c2" +version = "0.29.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef0b623533bbaa37e348c18b6b41cfd5b47c3cb64a4b9e44f0295941d62aa2e" +dependencies = [ + "vcell", +] + +[[package]] +name = "esp32c3" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e89ed62cf6c043a6d29c520b02a13b359ec8a75d67b65d4330ed717d15fe97" +dependencies = [ + "vcell", +] + +[[package]] +name = "esp32c6" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c58f34ff2633968c12125efc7f4f8f101078d5d34c7cb60eab82268db20986f9" +dependencies = [ + "vcell", +] + +[[package]] +name = "esp32h2" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5bab026020ed4606ce113b6fde598dbc48f7eefcc46e9469ece77cc2b1aa4be" +dependencies = [ + "vcell", +] + +[[package]] +name = "esp32s2" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0ad6f21cdf6ec7b06b7f7e0fbe51f0d975fd6a5fa67c3f8a5a910d3981af531" +dependencies = [ + "vcell", +] + +[[package]] +name = "esp32s3" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b4b8c4e4d9f187553ecdb7173edec7b2deb2beea106eedefecdb1654b8ee25a" +dependencies = [ + "vcell", +] + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fugit" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e639847d312d9a82d2e75b0edcc1e934efcc64e6cb7aa94f0b1fbec0bc231d6" +dependencies = [ + "gcd", +] + +[[package]] +name = "futures-core" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7" + +[[package]] +name = "futures-sink" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e34418ac499d6305c2fb5ad0ed2f6ac998c5f8ca209b4510f7f94242c647e307" + +[[package]] +name = "futures-task" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109" + +[[package]] +name = "futures-util" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", +] + +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heapless" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ba4bd83f9415b58b4ed8dc5714c76e626a105be4646c02630ad730ad3b5aa4" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "ili9341" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc105605dba076630f5a1a22ba80bcff216af2619859f1595e9ddd72b89db30a" +dependencies = [ + "display-interface", + "embedded-graphics-core", + "embedded-hal 1.0.0", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "indoc" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] + +[[package]] +name = "instability" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb2d60ef19920a3a9193c3e371f726ec1dafc045dac788d0fb3704272458971" +dependencies = [ + "darling 0.23.0", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668b7183bd07af9a4885f5c35b0cc5c83c4607a913c16b7e17291832910d2dcc" +dependencies = [ + "defmt", + "jiff-core", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7feca88439efe53da3754500c1851dedf3cb36c524dd5cf8225cc0794de95d09" +dependencies = [ + "defmt", +] + +[[package]] +name = "jiff-static" +version = "0.2.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a69dcb3a21cfb32ce1cd056169337ca284af0766dd766e7878819b251a49204" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "linked_list_allocator" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b23ac50abb8261cb38c6e2a7192d3302e0836dac1628f6a93b82b4fad185897" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "log" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "micromath" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815" + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "portable-atomic" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3" + +[[package]] +name = "portable-atomic-util" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "portable_atomic_enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d48f60c43e0120bb2bb48589a16d4bed2f4b911be41e299f2d0fc0e0e20885" +dependencies = [ + "portable-atomic", + "portable_atomic_enum_macros", +] + +[[package]] +name = "portable_atomic_enum_macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33fa6ec7f2047f572d49317cca19c87195de99c6e5b6ee492da701cfe02b053" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ral-registers" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46b71a9d9206e8b46714c74255adcaea8b11e0350c1d8456165073c3f75fc81a" + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "riscv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05cfa3f7b30c84536a9025150d44d26b8e1cc20ddf436448d74cd9591eefb25" +dependencies = [ + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d323d13972c1b104aa036bc692cd08b822c8bbf23d79a27c526095856499799" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d07b9f3a0eff773fc4df11f44ada4fa302e529bff4b7fe7e6a4b98a65ce9174" +dependencies = [ + "riscv", + "riscv-pac", + "riscv-rt-macros", + "riscv-target-parser", +] + +[[package]] +name = "riscv-rt-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def519ddeeb5e43c2b4fc3952c27b3a86782fc05192f322b2309125cd85b1fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "riscv-target-parser" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1376b15f3ff160e9b1e8ea564ce427f2f6fcf77528cc0a8bf405cb476f9cea7" + +[[package]] +name = "rlsf" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1646a59a9734b8b7a0ac51689388a60fe1625d4b956348e9de07591a1478457a" +dependencies = [ + "cfg-if", + "const-default", + "libc", + "rustversion", + "svgbobdoc", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "smoltcp" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f73d40463bba65efc9adc6370b56df76d563cc46e2482bba58351b4afb7535e" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "cfg-if", + "heapless 0.9.3", + "log", + "managed", +] + +[[package]] +name = "somni-expr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed9b7648d5e8b2df6c5e49940c54bcdd2b4dd71eafc6e8f1c714eb4581b0f53" +dependencies = [ + "somni-parser", +] + +[[package]] +name = "somni-parser" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0f368519fc6c85fc1afdb769fb5a51123f6158013e143656e25a3485a0d401c" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "svgbobdoc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50" +dependencies = [ + "base64", + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-width", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "2.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.13+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6975367e4d2ef766d86af01ffad14b622fecc8d4357a998fbc4deb6e9bacaf9b" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ufmt-write" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "usb-device" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" +dependencies = [ + "heapless 0.8.0", + "portable-atomic", +] + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "xtensa-lx" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e012d667b0aa6d2592ace8ef145a98bff3e76cca7a644f4181ecd7a916ed289b" +dependencies = [ + "critical-section", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "409a9b4629d429e995cde4dfbd9fe562ccae66f7624514e200733fc5d0ea8905" +dependencies = [ + "document-features", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fb42cd29c42f8744c74276e9f5bee7b06685bbe5b88df891516d72cb320450" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..885e6d8 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,66 @@ +[package] +edition = "2024" +name = "creaturedex" +rust-version = "1.88" +version = "0.1.0" + +[[bin]] +name = "creaturedex" +path = "./src/bin/main.rs" + +[dependencies] +esp-hal = { version = "~1.1.0", features = ["esp32s3", "log-04", "unstable"] } + +esp-rtos = { version = "0.3.0", features = [ + "esp-alloc", + "esp-radio", + "esp32s3", + "log-04", +] } + +esp-bootloader-esp-idf = { version = "0.5.0", features = ["esp32s3", "log-04"] } +log = "0.4.27" + +critical-section = "1.2.0" +embedded-io = "0.7.1" +esp-alloc = "0.10.0" +esp-println = { version = "0.17.0", features = ["esp32s3", "log-04"] } +esp-radio = { version = "0.18.0", features = [ + "esp-alloc", + "esp32s3", + "log-04", + "unstable", + "wifi", +] } +smoltcp = { version = "0.13.0", default-features = false, features = [ + "log", + "medium-ethernet", + "multicast", + "proto-dhcpv4", + "proto-dns", + "proto-ipv4", + "socket-dns", + "socket-icmp", + "socket-raw", + "socket-tcp", + "socket-udp", +] } +display-interface-spi = "0.5.0" +ili9341 = "0.6.0" +embedded-hal = "1.0.0" +embedded-hal-bus = "0.3.0" +embedded-graphics = "0.8.2" +embedded-graphics-core = "0.4.1" + + +# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html +[profile.dev] +# The default debug profile is too slow and too big for resource-constrained devices. +# Always build with some optimizations enabled. +opt-level = "s" + +[profile.release] +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 # prefer slower builds but better debugging experience +lto = 'fat' +opt-level = 's' diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..2b6a670 --- /dev/null +++ b/build.rs @@ -0,0 +1,70 @@ +fn main() { + linker_be_nice(); + // make sure linkall.x is the last linker script (otherwise might cause problems with flip-link) + println!("cargo:rustc-link-arg=-Tlinkall.x"); +} + +fn linker_be_nice() { + let args: Vec = std::env::args().collect(); + if args.len() > 1 { + let kind = &args[1]; + let what = &args[2]; + + match kind.as_str() { + "undefined-symbol" => match what.as_str() { + what if what.starts_with("_defmt_") => { + eprintln!(); + eprintln!( + "💡 `defmt` not found - make sure `defmt.x` is added as a linker script and you have included `use defmt_rtt as _;`" + ); + eprintln!(); + } + "_stack_start" => { + eprintln!(); + eprintln!("💡 Is the linker script `linkall.x` missing?"); + eprintln!(); + } + what if what.starts_with("esp_rtos_") => { + eprintln!(); + eprintln!( + "💡 `esp-radio` has no scheduler enabled. Make sure you have initialized `esp-rtos` or provided an external scheduler." + ); + eprintln!(); + } + "embedded_test_linker_file_not_added_to_rustflags" => { + eprintln!(); + eprintln!( + "💡 `embedded-test` not found - make sure `embedded-test.x` is added as a linker script for tests" + ); + eprintln!(); + } + "free" + | "malloc" + | "calloc" + | "get_free_internal_heap_size" + | "malloc_internal" + | "realloc_internal" + | "calloc_internal" + | "free_internal" => { + eprintln!(); + eprintln!( + "💡 Did you forget the `esp-alloc` dependency or didn't enable the `compat` feature on it?" + ); + eprintln!(); + } + _ => (), + }, + // we don't have anything helpful for "missing-lib" yet + _ => { + std::process::exit(1); + } + } + + std::process::exit(0); + } + + println!( + "cargo:rustc-link-arg=-Wl,--error-handling-script={}", + std::env::current_exe().unwrap().display() + ); +} diff --git a/diagram.json b/diagram.json new file mode 100644 index 0000000..150444d --- /dev/null +++ b/diagram.json @@ -0,0 +1,44 @@ +{ + "version": 1, + "editor": "wokwi", + "parts": [ + { "type": "board-esp32-s3-devkitc-1", "id": "esp1", "top": 67.2, "left": -263.96, "attrs": {} }, + { + "type": "board-ili9341-cap-touch", + "id": "lcd1", + "top": -191.24, + "left": -0.38, + "attrs": {} + }, + { + "type": "wokwi-led", + "id": "led1", + "top": -82.89, + "left": 196.26, + "attrs": { "color": "red" } + }, + { + "type": "wokwi-resistor", + "id": "r1", + "top": 183.86, + "left": 154.06, + "attrs": { "value": "220" } + } + ], + "connections": [ + [ "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" ] ], + [ "esp1:22", "lcd1:SCL", "yellow", [ "h48", "v163.2", "h192" ] ], + [ "esp1:21", "lcd1:SDA", "cyan", [ "h38.4", "v144", "h211.2" ] ], + [ "r1:2", "led1:A", "green", [ "h8.4", "v-230.4" ] ], + [ "esp1:GND.2", "led1:C", "black", [ "v0", "h86.4", "v76.8", "h278.4" ] ], + [ "esp1:17", "r1:1", "green", [ "h0" ] ] +], + "dependencies": {} +} diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..a2f5ab5 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "esp" diff --git a/src/bin/main.rs b/src/bin/main.rs new file mode 100644 index 0000000..6b07d41 --- /dev/null +++ b/src/bin/main.rs @@ -0,0 +1,134 @@ +#![no_std] +#![no_main] +#![deny( + clippy::mem_forget, + reason = "mem::forget is generally not safe to do with esp_hal types, especially those \ + holding buffers for the duration of a data transfer." +)] +#![deny(clippy::large_stack_frames)] + +use display_interface_spi::SPIInterface; +use embedded_graphics::Drawable; +use embedded_graphics::mono_font::MonoTextStyle; +use embedded_graphics::mono_font::ascii::FONT_6X10; +use embedded_graphics::pixelcolor::Rgb565; +use embedded_graphics::prelude::Point; +use embedded_graphics::prelude::RgbColor; +use embedded_graphics::text::Text; +use embedded_graphics_core::draw_target::DrawTarget; +use embedded_hal_bus::spi::ExclusiveDevice; +use esp_hal::clock::CpuClock; +use esp_hal::delay::Delay; +use esp_hal::gpio::Level; +use esp_hal::gpio::Output; +use esp_hal::gpio::OutputConfig; +use esp_hal::main; +use esp_hal::spi::{ + Mode, + master::{Config, Spi}, +}; +use esp_hal::time::Rate; +use esp_hal::time::{Duration, Instant}; +use esp_hal::timer::timg::TimerGroup; +use ili9341::Ili9341; +use ili9341::Orientation; +use log::{error, info}; + +#[panic_handler] +fn panic(panic_info: &core::panic::PanicInfo) -> ! { + error!("{}", panic_info); + loop {} +} + +extern crate alloc; + +// This creates a default app-descriptor required by the esp-idf bootloader. +// For more information see: +esp_bootloader_esp_idf::esp_app_desc!(); + +#[allow( + clippy::large_stack_frames, + reason = "it's not unusual to allocate larger buffers etc. in main" +)] +#[main] +fn main() -> ! { + // generator version: 1.3.0 + // generator parameters: --chip esp32s3 -o esp32s3-wroom-1-octal-psram -o unstable-hal -o alloc -o wifi -o log -o wokwi -o neovim -o vscode -o esp + + esp_println::logger::init_logger_from_env(); + + let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max()); + let peripherals = esp_hal::init(config); + + // The following pins are used to bootstrap the chip. They are available + // for use, but check the datasheet of the module for more information on them. + // - GPIO0 + // - GPIO3 + // - GPIO45 + // - GPIO46 + // These GPIO pins are in use by some feature of the module and should not be used. + let _ = peripherals.GPIO27; + let _ = peripherals.GPIO28; + let _ = peripherals.GPIO29; + let _ = peripherals.GPIO30; + let _ = peripherals.GPIO31; + let _ = peripherals.GPIO32; + let _ = peripherals.GPIO33; + let _ = peripherals.GPIO34; + let _ = peripherals.GPIO35; + let _ = peripherals.GPIO36; + let _ = peripherals.GPIO37; + + esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 73744); + + let timg0 = TimerGroup::new(peripherals.TIMG0); + let sw_interrupt = + esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); + esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0); + let (mut _wifi_controller, _interfaces) = + esp_radio::wifi::new(peripherals.WIFI, Default::default()) + .expect("Failed to initialize Wi-Fi controller"); + + let spi_bus = Spi::new( + peripherals.SPI2, + Config::default() + .with_frequency(Rate::from_khz(100)) + .with_mode(Mode::_0), + ) + .unwrap() + .with_sck(peripherals.GPIO36) + .with_mosi(peripherals.GPIO35) + .with_miso(peripherals.GPIO37); + + let cs_main = Output::new(peripherals.GPIO11, Level::High, OutputConfig::default()); + + let mut delay = Delay::new(); + let spi_dev = ExclusiveDevice::new(spi_bus, cs_main, delay).unwrap(); + let reset_main = Output::new(peripherals.GPIO10, Level::High, OutputConfig::default()); + let spi_dc = Output::new(peripherals.GPIO12, Level::High, OutputConfig::default()); + let iface = SPIInterface::new(spi_dev, spi_dc); + + let mut display = Ili9341::new( + iface, + reset_main, + &mut delay, + Orientation::Landscape, + ili9341::DisplaySize240x320, + ) + .unwrap(); + + display.clear(Rgb565::BLACK).unwrap(); + + let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE); + Text::new("Hello, ESP32!", Point::new(20, 100), style) + .draw(&mut display) + .unwrap(); + + loop { + info!("Hello world!"); + let delay_start = Instant::now(); + while delay_start.elapsed() < Duration::from_millis(500) {} + } + + // for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..0c9ac1a --- /dev/null +++ b/src/lib.rs @@ -0,0 +1 @@ +#![no_std] diff --git a/wokwi.toml b/wokwi.toml new file mode 100644 index 0000000..4445166 --- /dev/null +++ b/wokwi.toml @@ -0,0 +1,5 @@ +[wokwi] +version = 1 +gdbServerPort = 3333 +elf = "target/xtensa-esp32s3-none-elf/debug/creaturedex" +firmware = "target/xtensa-esp32s3-none-elf/debug/creaturedex" -- 2.39.5 From 95a0c0fe63116051118d19b2e1a6c2eb716093ee Mon Sep 17 00:00:00 2001 From: lukas Date: Mon, 27 Jul 2026 19:10:53 +0200 Subject: [PATCH 02/12] Support for wifi, including Wokwi simulated wifi --- .cargo/config.toml | 1 + Cargo.lock | 1991 ++++++++++++++++++++++++++++++++++++++++++-- Cargo.toml | 29 +- diagram.json | 3 + src/bin/main.rs | 102 ++- 5 files changed, 2021 insertions(+), 105 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index e52ddf4..a1297d5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,6 +3,7 @@ runner = "espflash flash --monitor --chip esp32s3" [env] ESP_LOG="info" +WM_CONN = '{"ssid": "Wokwi-GUEST", "psk": "", "data": {}}' [build] rustflags = [ diff --git a/Cargo.lock b/Cargo.lock index 26a4bd6..e99a9fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,51 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "getrandom 0.3.4", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "allocator-api2" version = "0.3.1" @@ -26,6 +71,25 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64-simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" +dependencies = [ + "simd-abstraction", +] + +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref 0.5.2", + "vsimd", +] + [[package]] name = "bitfield" version = "0.19.5" @@ -58,6 +122,18 @@ version = "2.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" +[[package]] +name = "bitvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -67,12 +143,43 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bumpalo" +version = "3.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +dependencies = [ + "allocator-api2 0.2.21", +] + [[package]] name = "byte-slice-cast" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" +[[package]] +name = "bytecheck" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "bytemuck" version = "1.25.2" @@ -85,24 +192,114 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + +[[package]] +name = "cc" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9" +dependencies = [ + "find-msvc-tools", + "shlex", +] + [[package]] name = "cfg-if" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror", +] + +[[package]] +name = "compact_str" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + [[package]] name = "const-default" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" +[[package]] +name = "const-str" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18f12cc9948ed9604230cdddc7c86e270f9401ccbe3c2e98a4378c5e7632212f" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "cordyceps" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688d7fbb8092b8de775ef2536f36c8c31f2bc4006ece2e8d8ad2d17d00ce0a2a" +dependencies = [ + "loom", + "tracing", +] + +[[package]] +name = "cow-utils" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417bef24afe1460300965a25ff4a24b8b45ad011948302ec221e8a0a81eb2c79" + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + [[package]] name = "creaturedex" version = "0.1.0" dependencies = [ "critical-section", "display-interface-spi", + "embassy-executor", + "embassy-time", "embedded-graphics", "embedded-graphics-core", "embedded-hal 1.0.0", @@ -111,12 +308,11 @@ dependencies = [ "esp-alloc", "esp-bootloader-esp-idf", "esp-hal", + "esp-hal-wifimanager", "esp-println", - "esp-radio", "esp-rtos", "ili9341", "log", - "smoltcp", ] [[package]] @@ -125,6 +321,31 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" +[[package]] +name = "crossbeam-deque" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" + [[package]] name = "crypto-common" version = "0.1.7" @@ -135,6 +356,48 @@ dependencies = [ "typenum", ] +[[package]] +name = "cssparser" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.13.1", + "smallvec", +] + +[[package]] +name = "cssparser-color" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa233e1dcd9c13a5d3e3a8a2c0f5a727bac380398345dbcb31db4597edc86b" +dependencies = [ + "cssparser", +] + +[[package]] +name = "cssparser-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a2a99df6e410a8ff4245aa2006499ea662245f967cc7c0a38c83ef8eb44dbf" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + [[package]] name = "darling" version = "0.21.3" @@ -155,6 +418,20 @@ dependencies = [ "darling_macro 0.23.0", ] +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + [[package]] name = "darling_core" version = "0.21.3" @@ -181,6 +458,17 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.119", +] + [[package]] name = "darling_macro" version = "0.21.3" @@ -203,6 +491,34 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "data-encoding" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" + +[[package]] +name = "data-url" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" +dependencies = [ + "matches", +] + [[package]] name = "defmt" version = "1.1.1" @@ -302,6 +618,51 @@ dependencies = [ "litrs", ] +[[package]] +name = "dragonbox_ecma" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d742b56656e8b14d63e7ea9806597b1849ae25412584c8adf78c0f67bd985e66" + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "edge-dhcp" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0b32c831ced877a78378312fe0b6f7cdd5759f3ba272578f582ff9bba5291d" +dependencies = [ + "edge-raw", + "heapless 0.9.3", + "num_enum", + "rand_core 0.9.5", +] + +[[package]] +name = "edge-raw" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "466dfce9c2172a4e947b81b556f1f07a86029fbac679e323cfb66c738cc2faea" + +[[package]] +name = "either" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d" + [[package]] name = "embassy-embedded-hal" version = "0.6.0" @@ -319,6 +680,37 @@ dependencies = [ "nb 1.1.0", ] +[[package]] +name = "embassy-executor" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0d3b15c9d7dc4fec1d8cb77112472fb008b3b28c51ad23838d83587a6d2f1e" +dependencies = [ + "cordyceps", + "critical-section", + "document-features", + "embassy-executor-macros", + "embassy-executor-timer-queue", +] + +[[package]] +name = "embassy-executor-macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d11a246f53de5f97a387f40ac24726817cd0b6f833e7603baac784f29d6ff276" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "embassy-executor-timer-queue" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" + [[package]] name = "embassy-futures" version = "0.1.2" @@ -334,6 +726,23 @@ dependencies = [ "num-traits", ] +[[package]] +name = "embassy-net" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "347bc855bdbdf50ed9c5a1d80e8204badb0ba149b8732dde38e1e9708ed9d313" +dependencies = [ + "document-features", + "embassy-net-driver", + "embassy-sync 0.8.0", + "embassy-time", + "embedded-io-async 0.7.0", + "embedded-nal-async", + "heapless 0.9.3", + "managed", + "smoltcp", +] + [[package]] name = "embassy-net-driver" version = "0.2.0" @@ -407,6 +816,16 @@ dependencies = [ "document-features", ] +[[package]] +name = "embassy-time-queue-utils" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168297bf80aaf114b3c9ad589bf38b01b3009b9af7f97cd18086c5bbf96f5693" +dependencies = [ + "embassy-executor-timer-queue", + "heapless 0.9.3", +] + [[package]] name = "embassy-usb-driver" version = "0.2.2" @@ -497,6 +916,12 @@ dependencies = [ "embedded-hal 1.0.0", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + [[package]] name = "embedded-io" version = "0.6.1" @@ -527,6 +952,25 @@ dependencies = [ "embedded-io 0.7.1", ] +[[package]] +name = "embedded-nal" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56a28be191a992f28f178ec338a0bf02f63d7803244add736d026a471e6ed77" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "embedded-nal-async" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5a1bd585135d302f8f6d7de329310938093da6271b37a6c94b8798795c0c6d" +dependencies = [ + "embedded-io-async 0.7.0", + "embedded-nal", +] + [[package]] name = "embedded-storage" version = "0.3.1" @@ -575,7 +1019,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46ced060d4085858283df950b80a4da2348e1707d7d07b1e966308582dae79f5" dependencies = [ - "allocator-api2", + "allocator-api2 0.3.1", "cfg-if", "document-features", "enumset", @@ -673,6 +1117,32 @@ dependencies = [ "xtensa-lx-rt", ] +[[package]] +name = "esp-hal-dhcp-server" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15dbfc886c70ad3f81ea6eaec936e41b95fff21279620371715f5635df85f5ff" +dependencies = [ + "edge-dhcp", + "embassy-futures", + "embassy-net", + "embassy-sync 0.8.0", + "embassy-time", + "heapless 0.9.3", + "log", +] + +[[package]] +name = "esp-hal-ota" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b4ced6d9984fd29c88b586286634f44fa0d96b4ee5f4d68facdfb643336533" +dependencies = [ + "embedded-storage", + "esp32s3", + "log", +] + [[package]] name = "esp-hal-procmacros" version = "0.22.0" @@ -688,12 +1158,55 @@ dependencies = [ "termcolor", ] +[[package]] +name = "esp-hal-wifimanager" +version = "0.3.1" +source = "git+https://github.com/InvisibleUSA/esp-hal-wifimanager#49050fdf44e9c2e1ec0be02b01301422c737519c" +dependencies = [ + "embassy-executor", + "embassy-futures", + "embassy-net", + "embassy-sync 0.7.2", + "embassy-time", + "embedded-io-async 0.7.0", + "embedded-storage", + "esp-hal", + "esp-hal-dhcp-server", + "esp-hal-ota", + "esp-nvs", + "esp-radio", + "esp-rtos", + "esp-storage", + "getrandom 0.2.15", + "heapless 0.9.3", + "include-minifier", + "log", + "portable-atomic", + "rand_core 0.6.4", + "serde", + "serde_json", + "static_cell", +] + [[package]] name = "esp-metadata-generated" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42c2ee95b945a4780796e4359e72c033aed3b45073880e8029458f538532db8a" +[[package]] +name = "esp-nvs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b61bade3acc39e566697bd215068384afba840999fcd8e9366702f267034c7c0" +dependencies = [ + "embedded-storage", + "esp-hal", + "esp-storage", + "strum", + "thiserror", +] + [[package]] name = "esp-phy" version = "0.2.0" @@ -709,7 +1222,6 @@ dependencies = [ "esp-sync", "esp-wifi-sys-esp32s3", "esp32s3", - "log", ] [[package]] @@ -727,11 +1239,11 @@ dependencies = [ [[package]] name = "esp-radio" -version = "0.18.0" +version = "1.0.0-beta.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fbff98b06a96b6ce3791ecec5c668524052a068e23aacd23afe17ddba844ce" +checksum = "0f25cc4e3ce27476b42c4a68943f10a92f9dec3c24bb001269958f0318fef02c" dependencies = [ - "allocator-api2", + "allocator-api2 0.3.1", "cfg-if", "docsplay", "document-features", @@ -742,25 +1254,18 @@ dependencies = [ "embedded-io-async 0.6.1", "embedded-io-async 0.7.0", "enumset", - "esp-alloc", "esp-config", "esp-hal", "esp-hal-procmacros", "esp-metadata-generated", "esp-phy", "esp-radio-rtos-driver", + "esp-rom-sys", "esp-sync", - "esp-wifi-sys-esp32", - "esp-wifi-sys-esp32c2", - "esp-wifi-sys-esp32c3", - "esp-wifi-sys-esp32c6", - "esp-wifi-sys-esp32h2", - "esp-wifi-sys-esp32s2", "esp-wifi-sys-esp32s3", "esp32s3", "heapless 0.9.3", "instability", - "log", "num-derive", "num-traits", "portable-atomic", @@ -808,10 +1313,13 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "551f90766e1527edaa0c91e8d559e9e2a60397b545e93357ac61fb31845e5712" dependencies = [ - "allocator-api2", + "allocator-api2 0.3.1", "cfg-if", "document-features", + "embassy-executor", "embassy-sync 0.8.0", + "embassy-time-driver", + "embassy-time-queue-utils", "esp-alloc", "esp-config", "esp-hal", @@ -826,6 +1334,21 @@ dependencies = [ "xtensa-lx", ] +[[package]] +name = "esp-storage" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf2b3f00c9f94b27c62a4f5296b19470c3a083c687c8146e554a459f9bee596" +dependencies = [ + "document-features", + "embedded-storage", + "esp-hal", + "esp-hal-procmacros", + "esp-metadata-generated", + "esp-rom-sys", + "esp-sync", +] + [[package]] name = "esp-sync" version = "0.2.1" @@ -855,68 +1378,11 @@ dependencies = [ "vcell", ] -[[package]] -name = "esp-wifi-sys-esp32" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2556f38f5292d9735d4e156e276815fc001c9a0a2be0544a575c5fb867129d24" -dependencies = [ - "log", -] - -[[package]] -name = "esp-wifi-sys-esp32c2" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b3eb3435dae84de611d4384639e61eed862818223e93fa70c525cb6a70127f" -dependencies = [ - "log", -] - -[[package]] -name = "esp-wifi-sys-esp32c3" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b290846b53db9a3965866964260220b67f2c41cc2dbc0b377e7136239fe168a7" -dependencies = [ - "log", -] - -[[package]] -name = "esp-wifi-sys-esp32c6" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57649401fc2f906a16e2268de88693724a125adcd0eba89b594a157affcee2d5" -dependencies = [ - "log", -] - -[[package]] -name = "esp-wifi-sys-esp32h2" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cf1be2e311f4b4e75b5507c6b007ffc3fcb8c6cb57f83cc6a9569ecdcf58484" -dependencies = [ - "log", -] - -[[package]] -name = "esp-wifi-sys-esp32s2" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a9a7f1bc51e7026c3012cda4f11d8799e5e0c0bb3be85797462219def6c26e" -dependencies = [ - "log", -] - [[package]] name = "esp-wifi-sys-esp32s3" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d8321f44b57d8112cbd8607cc83b85783b9195289acb45532728e3e229e7786" -dependencies = [ - "log", -] [[package]] name = "esp32" @@ -981,6 +1447,28 @@ dependencies = [ "vcell", ] +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "float-cmp" version = "0.9.0" @@ -1005,6 +1493,12 @@ dependencies = [ "gcd", ] +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures-core" version = "0.3.33" @@ -1032,6 +1526,7 @@ dependencies = [ "futures-core", "futures-task", "pin-project-lite", + "slab", ] [[package]] @@ -1040,6 +1535,21 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" +[[package]] +name = "generator" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3b854b0e584ead1a33f18b2fcad7cf7be18b3875c78816b753639aa501513ae" +dependencies = [ + "cc", + "cfg-if", + "libc", + "log", + "rustversion", + "windows-link", + "windows-result", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1050,6 +1560,29 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + [[package]] name = "hash32" version = "0.3.1" @@ -1059,6 +1592,30 @@ dependencies = [ "byteorder", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2 0.2.21", +] + [[package]] name = "hashbrown" version = "0.17.1" @@ -1108,6 +1665,19 @@ dependencies = [ "embedded-hal 1.0.0", ] +[[package]] +name = "include-minifier" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4aab0efa4c730ef528fc8249cd190c69f193c64128fb20b204e0855fec19dc1" +dependencies = [ + "minify-html", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.119", +] + [[package]] name = "indexmap" version = "2.14.0" @@ -1115,7 +1685,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", + "serde", + "serde_core", ] [[package]] @@ -1140,6 +1712,24 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.18" @@ -1182,12 +1772,75 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "js-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json-escape-simd" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22a2041e3874a055a4eb03ea2395aaccdefa84ce75b31d542d72a741c3c6ad3" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.189" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" +[[package]] +name = "lightningcss" +version = "1.0.0-alpha.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d31b760f96e8fdfe1d0c295e4bf76c503d6f15d2d470d53bd8cd1f7aa8c7d934" +dependencies = [ + "ahash 0.8.12", + "bitflags 2.13.1", + "const-str", + "cssparser", + "cssparser-color", + "dashmap", + "data-encoding", + "getrandom 0.3.4", + "indexmap", + "itertools 0.10.5", + "lazy_static", + "lightningcss-derive", + "parcel_selectors", + "parcel_sourcemap", + "pastey", + "pathdiff", + "rayon", + "serde", + "serde-content", + "smallvec", +] + +[[package]] +name = "lightningcss-derive" +version = "1.0.0-alpha.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12744d1279367caed41739ef094c325d53fb0ffcd4f9b84a368796f870252" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "linked_list_allocator" version = "0.10.6" @@ -1200,18 +1853,55 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" +[[package]] +name = "loom" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", + "tracing", + "tracing-subscriber", +] + [[package]] name = "managed" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + [[package]] name = "memchr" version = "2.8.3" @@ -1224,6 +1914,50 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815" +[[package]] +name = "minify-html" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "644c1511457e5f70dcbc03c932d4bd26351eceb8657b119c919dde2e65b6d120" +dependencies = [ + "ahash 0.8.12", + "aho-corasick", + "lightningcss", + "memchr", + "minify-html-common", + "once_cell", + "oxc_allocator", + "oxc_codegen", + "oxc_minifier", + "oxc_parser", + "oxc_span", +] + +[[package]] +name = "minify-html-common" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c3d71ae301c4e36949937ed9d121e1bf6847f2dc69ec20929b379d14659aac" +dependencies = [ + "ahash 0.8.12", + "aho-corasick", + "itertools 0.14.0", + "memchr", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + [[package]] name = "nb" version = "0.1.3" @@ -1239,6 +1973,31 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" +[[package]] +name = "nonmax" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-derive" version = "0.4.2" @@ -1250,6 +2009,15 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -1259,6 +2027,27 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "object" version = "0.37.3" @@ -1268,12 +2057,520 @@ dependencies = [ "memchr", ] +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "outref" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" + +[[package]] +name = "outref" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" + +[[package]] +name = "owo-colors" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d" + +[[package]] +name = "oxc-browserslist" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb7a1163a5501f935f8722d839b576491b749c695e7a066aa0b8df988b806df" +dependencies = [ + "flate2", + "postcard", + "rustc-hash", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "oxc-miette" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356a61f2ed4c9b3610245215fbf48970eb277126919f87db9d0efa93a74245c" +dependencies = [ + "cfg-if", + "owo-colors", + "oxc-miette-derive", + "textwrap", + "thiserror", + "unicode-segmentation", + "unicode-width 0.2.2", +] + +[[package]] +name = "oxc-miette-derive" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b237422b014f8f8fff75bb9379e697d13f8d57551a22c88bebb39f073c1bf696" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "oxc_allocator" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "433214c659b860685d987ca25a523a544d35ebf87ee3658a942fd1c664cfa49b" +dependencies = [ + "allocator-api2 0.2.21", + "bumpalo", + "hashbrown 0.16.1", + "oxc_data_structures", + "rustc-hash", +] + +[[package]] +name = "oxc_ast" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e78ea25d23521092edcd509198635dd0bd96df7fb71349bcd8087bb8f6a615d" +dependencies = [ + "bitflags 2.13.1", + "oxc_allocator", + "oxc_ast_macros", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_estree", + "oxc_regular_expression", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_ast_macros" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3f29bf83925451a7ebbd30d3ff449414cc230c9b63aba70487c2ca74ea1e3ed" +dependencies = [ + "phf 0.13.1", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "oxc_ast_visit" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808862f42c9331954cf187261d6a48dbf471ccbe60b6a35f6b1056c11f32e95b" +dependencies = [ + "oxc_allocator", + "oxc_ast", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_codegen" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "480bab938439c921d34750708abf15aacf253ea11e2f348e4b085cbf697f4ea2" +dependencies = [ + "bitflags 2.13.1", + "cow-utils", + "dragonbox_ecma", + "itoa", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_index", + "oxc_semantic", + "oxc_sourcemap", + "oxc_span", + "oxc_syntax", + "rustc-hash", +] + +[[package]] +name = "oxc_compat" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd06b5cb59ece933be410adc6f811108a10c567fa2d105321f8d0f01cc4ab0c6" +dependencies = [ + "cow-utils", + "oxc-browserslist", + "oxc_syntax", + "rustc-hash", + "serde", +] + +[[package]] +name = "oxc_data_structures" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd090988aa69c1e394f424289abb9bb1281448a072419ca556a07228ad36b854" + +[[package]] +name = "oxc_diagnostics" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b8a09558d38ee7f23faf0249cdb37b5b26f53a7375941f8636c41c661b283ce" +dependencies = [ + "cow-utils", + "oxc-miette", + "percent-encoding", +] + +[[package]] +name = "oxc_ecmascript" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0002ece1cc266aa6654913d39cf552b0cf501afce9d953b87c283dfcd307266" +dependencies = [ + "cow-utils", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_ast", + "oxc_span", + "oxc_syntax", +] + +[[package]] +name = "oxc_estree" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af85b24b7e10bf0ccb252f16d38492f51236c1ba146f62013993667cbf7fa649" + +[[package]] +name = "oxc_index" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3e6120999627ec9703025eab7c9f410ebb7e95557632a8902ca48210416c2b" +dependencies = [ + "nonmax", + "serde", +] + +[[package]] +name = "oxc_mangler" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb751e1971f0809547347edfebe3755d5bed354aacf3ca7fe7216b901a11dd1d" +dependencies = [ + "itertools 0.14.0", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_index", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "rustc-hash", +] + +[[package]] +name = "oxc_minifier" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e836caa36befa6f9603eebf56b0c08d1e164ae31160c8e99ab3f535203065a4c" +dependencies = [ + "cow-utils", + "oxc_allocator", + "oxc_ast", + "oxc_ast_visit", + "oxc_codegen", + "oxc_compat", + "oxc_data_structures", + "oxc_ecmascript", + "oxc_index", + "oxc_mangler", + "oxc_parser", + "oxc_regular_expression", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "oxc_traverse", + "rustc-hash", +] + +[[package]] +name = "oxc_parser" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb730ab93ff23bbc471ef7109f847afa709bb284dd52a5d3366283d724858158" +dependencies = [ + "bitflags 2.13.1", + "cow-utils", + "memchr", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_ast", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_regular_expression", + "oxc_span", + "oxc_syntax", + "rustc-hash", + "seq-macro", +] + +[[package]] +name = "oxc_regular_expression" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bafc3035e3b0fe555ae56f7bbc108a7ee520b0858250ba16d197e44ca83746" +dependencies = [ + "bitflags 2.13.1", + "oxc_allocator", + "oxc_ast_macros", + "oxc_diagnostics", + "oxc_span", + "phf 0.13.1", + "rustc-hash", + "unicode-id-start", +] + +[[package]] +name = "oxc_semantic" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578e5fa0b975a28e1d1ffa6c81c8df094545fe3c3225956d4e93ffe1ade3dae0" +dependencies = [ + "itertools 0.14.0", + "oxc_allocator", + "oxc_ast", + "oxc_ast_visit", + "oxc_data_structures", + "oxc_diagnostics", + "oxc_ecmascript", + "oxc_index", + "oxc_span", + "oxc_syntax", + "phf 0.13.1", + "rustc-hash", + "self_cell", +] + +[[package]] +name = "oxc_sourcemap" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d378eb8bad20e89d66276aebab51f6a5408571092cac94abdd3eabb773713d6" +dependencies = [ + "base64-simd 0.8.0", + "json-escape-simd", + "rustc-hash", + "serde", + "serde_json", +] + +[[package]] +name = "oxc_span" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71243fe1ece27f71a6be5e2ab11d051792eeb578f3b056d7c9bbe82ec8043bf3" +dependencies = [ + "compact_str", + "oxc-miette", + "oxc_allocator", + "oxc_ast_macros", + "oxc_estree", +] + +[[package]] +name = "oxc_syntax" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93c99e555ed497111004a71fb2aa6f8fb90b0d3e2733aceeb035e24701d69634" +dependencies = [ + "bitflags 2.13.1", + "cow-utils", + "dragonbox_ecma", + "nonmax", + "oxc_allocator", + "oxc_ast_macros", + "oxc_data_structures", + "oxc_estree", + "oxc_index", + "oxc_span", + "phf 0.13.1", + "unicode-id-start", +] + +[[package]] +name = "oxc_traverse" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68d00264248ef474988ea02bfa44ccacd9a1d8716f0efb33a9cd6f992cf07b7b" +dependencies = [ + "itoa", + "oxc_allocator", + "oxc_ast", + "oxc_ast_visit", + "oxc_data_structures", + "oxc_ecmascript", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "rustc-hash", +] + +[[package]] +name = "parcel_selectors" +version = "0.28.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05f71e01edca03d245ab0a9f7ce13a974ceb79baaae8faf2ba0b11de6b90913" +dependencies = [ + "bitflags 2.13.1", + "cssparser", + "log", + "phf 0.11.3", + "phf_codegen", + "precomputed-hash", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "parcel_sourcemap" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "485b74d7218068b2b7c0e3ff12fbc61ae11d57cb5d8224f525bd304c6be05bbb" +dependencies = [ + "base64-simd 0.7.0", + "data-url", + "rkyv", + "serde", + "serde_json", + "vlq", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + [[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pastey" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec" + +[[package]] +name = "pathdiff" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared 0.13.1", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared 0.13.1", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -1316,6 +2613,24 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -1334,6 +2649,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "quote" version = "1.0.47" @@ -1343,17 +2678,41 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "ral-registers" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46b71a9d9206e8b46714c74255adcaea8b11e0350c1d8456165073c3f75fc81a" +[[package]] +name = "rand" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.15", +] [[package]] name = "rand_core" @@ -1367,6 +2726,61 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.1", +] + +[[package]] +name = "regex-automata" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdb36bda0c880c5931cdc7a2bcdc8ba4556847b9d912bca70bc94708711ad" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + [[package]] name = "riscv" version = "0.15.0" @@ -1426,6 +2840,35 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1376b15f3ff160e9b1e8ea564ce427f2f6fcf77528cc0a8bf405cb476f9cea7" +[[package]] +name = "rkyv" +version = "0.7.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2297bf9c81a3f0dc96bc9521370b88f054168c29826a75e89c55ff196e7ed6a1" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d7b42d4b8d06048d3ac8db0eb31bcb942cbeb709f0b5f2b2ebde398d3038f5" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "rlsf" version = "0.2.2" @@ -1439,6 +2882,12 @@ dependencies = [ "svgbobdoc", ] +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + [[package]] name = "rustversion" version = "1.0.23" @@ -1451,6 +2900,36 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + +[[package]] +name = "seq-macro" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" + [[package]] name = "serde" version = "1.0.229" @@ -1461,6 +2940,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-content" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3753ca04f350fa92d00b6146a3555e63c55388c9ef2e11e09bce2ff1c0b509c6" +dependencies = [ + "serde", +] + [[package]] name = "serde_core" version = "1.0.229" @@ -1481,6 +2969,19 @@ dependencies = [ "syn 3.0.3", ] +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + [[package]] name = "serde_yaml" version = "0.9.34+deprecated" @@ -1494,6 +2995,66 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "simd-abstraction" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" +dependencies = [ + "outref 0.1.0", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "smawk" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8e2fb0f499abb4d162f2bedad68f5ef91a1682b5a03596ddb67efd37768d100" + [[package]] name = "smoltcp" version = "0.13.1" @@ -1504,7 +3065,6 @@ dependencies = [ "byteorder", "cfg-if", "heapless 0.9.3", - "log", "managed", ] @@ -1529,6 +3089,21 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "static_cell" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" +dependencies = [ + "portable-atomic", +] + [[package]] name = "strsim" version = "0.11.1" @@ -1566,7 +3141,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -1602,6 +3177,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "termcolor" version = "1.4.1" @@ -1611,6 +3192,17 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width 0.2.2", +] + [[package]] name = "thiserror" version = "2.0.19" @@ -1631,6 +3223,30 @@ dependencies = [ "syn 3.0.3", ] +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinyvec" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "toml_datetime" version = "1.1.1+spec-1.1.0" @@ -1661,6 +3277,67 @@ dependencies = [ "winnow", ] +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + [[package]] name = "typenum" version = "1.20.1" @@ -1673,18 +3350,42 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" +[[package]] +name = "unicode-id-start" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b79ad29b5e19de4260020f8919b443b2ef0277d242ce532ec7b7a2cc8b6007" + [[package]] name = "unicode-ident" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + [[package]] name = "unicode-width" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -1701,6 +3402,22 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "uuid" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3923a6f5c4c6382e0b653c4117f48d631ea17f38ed86e2a828e6f7412f5239" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "vcell" version = "0.1.3" @@ -1713,12 +3430,84 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "vlq" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65dd7eed29412da847b0f78bcec0ac98588165988a8cfe41d4ea1d429f8ccfff" + [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.119", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +dependencies = [ + "unicode-ident", +] + [[package]] name = "winapi-util" version = "0.1.11" @@ -1734,6 +3523,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-sys" version = "0.61.2" @@ -1752,6 +3550,21 @@ dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + [[package]] name = "xtensa-lx" version = "0.13.0" @@ -1782,3 +3595,29 @@ dependencies = [ "quote", "syn 2.0.119", ] + +[[package]] +name = "zerocopy" +version = "0.8.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 885e6d8..5b8e1f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ path = "./src/bin/main.rs" esp-hal = { version = "~1.1.0", features = ["esp32s3", "log-04", "unstable"] } esp-rtos = { version = "0.3.0", features = [ + "embassy", "esp-alloc", "esp-radio", "esp32s3", @@ -23,28 +24,14 @@ log = "0.4.27" critical-section = "1.2.0" embedded-io = "0.7.1" +embassy-executor = { version = "0.10.0", default-features = false } +embassy-time = { version = "0.5.1", default-features = false } esp-alloc = "0.10.0" -esp-println = { version = "0.17.0", features = ["esp32s3", "log-04"] } -esp-radio = { version = "0.18.0", features = [ - "esp-alloc", +esp-hal-wifimanager = { git = "https://github.com/InvisibleUSA/esp-hal-wifimanager", default-features = false, features = [ + "ap", "esp32s3", - "log-04", - "unstable", - "wifi", -] } -smoltcp = { version = "0.13.0", default-features = false, features = [ - "log", - "medium-ethernet", - "multicast", - "proto-dhcpv4", - "proto-dns", - "proto-ipv4", - "socket-dns", - "socket-icmp", - "socket-raw", - "socket-tcp", - "socket-udp", ] } +esp-println = { version = "0.17.0", features = ["esp32s3", "log-04"] } display-interface-spi = "0.5.0" ili9341 = "0.6.0" embedded-hal = "1.0.0" @@ -64,3 +51,7 @@ codegen-units = 1 # LLVM can perform better optimizations using a single thr debug = 2 # prefer slower builds but better debugging experience lto = 'fat' opt-level = 's' + +[features] +default = [] +wokwi = [] \ No newline at end of file diff --git a/diagram.json b/diagram.json index 150444d..c8b66ff 100644 --- a/diagram.json +++ b/diagram.json @@ -1,5 +1,6 @@ { "version": 1, + "author": "CreatureDex", "editor": "wokwi", "parts": [ { "type": "board-esp32-s3-devkitc-1", "id": "esp1", "top": 67.2, "left": -263.96, "attrs": {} }, @@ -26,6 +27,8 @@ } ], "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" ] ], diff --git a/src/bin/main.rs b/src/bin/main.rs index 6b07d41..6156863 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -7,6 +7,8 @@ )] #![deny(clippy::large_stack_frames)] +use embassy_executor::Spawner; +use embassy_time::Timer; use display_interface_spi::SPIInterface; use embedded_graphics::Drawable; use embedded_graphics::mono_font::MonoTextStyle; @@ -22,13 +24,11 @@ use esp_hal::delay::Delay; use esp_hal::gpio::Level; use esp_hal::gpio::Output; use esp_hal::gpio::OutputConfig; -use esp_hal::main; use esp_hal::spi::{ Mode, master::{Config, Spi}, }; use esp_hal::time::Rate; -use esp_hal::time::{Duration, Instant}; use esp_hal::timer::timg::TimerGroup; use ili9341::Ili9341; use ili9341::Orientation; @@ -46,15 +46,96 @@ extern crate alloc; // For more information see: esp_bootloader_esp_idf::esp_app_desc!(); + +#[cfg(not(feature = "wokwi"))] +async fn setup_wifi( + wifi: esp_hal::peripherals::WIFI<'static>, + flash: esp_hal::peripherals::FLASH<'static>, + spawner: &Spawner, +) { + let nvs = esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash).unwrap(); + + let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); + + wm_settings.ssid.clear(); + _ = core::fmt::write( + &mut wm_settings.ssid, + format_args!("CreatureDex-{:X}", esp_hal_wifimanager::get_efuse_mac()), + ); + + wm_settings.wifi_conn_timeout = 30000; + wm_settings.esp_reset_timeout = Some(300000); // 5min + + let wifi_res = esp_hal_wifimanager::init_wm( + wm_settings, + spawner, + Some(&nvs), + wifi, + None, + ) + .await; + + log::info!("wifi_res: {wifi_res:?}"); +} + +#[cfg(feature = "wokwi")] +async fn setup_wifi( + wifi: esp_hal::peripherals::WIFI<'static>, + flash: esp_hal::peripherals::FLASH<'static>, + spawner: &Spawner, +) { + log::info!("Wokwi mode active: pre-seeding WiFi Manager with Wokwi credentials"); + + // Preload connection data so init_wm can connect immediately without AP setup. + let nvs = match esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash) { + Ok(nvs) => nvs, + Err(e) => { + log::error!("Failed to initialize NVS for Wokwi: {e:?}"); + return; + } + }; + + if let Err(e) = nvs + .set( + esp_hal_wifimanager::WIFI_NVS_KEY, + "{\"ssid\":\"Wokwi-GUEST\",\"psk\":\"\",\"data\":{}}", + ) + .await + { + log::error!("Failed to store Wokwi WiFi config in NVS: {e:?}"); + return; + } + + let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); + + // Wokwi simulation uses a default open network called "Wokwi-GUEST" + wm_settings.ssid.clear(); + _ = core::fmt::write(&mut wm_settings.ssid, format_args!("Wokwi-GUEST")); + + wm_settings.wifi_conn_timeout = 30000; + + // Initialize Wi-Fi connection through WiFi Manager using the pre-seeded NVS data. + let wifi_res = esp_hal_wifimanager::init_wm( + wm_settings, + spawner, + Some(&nvs), + wifi, + None, + ) + .await; + + log::info!("Wokwi wifi_res: {wifi_res:?}"); +} + #[allow( clippy::large_stack_frames, reason = "it's not unusual to allocate larger buffers etc. in main" )] -#[main] -fn main() -> ! { +#[esp_rtos::main] +async fn main(spawner: Spawner) { // generator version: 1.3.0 // generator parameters: --chip esp32s3 -o esp32s3-wroom-1-octal-psram -o unstable-hal -o alloc -o wifi -o log -o wokwi -o neovim -o vscode -o esp - + esp_println::logger::init_logger_from_env(); let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max()); @@ -85,9 +166,7 @@ fn main() -> ! { let sw_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0); - let (mut _wifi_controller, _interfaces) = - esp_radio::wifi::new(peripherals.WIFI, Default::default()) - .expect("Failed to initialize Wi-Fi controller"); + let spi_bus = Spi::new( peripherals.SPI2, @@ -124,10 +203,13 @@ fn main() -> ! { .draw(&mut display) .unwrap(); + setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await; + + log::info!("Setup complete, entering main loop"); + loop { info!("Hello world!"); - let delay_start = Instant::now(); - while delay_start.elapsed() < Duration::from_millis(500) {} + Timer::after_millis(500).await; } // for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples -- 2.39.5 From 9b8dd759ca665a88d90533c142ed70853b813b47 Mon Sep 17 00:00:00 2001 From: lukas Date: Thu, 30 Jul 2026 17:32:20 +0200 Subject: [PATCH 03/12] Implemented extracting required information form NFC pyload bytes --- diagram.json | 2 +- src/bin/main.rs | 326 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 322 insertions(+), 6 deletions(-) diff --git a/diagram.json b/diagram.json index c8b66ff..04d2356 100644 --- a/diagram.json +++ b/diagram.json @@ -5,7 +5,7 @@ "parts": [ { "type": "board-esp32-s3-devkitc-1", "id": "esp1", "top": 67.2, "left": -263.96, "attrs": {} }, { - "type": "board-ili9341-cap-touch", + "type": "wokwi-ili9341", "id": "lcd1", "top": -191.24, "left": -0.38, diff --git a/src/bin/main.rs b/src/bin/main.rs index 6156863..a877e68 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -7,10 +7,12 @@ )] #![deny(clippy::large_stack_frames)] +use alloc::{format, string::{String, ToString}}; use embassy_executor::Spawner; use embassy_time::Timer; use display_interface_spi::SPIInterface; use embedded_graphics::Drawable; +use embedded_graphics::Pixel; use embedded_graphics::mono_font::MonoTextStyle; use embedded_graphics::mono_font::ascii::FONT_6X10; use embedded_graphics::pixelcolor::Rgb565; @@ -47,6 +49,282 @@ extern crate alloc; esp_bootloader_esp_idf::esp_app_desc!(); +// The mock payload acting as our simulated NFC card read +const MOCK_PAYLOAD: [u8; 858] = [ + 0xE9, 0x24, 0x01, 0x47, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x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E, 0x00, 0x94, + 0xB2, 0xEE, 0x66, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3B, 0x9E, + 0x1B, 0x3B, 0x03, 0x50, 0xCA, 0xBA, 0x9B, 0x09, 0x00, 0x81, 0xFA, 0xB1, 0xEE, 0xCB, 0x7E, 0xC0, + 0xD4, 0x8D, 0x1F, 0xDA, 0x7D, 0x43, 0x8A, 0xB6, 0x1F, 0x0B, 0x7F, 0x2D, 0x30, 0xA9, 0xDF, 0xE7, + 0x01, 0x53, 0x70, 0x65, 0x65, 0x64, 0x79, 0x20, 0x74, 0x68, 0x69, 0x6E, 0x67, 0x20, 0x67, 0x6F, + 0x65, 0x73, 0x20, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x23, 0xC0, 0xD6, 0x5A, 0x9D, 0xA2, 0xAB, + 0xC4, 0x80, 0xC3, 0x06, 0xDB, 0xE8, 0x88, 0x7A, 0x7E, 0xB2, 0x40, 0x10, 0xA2, 0xDF, 0xC0, 0x89, + 0x03, 0x63, 0x8F, 0x4C, 0x2F, 0xBA, 0xCC, 0x17, 0x23, 0x51, 0x60, 0x27, 0x3B, 0x00, 0x1C, 0x6D, + 0x1F, 0x8C, 0x6B, 0x3E, 0x32, 0xE2, 0x53, 0xD9, 0x8F, 0x00 +]; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +struct Rgb(pub u8, pub u8, pub u8); + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +struct TypeStyle { + pub name: &'static str, + pub primary: Rgb, + pub text: Rgb, +} + +const PALETTES: [[Rgb; 16]; 8] = [ + // Palette Default + [ + Rgb(31, 23, 35), Rgb(60, 47, 82), Rgb(178, 39, 65), Rgb(70, 86, 165), + Rgb(245, 70, 76), Rgb(216, 104, 48), Rgb(140, 127, 144), Rgb(73, 149, 243), + Rgb(62, 197, 75), Rgb(240, 149, 72), Rgb(188, 176, 179), Rgb(247, 156, 136), + Rgb(114, 222, 235), Rgb(180, 230, 86), Rgb(239, 208, 129), Rgb(255, 255, 255), + ], + // Palette Blueprint + [ + Rgb(83, 67, 127), Rgb(44, 111, 153), Rgb(142, 88, 111), Rgb(0, 188, 170), + Rgb(153, 104, 226), Rgb(109, 129, 255), Rgb(255, 84, 112), Rgb(196, 143, 158), + Rgb(168, 159, 204), Rgb(190, 155, 255), Rgb(255, 155, 113), Rgb(127, 206, 255), + Rgb(255, 155, 182), Rgb(255, 217, 174), Rgb(255, 217, 232), Rgb(255, 255, 255), + ], + // Palette CYBER + [ + Rgb(0, 0, 0), Rgb(0, 0, 126), Rgb(0, 0, 255), Rgb(126, 0, 0), + Rgb(126, 0, 126), Rgb(4, 126, 0), Rgb(254, 0, 0), Rgb(4, 126, 126), + Rgb(254, 0, 255), Rgb(126, 126, 0), Rgb(126, 126, 126), Rgb(6, 255, 4), + Rgb(6, 255, 255), Rgb(190, 190, 190), Rgb(255, 255, 4), Rgb(255, 255, 255), + ], + // Palette Nature + [ + Rgb(35, 34, 40), Rgb(40, 66, 97), Rgb(30, 116, 83), Rgb(117, 77, 69), + Rgb(95, 88, 84), Rgb(36, 133, 166), Rgb(198, 80, 70), Rgb(85, 160, 88), + Rgb(135, 133, 115), Rgb(84, 186, 210), Rgb(161, 191, 65), Rgb(230, 146, 138), + Rgb(184, 176, 149), Rgb(227, 192, 84), Rgb(195, 213, 199), Rgb(255, 255, 255), + ], + // Palette Fossil + [ + Rgb(75, 61, 68), Rgb(119, 66, 81), Rgb(78, 84, 99), Rgb(100, 83, 85), + Rgb(156, 82, 78), Rgb(132, 109, 89), Rgb(91, 125, 115), Rgb(125, 123, 98), + Rgb(140, 124, 121), Rgb(185, 122, 96), Rgb(168, 138, 94), Rgb(142, 159, 125), + Rgb(170, 162, 93), Rgb(169, 156, 141), Rgb(204, 168, 123), Rgb(255, 255, 255), + ], + // Palette Ghost + [ + Rgb(0, 0, 0), Rgb(24, 24, 24), Rgb(40, 40, 40), Rgb(56, 56, 56), + Rgb(71, 71, 71), Rgb(86, 86, 86), Rgb(100, 100, 100), Rgb(113, 113, 113), + Rgb(126, 126, 126), Rgb(140, 140, 140), Rgb(155, 155, 155), Rgb(171, 171, 171), + Rgb(189, 189, 189), Rgb(209, 209, 209), Rgb(231, 231, 231), Rgb(255, 255, 255), + ], + // Palette Daemon + [ + Rgb(0, 3, 60), Rgb(96, 0, 136), Rgb(0, 56, 132), Rgb(42, 46, 121), + Rgb(0, 82, 96), Rgb(177, 5, 133), Rgb(255, 0, 78), Rgb(172, 41, 206), + Rgb(0, 157, 74), Rgb(0, 138, 197), Rgb(78, 110, 168), Rgb(255, 92, 255), + Rgb(10, 255, 82), Rgb(0, 247, 255), Rgb(173, 212, 250), Rgb(255, 255, 255), + ], + // Palette Fairy + [ + Rgb(40, 40, 46), Rgb(108, 86, 113), Rgb(135, 168, 137), Rgb(249, 130, 132), + Rgb(176, 169, 228), Rgb(222, 163, 139), Rgb(172, 204, 228), Rgb(254, 170, 228), + Rgb(217, 200, 191), Rgb(255, 195, 132), Rgb(176, 235, 147), Rgb(179, 227, 218), + Rgb(233, 245, 157), Rgb(255, 230, 198), Rgb(255, 247, 160), Rgb(255, 255, 255), + ], +]; + +const TYPE_STYLES: [TypeStyle; 8] = [ + TypeStyle { name: "Default", primary: Rgb(0xD8, 0x68, 0x30), text: Rgb(0xFF, 0xFF, 0xFF) }, + TypeStyle { name: "Blueprint", primary: Rgb(0x6D, 0x81, 0xFF), text: Rgb(0xFF, 0xFF, 0xFF) }, + TypeStyle { name: "CYBER", primary: Rgb(0xFF, 0xFF, 0x04), text: Rgb(0x00, 0x00, 0x00) }, + TypeStyle { name: "Nature", primary: Rgb(0x55, 0xA0, 0x58), text: Rgb(0xFF, 0xFF, 0xFF) }, + TypeStyle { name: "Fossil", primary: Rgb(0xB9, 0x7A, 0x60), text: Rgb(0xFF, 0xFF, 0xFF) }, + TypeStyle { name: "Ghost", primary: Rgb(0xAB, 0xAB, 0xAB), text: Rgb(0xFF, 0xFF, 0xFF) }, + TypeStyle { name: "Daemon", primary: Rgb(0x60, 0x00, 0x88), text: Rgb(0xFF, 0xFF, 0xFF) }, + TypeStyle { name: "Fairy", primary: Rgb(0xB0, 0xA9, 0xE4), text: Rgb(0xFF, 0xFF, 0xFF) }, +]; + +#[derive(Debug, Clone, Copy)] +struct NfcPayload<'a> { + pub event_encoding: &'a [u8], + pub card_type: u8, + pub card_uuid: &'a [u8], + pub _reserved: &'a [u8], + pub sprite: &'a [u8], + pub packed_card_text: &'a [u8], + pub secret: &'a [u8], + pub _opaque_trailer: &'a [u8], +} + +fn split_nfc_hex(payload: &[u8]) -> Option> { + if payload.len() < 0x35A { + return None; + } + + Some(NfcPayload { + event_encoding: &payload[0..2], + card_type: payload[2], + card_uuid: &payload[3..5], + _reserved: &payload[5..9], + sprite: &payload[9..0x2DB], + packed_card_text: &payload[0x2DB..0x311], + secret: &payload[0x311..0x329], + _opaque_trailer: &payload[0x329..0x35A], + }) +} + +fn render_sprite_onto_ili9341( + ili9341: &mut D, + sprite: &[u8], + palette: &[Rgb; 16], +) where + D: DrawTarget, +{ + let pixel_count = sprite.len() * 2; + if pixel_count == 0 { + return; + } + + let mut src_width = 1usize; + while src_width * src_width < pixel_count { + src_width += 1; + } + + let target_width = 240usize; + let scale = core::cmp::max(1, target_width / src_width); + + for y in 0..src_width { + for x in 0..src_width { + let pixel_index = y * src_width + x; + if pixel_index >= pixel_count { + break; + } + + let byte_index = pixel_index / 2; + let pixel_byte = sprite[byte_index]; + let color_index = if pixel_index % 2 == 0 { + (pixel_byte >> 4) & 0x0F + } else { + pixel_byte & 0x0F + }; + + let Rgb(r, g, b) = palette[color_index as usize]; + let color = Rgb565::new(r >> 3, g >> 2, b >> 3); + let start_x = x * scale; + let start_y = y * scale; + let end_x = core::cmp::min(start_x + scale, target_width); + let end_y = core::cmp::min(start_y + scale, target_width); + + for draw_y in start_y..end_y { + for draw_x in start_x..end_x { + let _ = ili9341.draw_iter(core::iter::once(Pixel( + Point::new(draw_x as i32, draw_y as i32), + color, + ))); + } + } + } + } +} + +fn decode_known_event(event_encoding: &[u8]) -> Option<&'static str> { + match event_encoding { + [0x39, 0xC3] => Some("39C3"), + [0x40, 0xC3] => Some("40C3"), // future proofing :) + [0xE9, 0x24] => Some("GPN 24"), + [0xE9, 0x25] => Some("GPN 25"), // future proofing :) + _ => None, + } +} + +fn decode_secret(hex: &[u8]) -> alloc::string::String { + let mut ascii_string = alloc::string::String::new(); + for &byte in hex { + if byte == 0 { + break; + } + + // Keep the output readable on the display by excluding control characters. + if byte.is_ascii_graphic() || byte == b' ' { + ascii_string.push(byte as char); + } + } + ascii_string +} + +fn decode_packed_card_text(bytes: &[u8]) -> (String, String, String, String) { + let alphabet = b" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-"; + let mut full_text = String::with_capacity((bytes.len() * 8) / 6 + 1); + + let mut accumulator: u32 = 0; + let mut bits_in_acc: u32 = 0; + + for &byte in bytes { + accumulator |= (byte as u32) << bits_in_acc; + bits_in_acc += 8; + + while bits_in_acc >= 6 { + let char_index = (accumulator & 0x3F) as usize; + + full_text.push(alphabet[char_index] as char); + + accumulator >>= 6; + bits_in_acc -= 6; + } + } + + let name = full_text[0..24].trim().to_string(); + let trait1 = full_text[24..40].trim().to_string(); + let trait2 = full_text[40..56].trim().to_string(); + let trait3 = full_text[56..72].trim().to_string(); + + (name, trait1, trait2, trait3) +} + + #[cfg(not(feature = "wokwi"))] async fn setup_wifi( wifi: esp_hal::peripherals::WIFI<'static>, @@ -191,17 +469,55 @@ async fn main(spawner: Spawner) { iface, reset_main, &mut delay, - Orientation::Landscape, + Orientation::Portrait, ili9341::DisplaySize240x320, ) .unwrap(); display.clear(Rgb565::BLACK).unwrap(); - let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE); - Text::new("Hello, ESP32!", Point::new(20, 100), style) - .draw(&mut display) - .unwrap(); + let nfc_payload: Option> = split_nfc_hex(&MOCK_PAYLOAD); + if let Some(nfc_payload) = nfc_payload { + let (name, trait1, trait2, trait3) = decode_packed_card_text(nfc_payload.packed_card_text); + let secret = decode_secret(nfc_payload.secret); + + let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE); + Text::new(&format!("Name: {}", name), Point::new(20, 240), style) + .draw(&mut display) + .unwrap(); + Text::new(&format!("Type: {}", TYPE_STYLES[(nfc_payload.card_type - 1) as usize].name), Point::new(20, 250), style) + .draw(&mut display) + .unwrap(); + Text::new(&format!("Event: {}", decode_known_event(nfc_payload.event_encoding).unwrap_or("Unknown")), Point::new(20, 260), style) + .draw(&mut display) + .unwrap(); + Text::new(&format!("UUID: {}", nfc_payload.card_uuid.iter().map(|b| format!("{:02X}", b)).collect::()), Point::new(20, 270), style) + .draw(&mut display) + .unwrap(); + Text::new(&format!("Trait1: {}", trait1), Point::new(20, 280), style) + .draw(&mut display) + .unwrap(); + Text::new(&format!("Trait2: {}", trait2), Point::new(20, 290), style) + .draw(&mut display) + .unwrap(); + Text::new(&format!("Trait3: {}", trait3), Point::new(20, 300), style) + .draw(&mut display) + .unwrap(); + Text::new(&format!("Secret: {}", secret), Point::new(20, 310), style) + .draw(&mut display) + .unwrap(); + + render_sprite_onto_ili9341( + &mut display, + nfc_payload.sprite, + &PALETTES[(nfc_payload.card_type - 1) as usize], + ); + } else { + log::error!( + "NFC payload too short to decode packed text: {} bytes", + MOCK_PAYLOAD.len() + ); + } setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await; -- 2.39.5 From 8ae2650e30fce2ae57f8aa9245ec32f0feb01d2c Mon Sep 17 00:00:00 2001 From: lukas Date: Sat, 1 Aug 2026 10:13:29 +0200 Subject: [PATCH 04/12] Improved sprite rendering --- Cargo.lock | 9 +- Cargo.toml | 1 + src/bin/main.rs | 436 ++++++++++++++++++++++++++++++++++++------------ 3 files changed, 337 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e99a9fc..cb1baf7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,6 +71,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64-simd" version = "0.7.0" @@ -296,6 +302,7 @@ dependencies = [ name = "creaturedex" version = "0.1.0" dependencies = [ + "base64 0.22.1", "critical-section", "display-interface-spi", "embassy-executor", @@ -3137,7 +3144,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50" dependencies = [ - "base64", + "base64 0.13.1", "proc-macro2", "quote", "syn 1.0.109", diff --git a/Cargo.toml b/Cargo.toml index 5b8e1f7..2ecb546 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ embedded-hal = "1.0.0" embedded-hal-bus = "0.3.0" embedded-graphics = "0.8.2" embedded-graphics-core = "0.4.1" +base64 = { version = "0.22", default-features = false, features = ["alloc"] } # For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html diff --git a/src/bin/main.rs b/src/bin/main.rs index a877e68..ef6be69 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -7,18 +7,25 @@ )] #![deny(clippy::large_stack_frames)] -use alloc::{format, string::{String, ToString}}; +use alloc::{ + format, + string::{String, ToString}, +}; +use base64::{Engine as _, engine::general_purpose}; +use display_interface_spi::SPIInterface; use embassy_executor::Spawner; use embassy_time::Timer; -use display_interface_spi::SPIInterface; -use embedded_graphics::Drawable; -use embedded_graphics::Pixel; use embedded_graphics::mono_font::MonoTextStyle; use embedded_graphics::mono_font::ascii::FONT_6X10; use embedded_graphics::pixelcolor::Rgb565; use embedded_graphics::prelude::Point; use embedded_graphics::prelude::RgbColor; use embedded_graphics::text::Text; +use embedded_graphics::{ + Drawable, + prelude::*, + primitives::{PrimitiveStyle, Rectangle}, +}; use embedded_graphics_core::draw_target::DrawTarget; use embedded_hal_bus::spi::ExclusiveDevice; use esp_hal::clock::CpuClock; @@ -48,8 +55,64 @@ extern crate alloc; // For more information see: esp_bootloader_esp_idf::esp_app_desc!(); - // The mock payload acting as our simulated NFC card read +const MOCK_PAYLOAD2: [u8; 858] = [ + 0xE9, 0x24, 0x03, 0xDA, 0x45, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, 0xA0, 0xF0, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, 0xA0, 0xF0, 0xAA, 0x0F, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xAA, 0xAA, 0x00, 0xAA, + 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, + 0xAA, 0x0A, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0xAA, 0xAA, 0xAA, 0x0A, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xF0, 0xAA, 0xAA, 0xA0, 0xAA, 0xA0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF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D6, 0x71, 0x45, 0xE9, 0xD5, 0xA7, 0xF8, 0x0F, 0xBE, 0x8F, 0xF6, 0xB9, 0x77, 0x62, + 0x13, 0xF3, 0x84, 0x55, 0xD2, 0xBC, 0x4E, 0xCB, 0xDF, 0xDB, 0xC0, 0x91, 0x5F, 0x39, 0xE0, 0xF5, + 0x95, 0x2D, 0x14, 0xBD, 0x43, 0xB2, 0x40, 0x76, 0x78, 0x00, +]; + const MOCK_PAYLOAD: [u8; 858] = [ 0xE9, 0x24, 0x01, 0x47, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -104,7 +167,7 @@ const MOCK_PAYLOAD: [u8; 858] = [ 0x65, 0x73, 0x20, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x23, 0xC0, 0xD6, 0x5A, 0x9D, 0xA2, 0xAB, 0xC4, 0x80, 0xC3, 0x06, 0xDB, 0xE8, 0x88, 0x7A, 0x7E, 0xB2, 0x40, 0x10, 0xA2, 0xDF, 0xC0, 0x89, 0x03, 0x63, 0x8F, 0x4C, 0x2F, 0xBA, 0xCC, 0x17, 0x23, 0x51, 0x60, 0x27, 0x3B, 0x00, 0x1C, 0x6D, - 0x1F, 0x8C, 0x6B, 0x3E, 0x32, 0xE2, 0x53, 0xD9, 0x8F, 0x00 + 0x1F, 0x8C, 0x6B, 0x3E, 0x32, 0xE2, 0x53, 0xD9, 0x8F, 0x00, ]; #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -120,71 +183,199 @@ struct TypeStyle { const PALETTES: [[Rgb; 16]; 8] = [ // Palette Default [ - Rgb(31, 23, 35), Rgb(60, 47, 82), Rgb(178, 39, 65), Rgb(70, 86, 165), - Rgb(245, 70, 76), Rgb(216, 104, 48), Rgb(140, 127, 144), Rgb(73, 149, 243), - Rgb(62, 197, 75), Rgb(240, 149, 72), Rgb(188, 176, 179), Rgb(247, 156, 136), - Rgb(114, 222, 235), Rgb(180, 230, 86), Rgb(239, 208, 129), Rgb(255, 255, 255), + Rgb(31, 23, 35), + Rgb(60, 47, 82), + Rgb(178, 39, 65), + Rgb(70, 86, 165), + Rgb(245, 70, 76), + Rgb(216, 104, 48), + Rgb(140, 127, 144), + Rgb(73, 149, 243), + Rgb(62, 197, 75), + Rgb(240, 149, 72), + Rgb(188, 176, 179), + Rgb(247, 156, 136), + Rgb(114, 222, 235), + Rgb(180, 230, 86), + Rgb(239, 208, 129), + Rgb(255, 255, 255), ], // Palette Blueprint [ - Rgb(83, 67, 127), Rgb(44, 111, 153), Rgb(142, 88, 111), Rgb(0, 188, 170), - Rgb(153, 104, 226), Rgb(109, 129, 255), Rgb(255, 84, 112), Rgb(196, 143, 158), - Rgb(168, 159, 204), Rgb(190, 155, 255), Rgb(255, 155, 113), Rgb(127, 206, 255), - Rgb(255, 155, 182), Rgb(255, 217, 174), Rgb(255, 217, 232), Rgb(255, 255, 255), + Rgb(83, 67, 127), + Rgb(44, 111, 153), + Rgb(142, 88, 111), + Rgb(0, 188, 170), + Rgb(153, 104, 226), + Rgb(109, 129, 255), + Rgb(255, 84, 112), + Rgb(196, 143, 158), + Rgb(168, 159, 204), + Rgb(190, 155, 255), + Rgb(255, 155, 113), + Rgb(127, 206, 255), + Rgb(255, 155, 182), + Rgb(255, 217, 174), + Rgb(255, 217, 232), + Rgb(255, 255, 255), ], // Palette CYBER [ - Rgb(0, 0, 0), Rgb(0, 0, 126), Rgb(0, 0, 255), Rgb(126, 0, 0), - Rgb(126, 0, 126), Rgb(4, 126, 0), Rgb(254, 0, 0), Rgb(4, 126, 126), - Rgb(254, 0, 255), Rgb(126, 126, 0), Rgb(126, 126, 126), Rgb(6, 255, 4), - Rgb(6, 255, 255), Rgb(190, 190, 190), Rgb(255, 255, 4), Rgb(255, 255, 255), + Rgb(0, 0, 0), + Rgb(0, 0, 126), + Rgb(0, 0, 255), + Rgb(126, 0, 0), + Rgb(126, 0, 126), + Rgb(4, 126, 0), + Rgb(254, 0, 0), + Rgb(4, 126, 126), + Rgb(254, 0, 255), + Rgb(126, 126, 0), + Rgb(126, 126, 126), + Rgb(6, 255, 4), + Rgb(6, 255, 255), + Rgb(190, 190, 190), + Rgb(255, 255, 4), + Rgb(255, 255, 255), ], // Palette Nature [ - Rgb(35, 34, 40), Rgb(40, 66, 97), Rgb(30, 116, 83), Rgb(117, 77, 69), - Rgb(95, 88, 84), Rgb(36, 133, 166), Rgb(198, 80, 70), Rgb(85, 160, 88), - Rgb(135, 133, 115), Rgb(84, 186, 210), Rgb(161, 191, 65), Rgb(230, 146, 138), - Rgb(184, 176, 149), Rgb(227, 192, 84), Rgb(195, 213, 199), Rgb(255, 255, 255), + Rgb(35, 34, 40), + Rgb(40, 66, 97), + Rgb(30, 116, 83), + Rgb(117, 77, 69), + Rgb(95, 88, 84), + Rgb(36, 133, 166), + Rgb(198, 80, 70), + Rgb(85, 160, 88), + Rgb(135, 133, 115), + Rgb(84, 186, 210), + Rgb(161, 191, 65), + Rgb(230, 146, 138), + Rgb(184, 176, 149), + Rgb(227, 192, 84), + Rgb(195, 213, 199), + Rgb(255, 255, 255), ], // Palette Fossil [ - Rgb(75, 61, 68), Rgb(119, 66, 81), Rgb(78, 84, 99), Rgb(100, 83, 85), - Rgb(156, 82, 78), Rgb(132, 109, 89), Rgb(91, 125, 115), Rgb(125, 123, 98), - Rgb(140, 124, 121), Rgb(185, 122, 96), Rgb(168, 138, 94), Rgb(142, 159, 125), - Rgb(170, 162, 93), Rgb(169, 156, 141), Rgb(204, 168, 123), Rgb(255, 255, 255), + Rgb(75, 61, 68), + Rgb(119, 66, 81), + Rgb(78, 84, 99), + Rgb(100, 83, 85), + Rgb(156, 82, 78), + Rgb(132, 109, 89), + Rgb(91, 125, 115), + Rgb(125, 123, 98), + Rgb(140, 124, 121), + Rgb(185, 122, 96), + Rgb(168, 138, 94), + Rgb(142, 159, 125), + Rgb(170, 162, 93), + Rgb(169, 156, 141), + Rgb(204, 168, 123), + Rgb(255, 255, 255), ], // Palette Ghost [ - Rgb(0, 0, 0), Rgb(24, 24, 24), Rgb(40, 40, 40), Rgb(56, 56, 56), - Rgb(71, 71, 71), Rgb(86, 86, 86), Rgb(100, 100, 100), Rgb(113, 113, 113), - Rgb(126, 126, 126), Rgb(140, 140, 140), Rgb(155, 155, 155), Rgb(171, 171, 171), - Rgb(189, 189, 189), Rgb(209, 209, 209), Rgb(231, 231, 231), Rgb(255, 255, 255), + Rgb(0, 0, 0), + Rgb(24, 24, 24), + Rgb(40, 40, 40), + Rgb(56, 56, 56), + Rgb(71, 71, 71), + Rgb(86, 86, 86), + Rgb(100, 100, 100), + Rgb(113, 113, 113), + Rgb(126, 126, 126), + Rgb(140, 140, 140), + Rgb(155, 155, 155), + Rgb(171, 171, 171), + Rgb(189, 189, 189), + Rgb(209, 209, 209), + Rgb(231, 231, 231), + Rgb(255, 255, 255), ], // Palette Daemon [ - Rgb(0, 3, 60), Rgb(96, 0, 136), Rgb(0, 56, 132), Rgb(42, 46, 121), - Rgb(0, 82, 96), Rgb(177, 5, 133), Rgb(255, 0, 78), Rgb(172, 41, 206), - Rgb(0, 157, 74), Rgb(0, 138, 197), Rgb(78, 110, 168), Rgb(255, 92, 255), - Rgb(10, 255, 82), Rgb(0, 247, 255), Rgb(173, 212, 250), Rgb(255, 255, 255), + Rgb(0, 3, 60), + Rgb(96, 0, 136), + Rgb(0, 56, 132), + Rgb(42, 46, 121), + Rgb(0, 82, 96), + Rgb(177, 5, 133), + Rgb(255, 0, 78), + Rgb(172, 41, 206), + Rgb(0, 157, 74), + Rgb(0, 138, 197), + Rgb(78, 110, 168), + Rgb(255, 92, 255), + Rgb(10, 255, 82), + Rgb(0, 247, 255), + Rgb(173, 212, 250), + Rgb(255, 255, 255), ], // Palette Fairy [ - Rgb(40, 40, 46), Rgb(108, 86, 113), Rgb(135, 168, 137), Rgb(249, 130, 132), - Rgb(176, 169, 228), Rgb(222, 163, 139), Rgb(172, 204, 228), Rgb(254, 170, 228), - Rgb(217, 200, 191), Rgb(255, 195, 132), Rgb(176, 235, 147), Rgb(179, 227, 218), - Rgb(233, 245, 157), Rgb(255, 230, 198), Rgb(255, 247, 160), Rgb(255, 255, 255), + Rgb(40, 40, 46), + Rgb(108, 86, 113), + Rgb(135, 168, 137), + Rgb(249, 130, 132), + Rgb(176, 169, 228), + Rgb(222, 163, 139), + Rgb(172, 204, 228), + Rgb(254, 170, 228), + Rgb(217, 200, 191), + Rgb(255, 195, 132), + Rgb(176, 235, 147), + Rgb(179, 227, 218), + Rgb(233, 245, 157), + Rgb(255, 230, 198), + Rgb(255, 247, 160), + Rgb(255, 255, 255), ], ]; const TYPE_STYLES: [TypeStyle; 8] = [ - TypeStyle { name: "Default", primary: Rgb(0xD8, 0x68, 0x30), text: Rgb(0xFF, 0xFF, 0xFF) }, - TypeStyle { name: "Blueprint", primary: Rgb(0x6D, 0x81, 0xFF), text: Rgb(0xFF, 0xFF, 0xFF) }, - TypeStyle { name: "CYBER", primary: Rgb(0xFF, 0xFF, 0x04), text: Rgb(0x00, 0x00, 0x00) }, - TypeStyle { name: "Nature", primary: Rgb(0x55, 0xA0, 0x58), text: Rgb(0xFF, 0xFF, 0xFF) }, - TypeStyle { name: "Fossil", primary: Rgb(0xB9, 0x7A, 0x60), text: Rgb(0xFF, 0xFF, 0xFF) }, - TypeStyle { name: "Ghost", primary: Rgb(0xAB, 0xAB, 0xAB), text: Rgb(0xFF, 0xFF, 0xFF) }, - TypeStyle { name: "Daemon", primary: Rgb(0x60, 0x00, 0x88), text: Rgb(0xFF, 0xFF, 0xFF) }, - TypeStyle { name: "Fairy", primary: Rgb(0xB0, 0xA9, 0xE4), text: Rgb(0xFF, 0xFF, 0xFF) }, + TypeStyle { + name: "Default", + primary: Rgb(0xD8, 0x68, 0x30), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Blueprint", + primary: Rgb(0x6D, 0x81, 0xFF), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "CYBER", + primary: Rgb(0xFF, 0xFF, 0x04), + text: Rgb(0x00, 0x00, 0x00), + }, + TypeStyle { + name: "Nature", + primary: Rgb(0x55, 0xA0, 0x58), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Fossil", + primary: Rgb(0xB9, 0x7A, 0x60), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Ghost", + primary: Rgb(0xAB, 0xAB, 0xAB), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Daemon", + primary: Rgb(0x60, 0x00, 0x88), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Fairy", + primary: Rgb(0xB0, 0xA9, 0xE4), + text: Rgb(0xFF, 0xFF, 0xFF), + }, ]; #[derive(Debug, Clone, Copy)] @@ -216,11 +407,8 @@ fn split_nfc_hex(payload: &[u8]) -> Option> { }) } -fn render_sprite_onto_ili9341( - ili9341: &mut D, - sprite: &[u8], - palette: &[Rgb; 16], -) where +fn render_sprite_onto_ili9341(ili9341: &mut D, sprite: &[u8], palette: &[Rgb; 16]) +where D: DrawTarget, { let pixel_count = sprite.len() * 2; @@ -228,6 +416,12 @@ fn render_sprite_onto_ili9341( return; } + // OPTIMIZATION 1: Pre-compute the 16-color palette to Rgb565 once. + let mut palette565 = [Rgb565::new(0, 0, 0); 16]; + for (i, Rgb(r, g, b)) in palette.iter().enumerate() { + palette565[i] = Rgb565::new(*r >> 3, *g >> 2, *b >> 3); + } + let mut src_width = 1usize; while src_width * src_width < pixel_count { src_width += 1; @@ -243,29 +437,36 @@ fn render_sprite_onto_ili9341( break; } - let byte_index = pixel_index / 2; + // Bitwise operations are slightly faster than division/modulo + let byte_index = pixel_index >> 1; let pixel_byte = sprite[byte_index]; - let color_index = if pixel_index % 2 == 0 { + + let color_index = if pixel_index & 1 == 0 { (pixel_byte >> 4) & 0x0F } else { pixel_byte & 0x0F }; - let Rgb(r, g, b) = palette[color_index as usize]; - let color = Rgb565::new(r >> 3, g >> 2, b >> 3); - let start_x = x * scale; - let start_y = y * scale; - let end_x = core::cmp::min(start_x + scale, target_width); - let end_y = core::cmp::min(start_y + scale, target_width); + let color = palette565[color_index as usize]; - for draw_y in start_y..end_y { - for draw_x in start_x..end_x { - let _ = ili9341.draw_iter(core::iter::once(Pixel( - Point::new(draw_x as i32, draw_y as i32), - color, - ))); - } + let start_x = (x * scale) as i32; + let start_y = (y * scale) as i32; + let end_x = core::cmp::min(start_x + scale as i32, target_width as i32); + let end_y = core::cmp::min(start_y + scale as i32, target_width as i32); + + let width = (end_x - start_x) as u32; + let height = (end_y - start_y) as u32; + + if width == 0 || height == 0 { + continue; } + + // OPTIMIZATION 2: Draw a rectangle block. + // The display driver sets the SPI window ONCE per block. + let rect = Rectangle::new(Point::new(start_x, start_y), Size::new(width, height)); + let style = PrimitiveStyle::with_fill(color); + + let _ = rect.into_styled(style).draw(ili9341); } } } @@ -287,7 +488,6 @@ fn decode_secret(hex: &[u8]) -> alloc::string::String { break; } - // Keep the output readable on the display by excluding control characters. if byte.is_ascii_graphic() || byte == b' ' { ascii_string.push(byte as char); } @@ -298,19 +498,19 @@ fn decode_secret(hex: &[u8]) -> alloc::string::String { fn decode_packed_card_text(bytes: &[u8]) -> (String, String, String, String) { let alphabet = b" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-"; let mut full_text = String::with_capacity((bytes.len() * 8) / 6 + 1); - + let mut accumulator: u32 = 0; let mut bits_in_acc: u32 = 0; - + for &byte in bytes { accumulator |= (byte as u32) << bits_in_acc; bits_in_acc += 8; while bits_in_acc >= 6 { let char_index = (accumulator & 0x3F) as usize; - + full_text.push(alphabet[char_index] as char); - + accumulator >>= 6; bits_in_acc -= 6; } @@ -324,11 +524,10 @@ fn decode_packed_card_text(bytes: &[u8]) -> (String, String, String, String) { (name, trait1, trait2, trait3) } - #[cfg(not(feature = "wokwi"))] async fn setup_wifi( - wifi: esp_hal::peripherals::WIFI<'static>, - flash: esp_hal::peripherals::FLASH<'static>, + wifi: esp_hal::peripherals::WIFI<'static>, + flash: esp_hal::peripherals::FLASH<'static>, spawner: &Spawner, ) { let nvs = esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash).unwrap(); @@ -344,22 +543,15 @@ async fn setup_wifi( wm_settings.wifi_conn_timeout = 30000; wm_settings.esp_reset_timeout = Some(300000); // 5min - let wifi_res = esp_hal_wifimanager::init_wm( - wm_settings, - spawner, - Some(&nvs), - wifi, - None, - ) - .await; + let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; log::info!("wifi_res: {wifi_res:?}"); } #[cfg(feature = "wokwi")] async fn setup_wifi( - wifi: esp_hal::peripherals::WIFI<'static>, - flash: esp_hal::peripherals::FLASH<'static>, + wifi: esp_hal::peripherals::WIFI<'static>, + flash: esp_hal::peripherals::FLASH<'static>, spawner: &Spawner, ) { log::info!("Wokwi mode active: pre-seeding WiFi Manager with Wokwi credentials"); @@ -383,24 +575,17 @@ async fn setup_wifi( log::error!("Failed to store Wokwi WiFi config in NVS: {e:?}"); return; } - + let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); - + // Wokwi simulation uses a default open network called "Wokwi-GUEST" wm_settings.ssid.clear(); _ = core::fmt::write(&mut wm_settings.ssid, format_args!("Wokwi-GUEST")); - + wm_settings.wifi_conn_timeout = 30000; - + // Initialize Wi-Fi connection through WiFi Manager using the pre-seeded NVS data. - let wifi_res = esp_hal_wifimanager::init_wm( - wm_settings, - spawner, - Some(&nvs), - wifi, - None, - ) - .await; + let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; log::info!("Wokwi wifi_res: {wifi_res:?}"); } @@ -413,7 +598,7 @@ async fn setup_wifi( async fn main(spawner: Spawner) { // generator version: 1.3.0 // generator parameters: --chip esp32s3 -o esp32s3-wroom-1-octal-psram -o unstable-hal -o alloc -o wifi -o log -o wokwi -o neovim -o vscode -o esp - + esp_println::logger::init_logger_from_env(); let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max()); @@ -444,12 +629,11 @@ async fn main(spawner: Spawner) { let sw_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0); - let spi_bus = Spi::new( peripherals.SPI2, Config::default() - .with_frequency(Rate::from_khz(100)) + .with_frequency(Rate::from_mhz(40)) .with_mode(Mode::_0), ) .unwrap() @@ -477,6 +661,17 @@ async fn main(spawner: Spawner) { display.clear(Rgb565::BLACK).unwrap(); let nfc_payload: Option> = split_nfc_hex(&MOCK_PAYLOAD); + let simulated_time: u64 = 1780757711176; // Simulated time in milliseconds since epoch (2023-06-05 12:15:11 UTC) + let mut final_payload = [0u8; 867]; + + final_payload[..858].copy_from_slice(&MOCK_PAYLOAD); + final_payload[858..866].copy_from_slice(&simulated_time.to_be_bytes()); + final_payload[866] = 0x00; + + let b64_string = general_purpose::STANDARD.encode(&final_payload); + log::info!("Base64 String:"); + log::info!("{}", b64_string); + if let Some(nfc_payload) = nfc_payload { let (name, trait1, trait2, trait3) = decode_packed_card_text(nfc_payload.packed_card_text); let secret = decode_secret(nfc_payload.secret); @@ -485,15 +680,40 @@ async fn main(spawner: Spawner) { Text::new(&format!("Name: {}", name), Point::new(20, 240), style) .draw(&mut display) .unwrap(); - Text::new(&format!("Type: {}", TYPE_STYLES[(nfc_payload.card_type - 1) as usize].name), Point::new(20, 250), style) - .draw(&mut display) - .unwrap(); - Text::new(&format!("Event: {}", decode_known_event(nfc_payload.event_encoding).unwrap_or("Unknown")), Point::new(20, 260), style) - .draw(&mut display) - .unwrap(); - Text::new(&format!("UUID: {}", nfc_payload.card_uuid.iter().map(|b| format!("{:02X}", b)).collect::()), Point::new(20, 270), style) - .draw(&mut display) - .unwrap(); + Text::new( + &format!( + "Type: {}", + TYPE_STYLES[(nfc_payload.card_type - 1) as usize].name + ), + Point::new(20, 250), + style, + ) + .draw(&mut display) + .unwrap(); + Text::new( + &format!( + "Event: {}", + decode_known_event(nfc_payload.event_encoding).unwrap_or("Unknown") + ), + Point::new(20, 260), + style, + ) + .draw(&mut display) + .unwrap(); + Text::new( + &format!( + "UUID: {}", + nfc_payload + .card_uuid + .iter() + .map(|b| format!("{:02X}", b)) + .collect::() + ), + Point::new(20, 270), + style, + ) + .draw(&mut display) + .unwrap(); Text::new(&format!("Trait1: {}", trait1), Point::new(20, 280), style) .draw(&mut display) .unwrap(); -- 2.39.5 From 61b674a48727214202582a71651169b74e33d032 Mon Sep 17 00:00:00 2001 From: ede1998 Date: Sat, 1 Aug 2026 13:18:47 +0200 Subject: [PATCH 05/12] speed up rendering by factor 1000 --- src/bin/main.rs | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index ef6be69..764e860 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -15,6 +15,9 @@ use base64::{Engine as _, engine::general_purpose}; use display_interface_spi::SPIInterface; use embassy_executor::Spawner; use embassy_time::Timer; +use display_interface_spi::SPIInterface; +use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle}; +use embedded_graphics::Pixel; use embedded_graphics::mono_font::MonoTextStyle; use embedded_graphics::mono_font::ascii::FONT_6X10; use embedded_graphics::pixelcolor::Rgb565; @@ -440,8 +443,7 @@ where // Bitwise operations are slightly faster than division/modulo let byte_index = pixel_index >> 1; let pixel_byte = sprite[byte_index]; - - let color_index = if pixel_index & 1 == 0 { + let color_index = if pixel_index.is_multiple_of(2) { (pixel_byte >> 4) & 0x0F } else { pixel_byte & 0x0F @@ -449,24 +451,13 @@ where let color = palette565[color_index as usize]; - let start_x = (x * scale) as i32; - let start_y = (y * scale) as i32; - let end_x = core::cmp::min(start_x + scale as i32, target_width as i32); - let end_y = core::cmp::min(start_y + scale as i32, target_width as i32); + let width = u32::try_from(end_x - start_x).unwrap(); + let height = u32::try_from(end_y - start_y).unwrap(); - let width = (end_x - start_x) as u32; - let height = (end_y - start_y) as u32; + let area = Rectangle::new(Point::new(start_x.try_into().unwrap(), start_y.try_into().unwrap()), Size::new(width, height)); - if width == 0 || height == 0 { - continue; - } - // OPTIMIZATION 2: Draw a rectangle block. - // The display driver sets the SPI window ONCE per block. - let rect = Rectangle::new(Point::new(start_x, start_y), Size::new(width, height)); - let style = PrimitiveStyle::with_fill(color); - - let _ = rect.into_styled(style).draw(ili9341); + let _ = ili9341.fill_solid(&area, color); } } } @@ -630,10 +621,14 @@ async fn main(spawner: Spawner) { esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0); + + let freq = Rate::from_khz(60_000); + info!("Display freq: {freq}"); + let spi_bus = Spi::new( peripherals.SPI2, Config::default() - .with_frequency(Rate::from_mhz(40)) + .with_frequency(freq) .with_mode(Mode::_0), ) .unwrap() -- 2.39.5 From 65cfa981221a539dd1eaa37029d9db37c4a4f272 Mon Sep 17 00:00:00 2001 From: ede1998 Date: Sat, 1 Aug 2026 13:31:50 +0200 Subject: [PATCH 06/12] fix rebase f****up --- src/bin/main.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index 764e860..cd781fc 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -15,20 +15,13 @@ use base64::{Engine as _, engine::general_purpose}; use display_interface_spi::SPIInterface; use embassy_executor::Spawner; use embassy_time::Timer; -use display_interface_spi::SPIInterface; -use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle}; -use embedded_graphics::Pixel; use embedded_graphics::mono_font::MonoTextStyle; use embedded_graphics::mono_font::ascii::FONT_6X10; use embedded_graphics::pixelcolor::Rgb565; use embedded_graphics::prelude::Point; use embedded_graphics::prelude::RgbColor; use embedded_graphics::text::Text; -use embedded_graphics::{ - Drawable, - prelude::*, - primitives::{PrimitiveStyle, Rectangle}, -}; +use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle}; use embedded_graphics_core::draw_target::DrawTarget; use embedded_hal_bus::spi::ExclusiveDevice; use esp_hal::clock::CpuClock; @@ -451,11 +444,18 @@ where let color = palette565[color_index as usize]; + let start_x = (x * scale) as i32; + let start_y = (y * scale) as i32; + let end_x = core::cmp::min(start_x + scale as i32, target_width as i32); + let end_y = core::cmp::min(start_y + scale as i32, target_width as i32); + let width = u32::try_from(end_x - start_x).unwrap(); let height = u32::try_from(end_y - start_y).unwrap(); - let area = Rectangle::new(Point::new(start_x.try_into().unwrap(), start_y.try_into().unwrap()), Size::new(width, height)); - + let area = Rectangle::new( + Point::new(start_x.try_into().unwrap(), start_y.try_into().unwrap()), + Size::new(width, height), + ); let _ = ili9341.fill_solid(&area, color); } @@ -621,15 +621,12 @@ async fn main(spawner: Spawner) { esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0); - let freq = Rate::from_khz(60_000); info!("Display freq: {freq}"); let spi_bus = Spi::new( peripherals.SPI2, - Config::default() - .with_frequency(freq) - .with_mode(Mode::_0), + Config::default().with_frequency(freq).with_mode(Mode::_0), ) .unwrap() .with_sck(peripherals.GPIO36) -- 2.39.5 From 10dc9b1b832f79f4fb7b0e6c64fc8cfe13558e79 Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 2 Aug 2026 14:04:02 +0200 Subject: [PATCH 07/12] BG Color rendering and button to switch between mock payloads --- .gitignore | 3 + diagram.json | 40 ++++------ src/bin/main.rs | 207 +++++++++++++++++++++++++++++------------------- 3 files changed, 143 insertions(+), 107 deletions(-) diff --git a/.gitignore b/.gitignore index deb0257..5bb3e8f 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ target/ # Ignore .DS_Store file in mac **/.DS_Store + +# Ignore checked out wiki +creaturedex.wiki/ diff --git a/diagram.json b/diagram.json index 04d2356..1dc4954 100644 --- a/diagram.json +++ b/diagram.json @@ -3,31 +3,24 @@ "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, + "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-led", - "id": "led1", - "top": -82.89, - "left": 196.26, - "attrs": { "color": "red" } - }, - { - "type": "wokwi-resistor", - "id": "r1", - "top": 183.86, - "left": 154.06, - "attrs": { "value": "220" } + "type": "wokwi-pushbutton", + "id": "btn1", + "top": 131, + "left": -124.8, + "attrs": { "color": "green", "xray": "1", "key": "1" } } ], - "connections": [ - [ "esp1:TX", "$serialMonitor:RX", "", [] ], + "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" ] ], @@ -39,9 +32,8 @@ [ "esp1:37", "lcd1:MISO", "magenta", [ "h57.6", "v105.6", "h172.8" ] ], [ "esp1:22", "lcd1:SCL", "yellow", [ "h48", "v163.2", "h192" ] ], [ "esp1:21", "lcd1:SDA", "cyan", [ "h38.4", "v144", "h211.2" ] ], - [ "r1:2", "led1:A", "green", [ "h8.4", "v-230.4" ] ], - [ "esp1:GND.2", "led1:C", "black", [ "v0", "h86.4", "v76.8", "h278.4" ] ], - [ "esp1:17", "r1:1", "green", [ "h0" ] ] -], + [ "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 diff --git a/src/bin/main.rs b/src/bin/main.rs index cd781fc..b97d308 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -27,8 +27,8 @@ use embedded_hal_bus::spi::ExclusiveDevice; use esp_hal::clock::CpuClock; use esp_hal::delay::Delay; use esp_hal::gpio::Level; -use esp_hal::gpio::Output; -use esp_hal::gpio::OutputConfig; +use esp_hal::gpio::{Input, Output, Pull}; +use esp_hal::gpio::{InputConfig, OutputConfig}; use esp_hal::spi::{ Mode, master::{Config, Spi}, @@ -169,6 +169,12 @@ const MOCK_PAYLOAD: [u8; 858] = [ #[derive(Debug, Clone, Copy, PartialEq, Eq)] struct Rgb(pub u8, pub u8, pub u8); +impl Rgb { + fn into_rgb565(self) -> Rgb565 { + Rgb565::new(self.0, self.1, self.2) + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq)] struct TypeStyle { pub name: &'static str, @@ -515,6 +521,101 @@ fn decode_packed_card_text(bytes: &[u8]) -> (String, String, String, String) { (name, trait1, trait2, trait3) } +fn render_nfc_payload(display: &mut D, payload: &[u8; 858]) +where + D: DrawTarget, + D::Error: core::fmt::Debug, +{ + let nfc_payload: Option> = split_nfc_hex(payload); + // let simulated_time: u64 = 1780757711176; // Simulated time in milliseconds since epoch (2023-06-05 12:15:11 UTC) + // let mut final_payload = [0u8; 867]; + + // final_payload[..858].copy_from_slice(payload); + // final_payload[858..866].copy_from_slice(&simulated_time.to_be_bytes()); + // final_payload[866] = 0x00; + + // let b64_string = general_purpose::STANDARD.encode(&final_payload); + // log::info!("Base64 String:"); + // log::info!("{}", b64_string); + + if let Some(nfc_payload) = nfc_payload { + let (name, trait1, trait2, trait3) = decode_packed_card_text(nfc_payload.packed_card_text); + let secret = decode_secret(nfc_payload.secret); + + let background = Rectangle::new( + Point::new(0, 0), + Size::new(240, 320), + ); + let bg_color: Rgb565 = TYPE_STYLES[(nfc_payload.card_type - 1) as usize] + .primary + .into_rgb565(); + + let _ = display.fill_solid(&background, bg_color); + + let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE); + Text::new(&format!("Name: {}", name), Point::new(20, 240), style) + .draw(display) + .unwrap(); + Text::new( + &format!( + "Type: {}", + TYPE_STYLES[(nfc_payload.card_type - 1) as usize].name + ), + Point::new(20, 250), + style, + ) + .draw(display) + .unwrap(); + Text::new( + &format!( + "Event: {}", + decode_known_event(nfc_payload.event_encoding).unwrap_or("Unknown") + ), + Point::new(20, 260), + style, + ) + .draw(display) + .unwrap(); + Text::new( + &format!( + "UUID: {}", + nfc_payload + .card_uuid + .iter() + .map(|b| format!("{:02X}", b)) + .collect::() + ), + Point::new(20, 270), + style, + ) + .draw(display) + .unwrap(); + Text::new(&format!("Trait1: {}", trait1), Point::new(20, 280), style) + .draw(display) + .unwrap(); + Text::new(&format!("Trait2: {}", trait2), Point::new(20, 290), style) + .draw(display) + .unwrap(); + Text::new(&format!("Trait3: {}", trait3), Point::new(20, 300), style) + .draw(display) + .unwrap(); + Text::new(&format!("Secret: {}", secret), Point::new(20, 310), style) + .draw(display) + .unwrap(); + + render_sprite_onto_ili9341( + display, + nfc_payload.sprite, + &PALETTES[(nfc_payload.card_type - 1) as usize], + ); + } else { + log::error!( + "NFC payload too short to decode packed text: {} bytes", + payload.len() + ); + } +} + #[cfg(not(feature = "wokwi"))] async fn setup_wifi( wifi: esp_hal::peripherals::WIFI<'static>, @@ -616,6 +717,9 @@ async fn main(spawner: Spawner) { esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 73744); + let button_config = InputConfig::default().with_pull(Pull::Up); + let button1 = Input::new(peripherals.GPIO38, button_config); + let timg0 = TimerGroup::new(peripherals.TIMG0); let sw_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); @@ -652,92 +756,29 @@ async fn main(spawner: Spawner) { display.clear(Rgb565::BLACK).unwrap(); - let nfc_payload: Option> = split_nfc_hex(&MOCK_PAYLOAD); - let simulated_time: u64 = 1780757711176; // Simulated time in milliseconds since epoch (2023-06-05 12:15:11 UTC) - let mut final_payload = [0u8; 867]; + - final_payload[..858].copy_from_slice(&MOCK_PAYLOAD); - final_payload[858..866].copy_from_slice(&simulated_time.to_be_bytes()); - final_payload[866] = 0x00; - - let b64_string = general_purpose::STANDARD.encode(&final_payload); - log::info!("Base64 String:"); - log::info!("{}", b64_string); - - if let Some(nfc_payload) = nfc_payload { - let (name, trait1, trait2, trait3) = decode_packed_card_text(nfc_payload.packed_card_text); - let secret = decode_secret(nfc_payload.secret); - - let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE); - Text::new(&format!("Name: {}", name), Point::new(20, 240), style) - .draw(&mut display) - .unwrap(); - Text::new( - &format!( - "Type: {}", - TYPE_STYLES[(nfc_payload.card_type - 1) as usize].name - ), - Point::new(20, 250), - style, - ) - .draw(&mut display) - .unwrap(); - Text::new( - &format!( - "Event: {}", - decode_known_event(nfc_payload.event_encoding).unwrap_or("Unknown") - ), - Point::new(20, 260), - style, - ) - .draw(&mut display) - .unwrap(); - Text::new( - &format!( - "UUID: {}", - nfc_payload - .card_uuid - .iter() - .map(|b| format!("{:02X}", b)) - .collect::() - ), - Point::new(20, 270), - style, - ) - .draw(&mut display) - .unwrap(); - Text::new(&format!("Trait1: {}", trait1), Point::new(20, 280), style) - .draw(&mut display) - .unwrap(); - Text::new(&format!("Trait2: {}", trait2), Point::new(20, 290), style) - .draw(&mut display) - .unwrap(); - Text::new(&format!("Trait3: {}", trait3), Point::new(20, 300), style) - .draw(&mut display) - .unwrap(); - Text::new(&format!("Secret: {}", secret), Point::new(20, 310), style) - .draw(&mut display) - .unwrap(); - - render_sprite_onto_ili9341( - &mut display, - nfc_payload.sprite, - &PALETTES[(nfc_payload.card_type - 1) as usize], - ); - } else { - log::error!( - "NFC payload too short to decode packed text: {} bytes", - MOCK_PAYLOAD.len() - ); - } - - setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await; + //setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await; log::info!("Setup complete, entering main loop"); + let mut use_first_payload = true; + loop { - info!("Hello world!"); - Timer::after_millis(500).await; + if button1.is_low() { + log::info!("Button pressed!"); + display.clear(Rgb565::BLACK).unwrap(); + let payload = if use_first_payload { + &MOCK_PAYLOAD + } else { + &MOCK_PAYLOAD2 + }; + + render_nfc_payload(&mut display, payload); + use_first_payload = !use_first_payload; + } + // info!("Hello world!"); + Timer::after_millis(10).await; } // for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples -- 2.39.5 From ac2c05868f46e040fa9a09b8cf5f9316b0a295e8 Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 2 Aug 2026 14:40:37 +0200 Subject: [PATCH 08/12] Initial Skeleton setup --- src/card.rs | 3 +++ src/card/decoder.rs | 1 + src/card/mock.rs | 1 + src/card/model.rs | 1 + src/display.rs | 6 ++++++ src/display/palette.rs | 1 + src/display/primary_lcd.rs | 1 + src/display/secondary_oled.rs | 1 + src/display/sprite.rs | 1 + src/display/tertiary_lcd.rs | 1 + src/display/views.rs | 3 +++ src/display/views/card_view.rs | 1 + src/display/views/menu_view.rs | 1 + src/display/views/status_bar.rs | 1 + src/drivers.rs | 1 + src/drivers/nfc_pn532.rs | 1 + src/lib.rs | 7 +++++++ src/navigation.rs | 2 ++ src/navigation/input.rs | 1 + src/navigation/state.rs | 1 + src/network.rs | 2 ++ src/network/api_client.rs | 1 + src/network/wifi.rs | 1 + src/storage.rs | 2 ++ src/storage/dex_db.rs | 1 + src/storage/nvs.rs | 1 + 26 files changed, 44 insertions(+) create mode 100644 src/card.rs create mode 100644 src/card/decoder.rs create mode 100644 src/card/mock.rs create mode 100644 src/card/model.rs create mode 100644 src/display.rs create mode 100644 src/display/palette.rs create mode 100644 src/display/primary_lcd.rs create mode 100644 src/display/secondary_oled.rs create mode 100644 src/display/sprite.rs create mode 100644 src/display/tertiary_lcd.rs create mode 100644 src/display/views.rs create mode 100644 src/display/views/card_view.rs create mode 100644 src/display/views/menu_view.rs create mode 100644 src/display/views/status_bar.rs create mode 100644 src/drivers.rs create mode 100644 src/drivers/nfc_pn532.rs create mode 100644 src/navigation.rs create mode 100644 src/navigation/input.rs create mode 100644 src/navigation/state.rs create mode 100644 src/network.rs create mode 100644 src/network/api_client.rs create mode 100644 src/network/wifi.rs create mode 100644 src/storage.rs create mode 100644 src/storage/dex_db.rs create mode 100644 src/storage/nvs.rs diff --git a/src/card.rs b/src/card.rs new file mode 100644 index 0000000..33363be --- /dev/null +++ b/src/card.rs @@ -0,0 +1,3 @@ +pub mod decoder; +pub mod mock; +pub mod model; diff --git a/src/card/decoder.rs b/src/card/decoder.rs new file mode 100644 index 0000000..d5d29ca --- /dev/null +++ b/src/card/decoder.rs @@ -0,0 +1 @@ +// Card decoder module diff --git a/src/card/mock.rs b/src/card/mock.rs new file mode 100644 index 0000000..464005e --- /dev/null +++ b/src/card/mock.rs @@ -0,0 +1 @@ +// Card mock module diff --git a/src/card/model.rs b/src/card/model.rs new file mode 100644 index 0000000..d27c187 --- /dev/null +++ b/src/card/model.rs @@ -0,0 +1 @@ +// Card model module diff --git a/src/display.rs b/src/display.rs new file mode 100644 index 0000000..8e7dab1 --- /dev/null +++ b/src/display.rs @@ -0,0 +1,6 @@ +pub mod palette; +pub mod primary_lcd; +pub mod secondary_oled; +pub mod sprite; +pub mod tertiary_lcd; +pub mod views; diff --git a/src/display/palette.rs b/src/display/palette.rs new file mode 100644 index 0000000..c645e81 --- /dev/null +++ b/src/display/palette.rs @@ -0,0 +1 @@ +// Display palette module diff --git a/src/display/primary_lcd.rs b/src/display/primary_lcd.rs new file mode 100644 index 0000000..8c0bf35 --- /dev/null +++ b/src/display/primary_lcd.rs @@ -0,0 +1 @@ +// Primary LCD module diff --git a/src/display/secondary_oled.rs b/src/display/secondary_oled.rs new file mode 100644 index 0000000..668cfb6 --- /dev/null +++ b/src/display/secondary_oled.rs @@ -0,0 +1 @@ +// Secondary OLED module diff --git a/src/display/sprite.rs b/src/display/sprite.rs new file mode 100644 index 0000000..c931da1 --- /dev/null +++ b/src/display/sprite.rs @@ -0,0 +1 @@ +// Display sprite module diff --git a/src/display/tertiary_lcd.rs b/src/display/tertiary_lcd.rs new file mode 100644 index 0000000..2255c24 --- /dev/null +++ b/src/display/tertiary_lcd.rs @@ -0,0 +1 @@ +// Tertiary LCD module diff --git a/src/display/views.rs b/src/display/views.rs new file mode 100644 index 0000000..6fdd38d --- /dev/null +++ b/src/display/views.rs @@ -0,0 +1,3 @@ +pub mod card_view; +pub mod menu_view; +pub mod status_bar; diff --git a/src/display/views/card_view.rs b/src/display/views/card_view.rs new file mode 100644 index 0000000..76dfdbd --- /dev/null +++ b/src/display/views/card_view.rs @@ -0,0 +1 @@ +// Card view module diff --git a/src/display/views/menu_view.rs b/src/display/views/menu_view.rs new file mode 100644 index 0000000..dd7ab64 --- /dev/null +++ b/src/display/views/menu_view.rs @@ -0,0 +1 @@ +// Menu view module diff --git a/src/display/views/status_bar.rs b/src/display/views/status_bar.rs new file mode 100644 index 0000000..0233e40 --- /dev/null +++ b/src/display/views/status_bar.rs @@ -0,0 +1 @@ +// Status bar view module diff --git a/src/drivers.rs b/src/drivers.rs new file mode 100644 index 0000000..0becd6c --- /dev/null +++ b/src/drivers.rs @@ -0,0 +1 @@ +pub mod nfc_pn532; diff --git a/src/drivers/nfc_pn532.rs b/src/drivers/nfc_pn532.rs new file mode 100644 index 0000000..36d4478 --- /dev/null +++ b/src/drivers/nfc_pn532.rs @@ -0,0 +1 @@ +// Drivers nfc_pn532 module diff --git a/src/lib.rs b/src/lib.rs index 0c9ac1a..701e7ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,8 @@ #![no_std] + +pub mod card; +pub mod display; +pub mod drivers; +pub mod navigation; +pub mod network; +pub mod storage; diff --git a/src/navigation.rs b/src/navigation.rs new file mode 100644 index 0000000..6856496 --- /dev/null +++ b/src/navigation.rs @@ -0,0 +1,2 @@ +pub mod input; +pub mod state; diff --git a/src/navigation/input.rs b/src/navigation/input.rs new file mode 100644 index 0000000..5320702 --- /dev/null +++ b/src/navigation/input.rs @@ -0,0 +1 @@ +// Navigation input module diff --git a/src/navigation/state.rs b/src/navigation/state.rs new file mode 100644 index 0000000..b0feb62 --- /dev/null +++ b/src/navigation/state.rs @@ -0,0 +1 @@ +// Navigation state module diff --git a/src/network.rs b/src/network.rs new file mode 100644 index 0000000..edb57fb --- /dev/null +++ b/src/network.rs @@ -0,0 +1,2 @@ +pub mod api_client; +pub mod wifi; diff --git a/src/network/api_client.rs b/src/network/api_client.rs new file mode 100644 index 0000000..6bc2a02 --- /dev/null +++ b/src/network/api_client.rs @@ -0,0 +1 @@ +// Network api_client module diff --git a/src/network/wifi.rs b/src/network/wifi.rs new file mode 100644 index 0000000..03cf1c8 --- /dev/null +++ b/src/network/wifi.rs @@ -0,0 +1 @@ +// Network wifi module diff --git a/src/storage.rs b/src/storage.rs new file mode 100644 index 0000000..4d0325f --- /dev/null +++ b/src/storage.rs @@ -0,0 +1,2 @@ +pub mod dex_db; +pub mod nvs; diff --git a/src/storage/dex_db.rs b/src/storage/dex_db.rs new file mode 100644 index 0000000..acd61ed --- /dev/null +++ b/src/storage/dex_db.rs @@ -0,0 +1 @@ +// Storage dex_db module diff --git a/src/storage/nvs.rs b/src/storage/nvs.rs new file mode 100644 index 0000000..5c63f41 --- /dev/null +++ b/src/storage/nvs.rs @@ -0,0 +1 @@ +// Storage nvs module -- 2.39.5 From 07f26b6568f8208b1108ac6fcf04af49baee066e Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 2 Aug 2026 14:42:30 +0200 Subject: [PATCH 09/12] Moved mocked NFC payloads into dedicated file --- src/bin/main.rs | 114 +--------------------------------------------- src/card/mock.rs | 116 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 116 insertions(+), 114 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index b97d308..cf30ac9 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -12,6 +12,7 @@ use alloc::{ string::{String, ToString}, }; use base64::{Engine as _, engine::general_purpose}; +use creaturedex::card::mock::{MOCK_PAYLOAD, MOCK_PAYLOAD2}; use display_interface_spi::SPIInterface; use embassy_executor::Spawner; use embassy_time::Timer; @@ -51,120 +52,7 @@ extern crate alloc; // For more information see: esp_bootloader_esp_idf::esp_app_desc!(); -// The mock payload acting as our simulated NFC card read -const MOCK_PAYLOAD2: [u8; 858] = [ - 0xE9, 0x24, 0x03, 0xDA, 0x45, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, 0xA0, 0xF0, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, 0xA0, 0xF0, 0xAA, 0x0F, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xAA, 0xAA, 0x00, 0xAA, - 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, - 0xAA, 0x0A, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF0, 0xAA, 0xAA, 0xAA, 0x0A, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xF0,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xDB, 0xE8, 0x88, 0x7A, 0x7E, 0xB2, 0x40, 0x10, 0xA2, 0xDF, 0xC0, 0x89, - 0x03, 0x63, 0x8F, 0x4C, 0x2F, 0xBA, 0xCC, 0x17, 0x23, 0x51, 0x60, 0x27, 0x3B, 0x00, 0x1C, 0x6D, - 0x1F, 0x8C, 0x6B, 0x3E, 0x32, 0xE2, 0x53, 0xD9, 0x8F, 0x00, -]; #[derive(Debug, Clone, Copy, PartialEq, Eq)] struct Rgb(pub u8, pub u8, pub u8); diff --git a/src/card/mock.rs b/src/card/mock.rs index 464005e..92451f0 100644 --- a/src/card/mock.rs +++ b/src/card/mock.rs @@ -1 +1,115 @@ -// Card mock module +/// Mock payload 2 acting as simulated NFC card read +pub const MOCK_PAYLOAD2: [u8; 858] = [ + 0xE9, 0x24, 0x03, 0xDA, 0x45, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, 0xA0, 0xF0, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, 0xA0, 0xF0, 0xAA, 0x0F, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xAA, 0xAA, 0x00, 0xAA, + 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0xAA, + 0xAA, 0x0A, 0xAA, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0xAA, 0xAA, 0xAA, 0x0A, 0xAA, 0x0F, 0x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, 0x20, 0x63, 0x61, 0x6B, 0x65, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x6C, + 0x69, 0x65, 0x20, 0xF0, 0x9F, 0x8E, 0x82, 0x00, 0x00, 0x87, 0xF7, 0xB1, 0x44, 0xB0, 0x55, 0x5E, + 0xF9, 0x22, 0xD6, 0x71, 0x45, 0xE9, 0xD5, 0xA7, 0xF8, 0x0F, 0xBE, 0x8F, 0xF6, 0xB9, 0x77, 0x62, + 0x13, 0xF3, 0x84, 0x55, 0xD2, 0xBC, 0x4E, 0xCB, 0xDF, 0xDB, 0xC0, 0x91, 0x5F, 0x39, 0xE0, 0xF5, + 0x95, 0x2D, 0x14, 0xBD, 0x43, 0xB2, 0x40, 0x76, 0x78, 0x00, +]; + +/// Mock payload 1 acting as simulated NFC card read +pub const MOCK_PAYLOAD: [u8; 858] = [ + 0xE9, 0x24, 0x01, 0x47, 0xF2, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x77, 0x77, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x77, 0x77, 0x77, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x77, 0x77, 0x77, 0x77, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF7, 0x77, 0x77, 0x77, + 0x77, 0x77, 0xFF, 0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0x20, 0x69, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x23, 0xC0, 0xD6, 0x5A, 0x9D, 0xA2, 0xAB, + 0xC4, 0x80, 0xC3, 0x06, 0xDB, 0xE8, 0x88, 0x7A, 0x7E, 0xB2, 0x40, 0x10, 0xA2, 0xDF, 0xC0, 0x89, + 0x03, 0x63, 0x8F, 0x4C, 0x2F, 0xBA, 0xCC, 0x17, 0x23, 0x51, 0x60, 0x27, 0x3B, 0x00, 0x1C, 0x6D, + 0x1F, 0x8C, 0x6B, 0x3E, 0x32, 0xE2, 0x53, 0xD9, 0x8F, 0x00, +]; -- 2.39.5 From f2a2bf7d5f25a8ba2c34f3090779456e8ba2237f Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 2 Aug 2026 14:44:29 +0200 Subject: [PATCH 10/12] Moved color palettes into dedicated file --- src/bin/main.rs | 213 +--------------------------------------- src/display/palette.rs | 216 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 216 insertions(+), 213 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index cf30ac9..c118785 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -13,6 +13,7 @@ use alloc::{ }; use base64::{Engine as _, engine::general_purpose}; use creaturedex::card::mock::{MOCK_PAYLOAD, MOCK_PAYLOAD2}; +use creaturedex::display::palette::{PALETTES, Rgb, TYPE_STYLES}; use display_interface_spi::SPIInterface; use embassy_executor::Spawner; use embassy_time::Timer; @@ -54,219 +55,7 @@ esp_bootloader_esp_idf::esp_app_desc!(); -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -struct Rgb(pub u8, pub u8, pub u8); -impl Rgb { - fn into_rgb565(self) -> Rgb565 { - Rgb565::new(self.0, self.1, self.2) - } -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -struct TypeStyle { - pub name: &'static str, - pub primary: Rgb, - pub text: Rgb, -} - -const PALETTES: [[Rgb; 16]; 8] = [ - // Palette Default - [ - Rgb(31, 23, 35), - Rgb(60, 47, 82), - Rgb(178, 39, 65), - Rgb(70, 86, 165), - Rgb(245, 70, 76), - Rgb(216, 104, 48), - Rgb(140, 127, 144), - Rgb(73, 149, 243), - Rgb(62, 197, 75), - Rgb(240, 149, 72), - Rgb(188, 176, 179), - Rgb(247, 156, 136), - Rgb(114, 222, 235), - Rgb(180, 230, 86), - Rgb(239, 208, 129), - Rgb(255, 255, 255), - ], - // Palette Blueprint - [ - Rgb(83, 67, 127), - Rgb(44, 111, 153), - Rgb(142, 88, 111), - Rgb(0, 188, 170), - Rgb(153, 104, 226), - Rgb(109, 129, 255), - Rgb(255, 84, 112), - Rgb(196, 143, 158), - Rgb(168, 159, 204), - Rgb(190, 155, 255), - Rgb(255, 155, 113), - Rgb(127, 206, 255), - Rgb(255, 155, 182), - Rgb(255, 217, 174), - Rgb(255, 217, 232), - Rgb(255, 255, 255), - ], - // Palette CYBER - [ - Rgb(0, 0, 0), - Rgb(0, 0, 126), - Rgb(0, 0, 255), - Rgb(126, 0, 0), - Rgb(126, 0, 126), - Rgb(4, 126, 0), - Rgb(254, 0, 0), - Rgb(4, 126, 126), - Rgb(254, 0, 255), - Rgb(126, 126, 0), - Rgb(126, 126, 126), - Rgb(6, 255, 4), - Rgb(6, 255, 255), - Rgb(190, 190, 190), - Rgb(255, 255, 4), - Rgb(255, 255, 255), - ], - // Palette Nature - [ - Rgb(35, 34, 40), - Rgb(40, 66, 97), - Rgb(30, 116, 83), - Rgb(117, 77, 69), - Rgb(95, 88, 84), - Rgb(36, 133, 166), - Rgb(198, 80, 70), - Rgb(85, 160, 88), - Rgb(135, 133, 115), - Rgb(84, 186, 210), - Rgb(161, 191, 65), - Rgb(230, 146, 138), - Rgb(184, 176, 149), - Rgb(227, 192, 84), - Rgb(195, 213, 199), - Rgb(255, 255, 255), - ], - // Palette Fossil - [ - Rgb(75, 61, 68), - Rgb(119, 66, 81), - Rgb(78, 84, 99), - Rgb(100, 83, 85), - Rgb(156, 82, 78), - Rgb(132, 109, 89), - Rgb(91, 125, 115), - Rgb(125, 123, 98), - Rgb(140, 124, 121), - Rgb(185, 122, 96), - Rgb(168, 138, 94), - Rgb(142, 159, 125), - Rgb(170, 162, 93), - Rgb(169, 156, 141), - Rgb(204, 168, 123), - Rgb(255, 255, 255), - ], - // Palette Ghost - [ - Rgb(0, 0, 0), - Rgb(24, 24, 24), - Rgb(40, 40, 40), - Rgb(56, 56, 56), - Rgb(71, 71, 71), - Rgb(86, 86, 86), - Rgb(100, 100, 100), - Rgb(113, 113, 113), - Rgb(126, 126, 126), - Rgb(140, 140, 140), - Rgb(155, 155, 155), - Rgb(171, 171, 171), - Rgb(189, 189, 189), - Rgb(209, 209, 209), - Rgb(231, 231, 231), - Rgb(255, 255, 255), - ], - // Palette Daemon - [ - Rgb(0, 3, 60), - Rgb(96, 0, 136), - Rgb(0, 56, 132), - Rgb(42, 46, 121), - Rgb(0, 82, 96), - Rgb(177, 5, 133), - Rgb(255, 0, 78), - Rgb(172, 41, 206), - Rgb(0, 157, 74), - Rgb(0, 138, 197), - Rgb(78, 110, 168), - Rgb(255, 92, 255), - Rgb(10, 255, 82), - Rgb(0, 247, 255), - Rgb(173, 212, 250), - Rgb(255, 255, 255), - ], - // Palette Fairy - [ - Rgb(40, 40, 46), - Rgb(108, 86, 113), - Rgb(135, 168, 137), - Rgb(249, 130, 132), - Rgb(176, 169, 228), - Rgb(222, 163, 139), - Rgb(172, 204, 228), - Rgb(254, 170, 228), - Rgb(217, 200, 191), - Rgb(255, 195, 132), - Rgb(176, 235, 147), - Rgb(179, 227, 218), - Rgb(233, 245, 157), - Rgb(255, 230, 198), - Rgb(255, 247, 160), - Rgb(255, 255, 255), - ], -]; - -const TYPE_STYLES: [TypeStyle; 8] = [ - TypeStyle { - name: "Default", - primary: Rgb(0xD8, 0x68, 0x30), - text: Rgb(0xFF, 0xFF, 0xFF), - }, - TypeStyle { - name: "Blueprint", - primary: Rgb(0x6D, 0x81, 0xFF), - text: Rgb(0xFF, 0xFF, 0xFF), - }, - TypeStyle { - name: "CYBER", - primary: Rgb(0xFF, 0xFF, 0x04), - text: Rgb(0x00, 0x00, 0x00), - }, - TypeStyle { - name: "Nature", - primary: Rgb(0x55, 0xA0, 0x58), - text: Rgb(0xFF, 0xFF, 0xFF), - }, - TypeStyle { - name: "Fossil", - primary: Rgb(0xB9, 0x7A, 0x60), - text: Rgb(0xFF, 0xFF, 0xFF), - }, - TypeStyle { - name: "Ghost", - primary: Rgb(0xAB, 0xAB, 0xAB), - text: Rgb(0xFF, 0xFF, 0xFF), - }, - TypeStyle { - name: "Daemon", - primary: Rgb(0x60, 0x00, 0x88), - text: Rgb(0xFF, 0xFF, 0xFF), - }, - TypeStyle { - name: "Fairy", - primary: Rgb(0xB0, 0xA9, 0xE4), - text: Rgb(0xFF, 0xFF, 0xFF), - }, -]; #[derive(Debug, Clone, Copy)] struct NfcPayload<'a> { diff --git a/src/display/palette.rs b/src/display/palette.rs index c645e81..b79330b 100644 --- a/src/display/palette.rs +++ b/src/display/palette.rs @@ -1 +1,215 @@ -// Display palette module +use embedded_graphics::pixelcolor::Rgb565; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Rgb(pub u8, pub u8, pub u8); + +impl Rgb { + pub fn into_rgb565(self) -> Rgb565 { + Rgb565::new(self.0, self.1, self.2) + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct TypeStyle { + pub name: &'static str, + pub primary: Rgb, + pub text: Rgb, +} + +pub const PALETTES: [[Rgb; 16]; 8] = [ + // Palette Default + [ + Rgb(31, 23, 35), + Rgb(60, 47, 82), + Rgb(178, 39, 65), + Rgb(70, 86, 165), + Rgb(245, 70, 76), + Rgb(216, 104, 48), + Rgb(140, 127, 144), + Rgb(73, 149, 243), + Rgb(62, 197, 75), + Rgb(240, 149, 72), + Rgb(188, 176, 179), + Rgb(247, 156, 136), + Rgb(114, 222, 235), + Rgb(180, 230, 86), + Rgb(239, 208, 129), + Rgb(255, 255, 255), + ], + // Palette Blueprint + [ + Rgb(83, 67, 127), + Rgb(44, 111, 153), + Rgb(142, 88, 111), + Rgb(0, 188, 170), + Rgb(153, 104, 226), + Rgb(109, 129, 255), + Rgb(255, 84, 112), + Rgb(196, 143, 158), + Rgb(168, 159, 204), + Rgb(190, 155, 255), + Rgb(255, 155, 113), + Rgb(127, 206, 255), + Rgb(255, 155, 182), + Rgb(255, 217, 174), + Rgb(255, 217, 232), + Rgb(255, 255, 255), + ], + // Palette CYBER + [ + Rgb(0, 0, 0), + Rgb(0, 0, 126), + Rgb(0, 0, 255), + Rgb(126, 0, 0), + Rgb(126, 0, 126), + Rgb(4, 126, 0), + Rgb(254, 0, 0), + Rgb(4, 126, 126), + Rgb(254, 0, 255), + Rgb(126, 126, 0), + Rgb(126, 126, 126), + Rgb(6, 255, 4), + Rgb(6, 255, 255), + Rgb(190, 190, 190), + Rgb(255, 255, 4), + Rgb(255, 255, 255), + ], + // Palette Nature + [ + Rgb(35, 34, 40), + Rgb(40, 66, 97), + Rgb(30, 116, 83), + Rgb(117, 77, 69), + Rgb(95, 88, 84), + Rgb(36, 133, 166), + Rgb(198, 80, 70), + Rgb(85, 160, 88), + Rgb(135, 133, 115), + Rgb(84, 186, 210), + Rgb(161, 191, 65), + Rgb(230, 146, 138), + Rgb(184, 176, 149), + Rgb(227, 192, 84), + Rgb(195, 213, 199), + Rgb(255, 255, 255), + ], + // Palette Fossil + [ + Rgb(75, 61, 68), + Rgb(119, 66, 81), + Rgb(78, 84, 99), + Rgb(100, 83, 85), + Rgb(156, 82, 78), + Rgb(132, 109, 89), + Rgb(91, 125, 115), + Rgb(125, 123, 98), + Rgb(140, 124, 121), + Rgb(185, 122, 96), + Rgb(168, 138, 94), + Rgb(142, 159, 125), + Rgb(170, 162, 93), + Rgb(169, 156, 141), + Rgb(204, 168, 123), + Rgb(255, 255, 255), + ], + // Palette Ghost + [ + Rgb(0, 0, 0), + Rgb(24, 24, 24), + Rgb(40, 40, 40), + Rgb(56, 56, 56), + Rgb(71, 71, 71), + Rgb(86, 86, 86), + Rgb(100, 100, 100), + Rgb(113, 113, 113), + Rgb(126, 126, 126), + Rgb(140, 140, 140), + Rgb(155, 155, 155), + Rgb(171, 171, 171), + Rgb(189, 189, 189), + Rgb(209, 209, 209), + Rgb(231, 231, 231), + Rgb(255, 255, 255), + ], + // Palette Daemon + [ + Rgb(0, 3, 60), + Rgb(96, 0, 136), + Rgb(0, 56, 132), + Rgb(42, 46, 121), + Rgb(0, 82, 96), + Rgb(177, 5, 133), + Rgb(255, 0, 78), + Rgb(172, 41, 206), + Rgb(0, 157, 74), + Rgb(0, 138, 197), + Rgb(78, 110, 168), + Rgb(255, 92, 255), + Rgb(10, 255, 82), + Rgb(0, 247, 255), + Rgb(173, 212, 250), + Rgb(255, 255, 255), + ], + // Palette Fairy + [ + Rgb(40, 40, 46), + Rgb(108, 86, 113), + Rgb(135, 168, 137), + Rgb(249, 130, 132), + Rgb(176, 169, 228), + Rgb(222, 163, 139), + Rgb(172, 204, 228), + Rgb(254, 170, 228), + Rgb(217, 200, 191), + Rgb(255, 195, 132), + Rgb(176, 235, 147), + Rgb(179, 227, 218), + Rgb(233, 245, 157), + Rgb(255, 230, 198), + Rgb(255, 247, 160), + Rgb(255, 255, 255), + ], +]; + +pub const TYPE_STYLES: [TypeStyle; 8] = [ + TypeStyle { + name: "Default", + primary: Rgb(0xD8, 0x68, 0x30), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Blueprint", + primary: Rgb(0x6D, 0x81, 0xFF), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "CYBER", + primary: Rgb(0xFF, 0xFF, 0x04), + text: Rgb(0x00, 0x00, 0x00), + }, + TypeStyle { + name: "Nature", + primary: Rgb(0x55, 0xA0, 0x58), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Fossil", + primary: Rgb(0xB9, 0x7A, 0x60), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Ghost", + primary: Rgb(0xAB, 0xAB, 0xAB), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Daemon", + primary: Rgb(0x60, 0x00, 0x88), + text: Rgb(0xFF, 0xFF, 0xFF), + }, + TypeStyle { + name: "Fairy", + primary: Rgb(0xB0, 0xA9, 0xE4), + text: Rgb(0xFF, 0xFF, 0xFF), + }, +]; -- 2.39.5 From e28749190677129050a89a82fb16664ca23b8574 Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 2 Aug 2026 14:52:37 +0200 Subject: [PATCH 11/12] Moved nfc and wifi into dedicated file --- src/bin/main.rs | 323 +-------------------------------- src/card/decoder.rs | 73 +++++++- src/card/model.rs | 12 +- src/display/sprite.rs | 63 ++++++- src/display/views/card_view.rs | 99 +++++++++- src/lib.rs | 2 + src/network/wifi.rs | 68 ++++++- 7 files changed, 316 insertions(+), 324 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index c118785..8467582 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -7,24 +7,15 @@ )] #![deny(clippy::large_stack_frames)] -use alloc::{ - format, - string::{String, ToString}, -}; -use base64::{Engine as _, engine::general_purpose}; use creaturedex::card::mock::{MOCK_PAYLOAD, MOCK_PAYLOAD2}; -use creaturedex::display::palette::{PALETTES, Rgb, TYPE_STYLES}; +use creaturedex::display::views::card_view::render_nfc_payload; +use creaturedex::network::wifi::setup_wifi; +use embedded_graphics::draw_target::DrawTarget; use display_interface_spi::SPIInterface; use embassy_executor::Spawner; use embassy_time::Timer; -use embedded_graphics::mono_font::MonoTextStyle; -use embedded_graphics::mono_font::ascii::FONT_6X10; use embedded_graphics::pixelcolor::Rgb565; -use embedded_graphics::prelude::Point; use embedded_graphics::prelude::RgbColor; -use embedded_graphics::text::Text; -use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle}; -use embedded_graphics_core::draw_target::DrawTarget; use embedded_hal_bus::spi::ExclusiveDevice; use esp_hal::clock::CpuClock; use esp_hal::delay::Delay; @@ -53,312 +44,6 @@ extern crate alloc; // For more information see: esp_bootloader_esp_idf::esp_app_desc!(); - - - - -#[derive(Debug, Clone, Copy)] -struct NfcPayload<'a> { - pub event_encoding: &'a [u8], - pub card_type: u8, - pub card_uuid: &'a [u8], - pub _reserved: &'a [u8], - pub sprite: &'a [u8], - pub packed_card_text: &'a [u8], - pub secret: &'a [u8], - pub _opaque_trailer: &'a [u8], -} - -fn split_nfc_hex(payload: &[u8]) -> Option> { - if payload.len() < 0x35A { - return None; - } - - Some(NfcPayload { - event_encoding: &payload[0..2], - card_type: payload[2], - card_uuid: &payload[3..5], - _reserved: &payload[5..9], - sprite: &payload[9..0x2DB], - packed_card_text: &payload[0x2DB..0x311], - secret: &payload[0x311..0x329], - _opaque_trailer: &payload[0x329..0x35A], - }) -} - -fn render_sprite_onto_ili9341(ili9341: &mut D, sprite: &[u8], palette: &[Rgb; 16]) -where - D: DrawTarget, -{ - let pixel_count = sprite.len() * 2; - if pixel_count == 0 { - return; - } - - // OPTIMIZATION 1: Pre-compute the 16-color palette to Rgb565 once. - let mut palette565 = [Rgb565::new(0, 0, 0); 16]; - for (i, Rgb(r, g, b)) in palette.iter().enumerate() { - palette565[i] = Rgb565::new(*r >> 3, *g >> 2, *b >> 3); - } - - let mut src_width = 1usize; - while src_width * src_width < pixel_count { - src_width += 1; - } - - let target_width = 240usize; - let scale = core::cmp::max(1, target_width / src_width); - - for y in 0..src_width { - for x in 0..src_width { - let pixel_index = y * src_width + x; - if pixel_index >= pixel_count { - break; - } - - // Bitwise operations are slightly faster than division/modulo - let byte_index = pixel_index >> 1; - let pixel_byte = sprite[byte_index]; - let color_index = if pixel_index.is_multiple_of(2) { - (pixel_byte >> 4) & 0x0F - } else { - pixel_byte & 0x0F - }; - - let color = palette565[color_index as usize]; - - let start_x = (x * scale) as i32; - let start_y = (y * scale) as i32; - let end_x = core::cmp::min(start_x + scale as i32, target_width as i32); - let end_y = core::cmp::min(start_y + scale as i32, target_width as i32); - - let width = u32::try_from(end_x - start_x).unwrap(); - let height = u32::try_from(end_y - start_y).unwrap(); - - let area = Rectangle::new( - Point::new(start_x.try_into().unwrap(), start_y.try_into().unwrap()), - Size::new(width, height), - ); - - let _ = ili9341.fill_solid(&area, color); - } - } -} - -fn decode_known_event(event_encoding: &[u8]) -> Option<&'static str> { - match event_encoding { - [0x39, 0xC3] => Some("39C3"), - [0x40, 0xC3] => Some("40C3"), // future proofing :) - [0xE9, 0x24] => Some("GPN 24"), - [0xE9, 0x25] => Some("GPN 25"), // future proofing :) - _ => None, - } -} - -fn decode_secret(hex: &[u8]) -> alloc::string::String { - let mut ascii_string = alloc::string::String::new(); - for &byte in hex { - if byte == 0 { - break; - } - - if byte.is_ascii_graphic() || byte == b' ' { - ascii_string.push(byte as char); - } - } - ascii_string -} - -fn decode_packed_card_text(bytes: &[u8]) -> (String, String, String, String) { - let alphabet = b" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-"; - let mut full_text = String::with_capacity((bytes.len() * 8) / 6 + 1); - - let mut accumulator: u32 = 0; - let mut bits_in_acc: u32 = 0; - - for &byte in bytes { - accumulator |= (byte as u32) << bits_in_acc; - bits_in_acc += 8; - - while bits_in_acc >= 6 { - let char_index = (accumulator & 0x3F) as usize; - - full_text.push(alphabet[char_index] as char); - - accumulator >>= 6; - bits_in_acc -= 6; - } - } - - let name = full_text[0..24].trim().to_string(); - let trait1 = full_text[24..40].trim().to_string(); - let trait2 = full_text[40..56].trim().to_string(); - let trait3 = full_text[56..72].trim().to_string(); - - (name, trait1, trait2, trait3) -} - -fn render_nfc_payload(display: &mut D, payload: &[u8; 858]) -where - D: DrawTarget, - D::Error: core::fmt::Debug, -{ - let nfc_payload: Option> = split_nfc_hex(payload); - // let simulated_time: u64 = 1780757711176; // Simulated time in milliseconds since epoch (2023-06-05 12:15:11 UTC) - // let mut final_payload = [0u8; 867]; - - // final_payload[..858].copy_from_slice(payload); - // final_payload[858..866].copy_from_slice(&simulated_time.to_be_bytes()); - // final_payload[866] = 0x00; - - // let b64_string = general_purpose::STANDARD.encode(&final_payload); - // log::info!("Base64 String:"); - // log::info!("{}", b64_string); - - if let Some(nfc_payload) = nfc_payload { - let (name, trait1, trait2, trait3) = decode_packed_card_text(nfc_payload.packed_card_text); - let secret = decode_secret(nfc_payload.secret); - - let background = Rectangle::new( - Point::new(0, 0), - Size::new(240, 320), - ); - let bg_color: Rgb565 = TYPE_STYLES[(nfc_payload.card_type - 1) as usize] - .primary - .into_rgb565(); - - let _ = display.fill_solid(&background, bg_color); - - let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE); - Text::new(&format!("Name: {}", name), Point::new(20, 240), style) - .draw(display) - .unwrap(); - Text::new( - &format!( - "Type: {}", - TYPE_STYLES[(nfc_payload.card_type - 1) as usize].name - ), - Point::new(20, 250), - style, - ) - .draw(display) - .unwrap(); - Text::new( - &format!( - "Event: {}", - decode_known_event(nfc_payload.event_encoding).unwrap_or("Unknown") - ), - Point::new(20, 260), - style, - ) - .draw(display) - .unwrap(); - Text::new( - &format!( - "UUID: {}", - nfc_payload - .card_uuid - .iter() - .map(|b| format!("{:02X}", b)) - .collect::() - ), - Point::new(20, 270), - style, - ) - .draw(display) - .unwrap(); - Text::new(&format!("Trait1: {}", trait1), Point::new(20, 280), style) - .draw(display) - .unwrap(); - Text::new(&format!("Trait2: {}", trait2), Point::new(20, 290), style) - .draw(display) - .unwrap(); - Text::new(&format!("Trait3: {}", trait3), Point::new(20, 300), style) - .draw(display) - .unwrap(); - Text::new(&format!("Secret: {}", secret), Point::new(20, 310), style) - .draw(display) - .unwrap(); - - render_sprite_onto_ili9341( - display, - nfc_payload.sprite, - &PALETTES[(nfc_payload.card_type - 1) as usize], - ); - } else { - log::error!( - "NFC payload too short to decode packed text: {} bytes", - payload.len() - ); - } -} - -#[cfg(not(feature = "wokwi"))] -async fn setup_wifi( - wifi: esp_hal::peripherals::WIFI<'static>, - flash: esp_hal::peripherals::FLASH<'static>, - spawner: &Spawner, -) { - let nvs = esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash).unwrap(); - - let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); - - wm_settings.ssid.clear(); - _ = core::fmt::write( - &mut wm_settings.ssid, - format_args!("CreatureDex-{:X}", esp_hal_wifimanager::get_efuse_mac()), - ); - - wm_settings.wifi_conn_timeout = 30000; - wm_settings.esp_reset_timeout = Some(300000); // 5min - - let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; - - log::info!("wifi_res: {wifi_res:?}"); -} - -#[cfg(feature = "wokwi")] -async fn setup_wifi( - wifi: esp_hal::peripherals::WIFI<'static>, - flash: esp_hal::peripherals::FLASH<'static>, - spawner: &Spawner, -) { - log::info!("Wokwi mode active: pre-seeding WiFi Manager with Wokwi credentials"); - - // Preload connection data so init_wm can connect immediately without AP setup. - let nvs = match esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash) { - Ok(nvs) => nvs, - Err(e) => { - log::error!("Failed to initialize NVS for Wokwi: {e:?}"); - return; - } - }; - - if let Err(e) = nvs - .set( - esp_hal_wifimanager::WIFI_NVS_KEY, - "{\"ssid\":\"Wokwi-GUEST\",\"psk\":\"\",\"data\":{}}", - ) - .await - { - log::error!("Failed to store Wokwi WiFi config in NVS: {e:?}"); - return; - } - - let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); - - // Wokwi simulation uses a default open network called "Wokwi-GUEST" - wm_settings.ssid.clear(); - _ = core::fmt::write(&mut wm_settings.ssid, format_args!("Wokwi-GUEST")); - - wm_settings.wifi_conn_timeout = 30000; - - // Initialize Wi-Fi connection through WiFi Manager using the pre-seeded NVS data. - let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; - - log::info!("Wokwi wifi_res: {wifi_res:?}"); -} - #[allow( clippy::large_stack_frames, reason = "it's not unusual to allocate larger buffers etc. in main" @@ -435,7 +120,7 @@ async fn main(spawner: Spawner) { - //setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await; + // setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await; log::info!("Setup complete, entering main loop"); diff --git a/src/card/decoder.rs b/src/card/decoder.rs index d5d29ca..9c865e8 100644 --- a/src/card/decoder.rs +++ b/src/card/decoder.rs @@ -1 +1,72 @@ -// Card decoder module +use alloc::string::{String, ToString}; +use crate::card::model::NfcPayload; + +pub fn split_nfc_hex(payload: &[u8]) -> Option> { + if payload.len() < 0x35A { + return None; + } + + Some(NfcPayload { + event_encoding: &payload[0..2], + card_type: payload[2], + card_uuid: &payload[3..5], + _reserved: &payload[5..9], + sprite: &payload[9..0x2DB], + packed_card_text: &payload[0x2DB..0x311], + secret: &payload[0x311..0x329], + _opaque_trailer: &payload[0x329..0x35A], + }) +} + +pub fn decode_known_event(event_encoding: &[u8]) -> Option<&'static str> { + match event_encoding { + [0x39, 0xC3] => Some("39C3"), + [0x40, 0xC3] => Some("40C3"), // future proofing :) + [0xE9, 0x24] => Some("GPN 24"), + [0xE9, 0x25] => Some("GPN 25"), // future proofing :) + _ => None, + } +} + +pub fn decode_secret(hex: &[u8]) -> String { + let mut ascii_string = String::new(); + for &byte in hex { + if byte == 0 { + break; + } + + if byte.is_ascii_graphic() || byte == b' ' { + ascii_string.push(byte as char); + } + } + ascii_string +} + +pub fn decode_packed_card_text(bytes: &[u8]) -> (String, String, String, String) { + let alphabet = b" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-"; + let mut full_text = String::with_capacity((bytes.len() * 8) / 6 + 1); + + let mut accumulator: u32 = 0; + let mut bits_in_acc: u32 = 0; + + for &byte in bytes { + accumulator |= (byte as u32) << bits_in_acc; + bits_in_acc += 8; + + while bits_in_acc >= 6 { + let char_index = (accumulator & 0x3F) as usize; + + full_text.push(alphabet[char_index] as char); + + accumulator >>= 6; + bits_in_acc -= 6; + } + } + + let name = full_text[0..24].trim().to_string(); + let trait1 = full_text[24..40].trim().to_string(); + let trait2 = full_text[40..56].trim().to_string(); + let trait3 = full_text[56..72].trim().to_string(); + + (name, trait1, trait2, trait3) +} diff --git a/src/card/model.rs b/src/card/model.rs index d27c187..d18b837 100644 --- a/src/card/model.rs +++ b/src/card/model.rs @@ -1 +1,11 @@ -// Card model module +#[derive(Debug, Clone, Copy)] +pub struct NfcPayload<'a> { + pub event_encoding: &'a [u8], + pub card_type: u8, + pub card_uuid: &'a [u8], + pub _reserved: &'a [u8], + pub sprite: &'a [u8], + pub packed_card_text: &'a [u8], + pub secret: &'a [u8], + pub _opaque_trailer: &'a [u8], +} diff --git a/src/display/sprite.rs b/src/display/sprite.rs index c931da1..a5ec12d 100644 --- a/src/display/sprite.rs +++ b/src/display/sprite.rs @@ -1 +1,62 @@ -// Display sprite module +use embedded_graphics::{geometry::Size, pixelcolor::Rgb565, primitives::Rectangle, prelude::Point}; +use embedded_graphics_core::draw_target::DrawTarget; +use crate::display::palette::Rgb; + +pub fn render_sprite_onto_ili9341(ili9341: &mut D, sprite: &[u8], palette: &[Rgb; 16]) +where + D: DrawTarget, +{ + let pixel_count = sprite.len() * 2; + if pixel_count == 0 { + return; + } + + // OPTIMIZATION 1: Pre-compute the 16-color palette to Rgb565 once. + let mut palette565 = [Rgb565::new(0, 0, 0); 16]; + for (i, Rgb(r, g, b)) in palette.iter().enumerate() { + palette565[i] = Rgb565::new(*r >> 3, *g >> 2, *b >> 3); + } + + let mut src_width = 1usize; + while src_width * src_width < pixel_count { + src_width += 1; + } + + let target_width = 240usize; + let scale = core::cmp::max(1, target_width / src_width); + + for y in 0..src_width { + for x in 0..src_width { + let pixel_index = y * src_width + x; + if pixel_index >= pixel_count { + break; + } + + // Bitwise operations are slightly faster than division/modulo + let byte_index = pixel_index >> 1; + let pixel_byte = sprite[byte_index]; + let color_index = if pixel_index.is_multiple_of(2) { + (pixel_byte >> 4) & 0x0F + } else { + pixel_byte & 0x0F + }; + + let color = palette565[color_index as usize]; + + let start_x = (x * scale) as i32; + let start_y = (y * scale) as i32; + let end_x = core::cmp::min(start_x + scale as i32, target_width as i32); + let end_y = core::cmp::min(start_y + scale as i32, target_width as i32); + + let width = u32::try_from(end_x - start_x).unwrap(); + let height = u32::try_from(end_y - start_y).unwrap(); + + let area = Rectangle::new( + Point::new(start_x.try_into().unwrap(), start_y.try_into().unwrap()), + Size::new(width, height), + ); + + let _ = ili9341.fill_solid(&area, color); + } + } +} diff --git a/src/display/views/card_view.rs b/src/display/views/card_view.rs index 76dfdbd..d298883 100644 --- a/src/display/views/card_view.rs +++ b/src/display/views/card_view.rs @@ -1 +1,98 @@ -// Card view module +use alloc::{format, string::String}; +use embedded_graphics::mono_font::MonoTextStyle; +use embedded_graphics::mono_font::ascii::FONT_6X10; +use embedded_graphics::pixelcolor::Rgb565; +use embedded_graphics::prelude::Point; +use embedded_graphics::prelude::RgbColor; +use embedded_graphics::text::Text; +use embedded_graphics::{Drawable, geometry::Size, primitives::Rectangle}; +use embedded_graphics_core::draw_target::DrawTarget; +use crate::card::decoder::{decode_known_event, decode_packed_card_text, decode_secret, split_nfc_hex}; +use crate::card::model::NfcPayload; +use crate::display::palette::{PALETTES, TYPE_STYLES}; +use crate::display::sprite::render_sprite_onto_ili9341; + +pub fn render_nfc_payload(display: &mut D, payload: &[u8; 858]) +where + D: DrawTarget, + D::Error: core::fmt::Debug, +{ + let nfc_payload: Option> = split_nfc_hex(payload); + + if let Some(nfc_payload) = nfc_payload { + let (name, trait1, trait2, trait3) = decode_packed_card_text(nfc_payload.packed_card_text); + let secret = decode_secret(nfc_payload.secret); + + let background = Rectangle::new( + Point::new(0, 0), + Size::new(240, 320), + ); + let bg_color: Rgb565 = TYPE_STYLES[(nfc_payload.card_type - 1) as usize] + .primary + .into_rgb565(); + + let _ = display.fill_solid(&background, bg_color); + + let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE); + Text::new(&format!("Name: {}", name), Point::new(20, 240), style) + .draw(display) + .unwrap(); + Text::new( + &format!( + "Type: {}", + TYPE_STYLES[(nfc_payload.card_type - 1) as usize].name + ), + Point::new(20, 250), + style, + ) + .draw(display) + .unwrap(); + Text::new( + &format!( + "Event: {}", + decode_known_event(nfc_payload.event_encoding).unwrap_or("Unknown") + ), + Point::new(20, 260), + style, + ) + .draw(display) + .unwrap(); + Text::new( + &format!( + "UUID: {}", + nfc_payload + .card_uuid + .iter() + .map(|b| format!("{:02X}", b)) + .collect::() + ), + Point::new(20, 270), + style, + ) + .draw(display) + .unwrap(); + Text::new(&format!("Trait1: {}", trait1), Point::new(20, 280), style) + .draw(display) + .unwrap(); + Text::new(&format!("Trait2: {}", trait2), Point::new(20, 290), style) + .draw(display) + .unwrap(); + Text::new(&format!("Trait3: {}", trait3), Point::new(20, 300), style) + .draw(display) + .unwrap(); + Text::new(&format!("Secret: {}", secret), Point::new(20, 310), style) + .draw(display) + .unwrap(); + + render_sprite_onto_ili9341( + display, + nfc_payload.sprite, + &PALETTES[(nfc_payload.card_type - 1) as usize], + ); + } else { + log::error!( + "NFC payload too short to decode packed text: {} bytes", + payload.len() + ); + } +} diff --git a/src/lib.rs b/src/lib.rs index 701e7ab..7e00201 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ #![no_std] +extern crate alloc; + pub mod card; pub mod display; pub mod drivers; diff --git a/src/network/wifi.rs b/src/network/wifi.rs index 03cf1c8..bf00e13 100644 --- a/src/network/wifi.rs +++ b/src/network/wifi.rs @@ -1 +1,67 @@ -// Network wifi module +use embassy_executor::Spawner; + +#[cfg(not(feature = "wokwi"))] +pub async fn setup_wifi( + wifi: esp_hal::peripherals::WIFI<'static>, + flash: esp_hal::peripherals::FLASH<'static>, + spawner: &Spawner, +) { + let nvs = esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash).unwrap(); + + let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); + + wm_settings.ssid.clear(); + _ = core::fmt::write( + &mut wm_settings.ssid, + format_args!("CreatureDex-{:X}", esp_hal_wifimanager::get_efuse_mac()), + ); + + wm_settings.wifi_conn_timeout = 30000; + wm_settings.esp_reset_timeout = Some(300000); // 5min + + let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; + + log::info!("wifi_res: {wifi_res:?}"); +} + +#[cfg(feature = "wokwi")] +pub async fn setup_wifi( + wifi: esp_hal::peripherals::WIFI<'static>, + flash: esp_hal::peripherals::FLASH<'static>, + spawner: &Spawner, +) { + log::info!("Wokwi mode active: pre-seeding WiFi Manager with Wokwi credentials"); + + // Preload connection data so init_wm can connect immediately without AP setup. + let nvs = match esp_hal_wifimanager::Nvs::new(0x9000, 0x6000, flash) { + Ok(nvs) => nvs, + Err(e) => { + log::error!("Failed to initialize NVS for Wokwi: {e:?}"); + return; + } + }; + + if let Err(e) = nvs + .set( + esp_hal_wifimanager::WIFI_NVS_KEY, + "{\"ssid\":\"Wokwi-GUEST\",\"psk\":\"\",\"data\":{}}", + ) + .await + { + log::error!("Failed to store Wokwi WiFi config in NVS: {e:?}"); + return; + } + + let mut wm_settings = esp_hal_wifimanager::WmSettings::default(); + + // Wokwi simulation uses a default open network called "Wokwi-GUEST" + wm_settings.ssid.clear(); + _ = core::fmt::write(&mut wm_settings.ssid, format_args!("Wokwi-GUEST")); + + wm_settings.wifi_conn_timeout = 30000; + + // Initialize Wi-Fi connection through WiFi Manager using the pre-seeded NVS data. + let wifi_res = esp_hal_wifimanager::init_wm(wm_settings, spawner, Some(&nvs), wifi, None).await; + + log::info!("Wokwi wifi_res: {wifi_res:?}"); +} -- 2.39.5 From 459ab8762cf771f0a806d370b555afe085972809 Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 2 Aug 2026 14:59:11 +0200 Subject: [PATCH 12/12] Moved primary lcd and navigation into dedicated files --- src/bin/main.rs | 83 +++++++++----------------------------- src/display/primary_lcd.rs | 61 +++++++++++++++++++++++++++- src/navigation/input.rs | 16 +++++++- src/navigation/state.rs | 36 ++++++++++++++++- 4 files changed, 128 insertions(+), 68 deletions(-) diff --git a/src/bin/main.rs b/src/bin/main.rs index 8467582..8a9feec 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -8,29 +8,20 @@ #![deny(clippy::large_stack_frames)] use creaturedex::card::mock::{MOCK_PAYLOAD, MOCK_PAYLOAD2}; +use creaturedex::display::primary_lcd::init_primary_lcd; use creaturedex::display::views::card_view::render_nfc_payload; +use creaturedex::navigation::input::init_navigation_button; +use creaturedex::navigation::state::NavigationState; use creaturedex::network::wifi::setup_wifi; -use embedded_graphics::draw_target::DrawTarget; -use display_interface_spi::SPIInterface; use embassy_executor::Spawner; use embassy_time::Timer; +use embedded_graphics::draw_target::DrawTarget; use embedded_graphics::pixelcolor::Rgb565; use embedded_graphics::prelude::RgbColor; -use embedded_hal_bus::spi::ExclusiveDevice; use esp_hal::clock::CpuClock; use esp_hal::delay::Delay; -use esp_hal::gpio::Level; -use esp_hal::gpio::{Input, Output, Pull}; -use esp_hal::gpio::{InputConfig, OutputConfig}; -use esp_hal::spi::{ - Mode, - master::{Config, Spi}, -}; -use esp_hal::time::Rate; use esp_hal::timer::timg::TimerGroup; -use ili9341::Ili9341; -use ili9341::Orientation; -use log::{error, info}; +use log::error; #[panic_handler] fn panic(panic_info: &core::panic::PanicInfo) -> ! { @@ -50,21 +41,12 @@ esp_bootloader_esp_idf::esp_app_desc!(); )] #[esp_rtos::main] async fn main(spawner: Spawner) { - // generator version: 1.3.0 - // generator parameters: --chip esp32s3 -o esp32s3-wroom-1-octal-psram -o unstable-hal -o alloc -o wifi -o log -o wokwi -o neovim -o vscode -o esp - esp_println::logger::init_logger_from_env(); let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max()); let peripherals = esp_hal::init(config); - // The following pins are used to bootstrap the chip. They are available - // for use, but check the datasheet of the module for more information on them. - // - GPIO0 - // - GPIO3 - // - GPIO45 - // - GPIO46 - // These GPIO pins are in use by some feature of the module and should not be used. + // The following GPIO pins are in use by some feature of the module and should not be used. let _ = peripherals.GPIO27; let _ = peripherals.GPIO28; let _ = peripherals.GPIO29; @@ -73,75 +55,46 @@ async fn main(spawner: Spawner) { let _ = peripherals.GPIO32; let _ = peripherals.GPIO33; let _ = peripherals.GPIO34; - let _ = peripherals.GPIO35; - let _ = peripherals.GPIO36; - let _ = peripherals.GPIO37; esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 73744); - let button_config = InputConfig::default().with_pull(Pull::Up); - let button1 = Input::new(peripherals.GPIO38, button_config); + let mut delay = Delay::new(); + let button1 = init_navigation_button(peripherals.GPIO38); let timg0 = TimerGroup::new(peripherals.TIMG0); let sw_interrupt = esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT); esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0); - let freq = Rate::from_khz(60_000); - info!("Display freq: {freq}"); - - let spi_bus = Spi::new( + let mut display = init_primary_lcd( peripherals.SPI2, - Config::default().with_frequency(freq).with_mode(Mode::_0), - ) - .unwrap() - .with_sck(peripherals.GPIO36) - .with_mosi(peripherals.GPIO35) - .with_miso(peripherals.GPIO37); - - let cs_main = Output::new(peripherals.GPIO11, Level::High, OutputConfig::default()); - - let mut delay = Delay::new(); - let spi_dev = ExclusiveDevice::new(spi_bus, cs_main, delay).unwrap(); - let reset_main = Output::new(peripherals.GPIO10, Level::High, OutputConfig::default()); - let spi_dc = Output::new(peripherals.GPIO12, Level::High, OutputConfig::default()); - let iface = SPIInterface::new(spi_dev, spi_dc); - - let mut display = Ili9341::new( - iface, - reset_main, + peripherals.GPIO36, + peripherals.GPIO35, + peripherals.GPIO37, + peripherals.GPIO11, + peripherals.GPIO10, + peripherals.GPIO12, &mut delay, - Orientation::Portrait, - ili9341::DisplaySize240x320, - ) - .unwrap(); - - display.clear(Rgb565::BLACK).unwrap(); - - + ); // setup_wifi(peripherals.WIFI, peripherals.FLASH, &spawner).await; log::info!("Setup complete, entering main loop"); - let mut use_first_payload = true; + let mut nav_state = NavigationState::new(); loop { if button1.is_low() { log::info!("Button pressed!"); display.clear(Rgb565::BLACK).unwrap(); - let payload = if use_first_payload { + let payload = if nav_state.toggle_payload() { &MOCK_PAYLOAD } else { &MOCK_PAYLOAD2 }; render_nfc_payload(&mut display, payload); - use_first_payload = !use_first_payload; } - // info!("Hello world!"); Timer::after_millis(10).await; } - - // for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples } diff --git a/src/display/primary_lcd.rs b/src/display/primary_lcd.rs index 8c0bf35..efebe50 100644 --- a/src/display/primary_lcd.rs +++ b/src/display/primary_lcd.rs @@ -1 +1,60 @@ -// Primary LCD module +use display_interface_spi::SPIInterface; +use embedded_graphics::draw_target::DrawTarget; +use embedded_graphics::pixelcolor::Rgb565; +use embedded_graphics::prelude::RgbColor; +use embedded_hal_bus::spi::ExclusiveDevice; +use esp_hal::delay::Delay; +use esp_hal::gpio::{Level, Output, OutputConfig}; +use esp_hal::peripherals::{GPIO10, GPIO11, GPIO12, GPIO35, GPIO36, GPIO37, SPI2}; +use esp_hal::spi::{master::{Config, Spi}, Mode}; +use esp_hal::time::Rate; +use ili9341::{DisplaySize240x320, Ili9341, Orientation}; + +pub type PrimaryLcdDisplay<'a> = Ili9341< + SPIInterface< + ExclusiveDevice, Output<'a>, Delay>, + Output<'a>, + >, + Output<'a>, +>; + +pub fn init_primary_lcd( + spi2: SPI2<'static>, + sck: GPIO36<'static>, + mosi: GPIO35<'static>, + miso: GPIO37<'static>, + cs: GPIO11<'static>, + reset: GPIO10<'static>, + dc: GPIO12<'static>, + delay: &mut Delay, +) -> PrimaryLcdDisplay<'static> { + let freq = Rate::from_khz(60_000); + log::info!("Display freq: {freq}"); + + let spi_bus = Spi::new( + spi2, + Config::default().with_frequency(freq).with_mode(Mode::_0), + ) + .unwrap() + .with_sck(sck) + .with_mosi(mosi) + .with_miso(miso); + + let cs_main = Output::new(cs, Level::High, OutputConfig::default()); + let spi_dev = ExclusiveDevice::new(spi_bus, cs_main, *delay).unwrap(); + let reset_main = Output::new(reset, Level::High, OutputConfig::default()); + let spi_dc = Output::new(dc, Level::High, OutputConfig::default()); + let iface = SPIInterface::new(spi_dev, spi_dc); + + let mut display = Ili9341::new( + iface, + reset_main, + delay, + Orientation::Portrait, + DisplaySize240x320, + ) + .unwrap(); + + display.clear(Rgb565::BLACK).unwrap(); + display +} diff --git a/src/navigation/input.rs b/src/navigation/input.rs index 5320702..07f5426 100644 --- a/src/navigation/input.rs +++ b/src/navigation/input.rs @@ -1 +1,15 @@ -// Navigation input module +use esp_hal::gpio::{Input, InputConfig, Pull}; +use esp_hal::peripherals::GPIO38; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum NavCommand { + NextCard, + PrevCard, + Select, + ScanTag, +} + +pub fn init_navigation_button(pin: GPIO38<'static>) -> Input<'static> { + let button_config = InputConfig::default().with_pull(Pull::Up); + Input::new(pin, button_config) +} diff --git a/src/navigation/state.rs b/src/navigation/state.rs index b0feb62..71e9548 100644 --- a/src/navigation/state.rs +++ b/src/navigation/state.rs @@ -1 +1,35 @@ -// Navigation state module +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ScreenMode { + CardDetail, + DexGrid, + Settings, +} + +#[derive(Debug, Clone, Copy)] +pub struct NavigationState { + pub current_screen: ScreenMode, + pub card_index: usize, + pub use_first_payload: bool, +} + +impl Default for NavigationState { + fn default() -> Self { + Self { + current_screen: ScreenMode::CardDetail, + card_index: 0, + use_first_payload: true, + } + } +} + +impl NavigationState { + pub fn new() -> Self { + Self::default() + } + + pub fn toggle_payload(&mut self) -> bool { + let current = self.use_first_payload; + self.use_first_payload = !self.use_first_payload; + current + } +} -- 2.39.5