commit 353e59d66a44787f0554922cc453407106d730ce Author: eraden Date: Mon Sep 16 12:14:45 2024 +0200 Build make diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..d7314d8 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,18 @@ +[target.riscv32imac-unknown-none-elf] +runner = "espflash flash --monitor" + + +[env] +ESP_LOGLEVEL="INFO" + +[build] +rustflags = [ + # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) + # NOTE: May negatively impact performance of produced code + "-C", "force-frame-pointers", +] + +target = "riscv32imac-unknown-none-elf" + +[unstable] +build-std = ["core"] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..2bc78f4 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1190 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e1496f8fb1fbf272686b8d37f523dab3e4a7443300055e74cdaa449f3114356" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + +[[package]] +name = "bare-metal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" + +[[package]] +name = "basic-toml" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" +dependencies = [ + "serde", +] + +[[package]] +name = "bitfield" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c821a6e124197eb56d907ccc2188eab1038fb919c914f47976e64dd8dbc855d1" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytemuck" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[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 = "core-isa-parser" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ec98e54b735872e54b2335c2e5a5c7fa7d9c3bfd45500f75280f84089a0083" +dependencies = [ + "anyhow", + "enum-as-inner", + "regex", + "strum 0.24.1", + "strum_macros 0.24.3", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64009896348fc5af4222e9cf7d7d82a95a256c634ebcf61c53e4ea461422242" + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.77", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "delegate" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[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", + "embedded-hal-async", +] + +[[package]] +name = "document-features" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +dependencies = [ + "litrs", +] + +[[package]] +name = "embedded-can" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" +dependencies = [ + "nb", +] + +[[package]] +name = "embedded-dma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "embedded-graphics" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0649998afacf6d575d126d83e68b78c0ab0e00ca2ac7e9b3db11b4cbe8274ef0" +dependencies = [ + "az", + "byteorder", + "embedded-graphics-core", + "float-cmp", + "micromath", +] + +[[package]] +name = "embedded-graphics-core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba9ecd261f991856250d2207f6d8376946cd9f412a2165d3b75bc87a0bc7a044" +dependencies = [ + "az", + "byteorder", +] + +[[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", +] + +[[package]] +name = "embedded-hal-bus" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d3980bf28e8577db59fe2bdb3df868a419469d2cecb363644eea2b6f7797669" +dependencies = [ + "critical-section", + "embedded-hal", + "portable-atomic", +] + +[[package]] +name = "embedded-hal-nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" +dependencies = [ + "embedded-hal", + "nb", +] + +[[package]] +name = "enum-as-inner" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "enumset" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a4b049558765cef5f0c1a273c3fc57084d768b44d2f98127aef4cceb17293" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "esp-backtrace" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a34817530dceba397172d6a9fb660b684a73a3a591fbe7fb0da27bed796f270" +dependencies = [ + "esp-build", + "esp-println", +] + +[[package]] +name = "esp-build" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b94a4b8d74e7cc7baabcca5b2277b41877e039ad9cd49959d48ef94dac7eab4b" +dependencies = [ + "quote", + "syn 2.0.77", + "termcolor", +] + +[[package]] +name = "esp-hal" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4f8cb6a9dcf0fd4506a856fbb4a0622b92042978c601a23c840c28f621a59f" +dependencies = [ + "basic-toml", + "bitfield", + "bitflags", + "bytemuck", + "cfg-if", + "critical-section", + "delegate", + "document-features", + "embedded-can", + "embedded-dma", + "embedded-hal", + "embedded-hal-nb", + "enumset", + "esp-build", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp32c6", + "fugit", + "nb", + "paste", + "portable-atomic", + "rand_core", + "riscv", + "serde", + "strum 0.26.3", + "void", + "xtensa-lx-rt", +] + +[[package]] +name = "esp-hal-procmacros" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9569ccb286c5a0c39292dbaaa0995bbb2a2a9d671ef3ce807b8b5b3d9a589d35" +dependencies = [ + "darling", + "document-features", + "litrs", + "object", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "esp-metadata" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6013420eb303c3087d82c2d2a38944427662b0b07a9ae79e5b1636fc1442e0ba" +dependencies = [ + "basic-toml", + "lazy_static", + "serde", + "strum 0.26.3", +] + +[[package]] +name = "esp-println" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58cd4fa834980ba64aad00a5c2c1a630020af984eadef65a125cb99085f6f54c" +dependencies = [ + "esp-build", + "log", + "portable-atomic", +] + +[[package]] +name = "esp-riscv-rt" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfc32298ed7c263b06c8b031704d8517cc62c819f2a9d5c261d0cb119634d6e9" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp32c6" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5824acf92f8536c997e673113ce704c004f77e154fd550dc511b92d61bb34f6" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "flate2" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[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.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" +dependencies = [ + "gcd", +] + +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + +[[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.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[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 = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[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 = "indexmap" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "kinded" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4bdbb2f423660b19f0e9f7115182214732d8dd5f840cd0a3aee3e22562f34c" +dependencies = [ + "kinded_macros", +] + +[[package]] +name = "kinded_macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13b4ddc5dcb32f45dac3d6f606da2a52fdb9964a18427e63cd5ef6c0d13288d" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "maybe-async-cfg" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e083394889336bc66a4eaf1011ffbfa74893e910f902a9f271fa624c61e1b2" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "pulldown-cmark", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "maze" +version = "0.1.0" +dependencies = [ + "bitflags", + "heapless", + "nutype", + "rand", + "shared", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "micromath" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c8dda44ff03a2f238717214da50f65d5a53b45cd213a7370424ffdb6fae815" + +[[package]] +name = "minijinja" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55e877d961d4f96ce13615862322df7c0b6d169d40cab71a7ef3f9b9e594451e" +dependencies = [ + "serde", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "nutype" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8789358e2d6cdffb0cb170c7802ee7548beb8067ed643f3122fa36c335f3c64" +dependencies = [ + "nutype_macros", +] + +[[package]] +name = "nutype_macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93a3e222ba1f06a03552910fe89a232a1661dcf8ad4c837531fb199828d0916b" +dependencies = [ + "cfg-if", + "kinded", + "proc-macro2", + "quote", + "syn 2.0.77", + "urlencoding", +] + +[[package]] +name = "object" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "portable-atomic" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" + +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profont" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016681370a9dd6e7ddb4c1a959922fd59dc45e5ebaa5ff5b13090267898ced34" +dependencies = [ + "embedded-graphics", +] + +[[package]] +name = "pulldown-cmark" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "679341d22c78c6c649893cbd6c3278dcbe9fc4faa62fea3a9296ae2b50c14625" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "readdy" +version = "0.1.0" +dependencies = [ + "display-interface-spi", + "embedded-graphics", + "embedded-hal-bus", + "esp-backtrace", + "esp-hal", + "esp-println", + "heapless", + "log", + "maze", + "nutype", + "profont", + "rand", + "shared", + "weact-studio-epd", +] + +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "riscv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9" +dependencies = [ + "critical-section", + "embedded-hal", +] + +[[package]] +name = "riscv-rt-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d100d466dbb76681ef6a9386f3da9abc570d57394e86da0ba5af8c4408486d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ruzstd" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99c3938e133aac070997ddc684d4b393777d293ba170f2988c8fd5ea2ad4ce21" +dependencies = [ + "twox-hash", +] + +[[package]] +name = "sealed" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a8caec23b7800fb97971a1c6ae365b6239aaeddfb934d6265f8505e795699d" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "shared" +version = "0.1.0" +dependencies = [ + "esp-hal", + "nutype", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros 0.26.4", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.77", +] + +[[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.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +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 = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" + +[[package]] +name = "toml_edit" +version = "0.22.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[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 = "weact-studio-epd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e531b21e70dfc6294be2429e4f616f634c8ca1a328325dceefc4f92c12d6e9b" +dependencies = [ + "display-interface", + "embedded-graphics", + "embedded-hal", + "embedded-hal-async", + "maybe-async-cfg", + "sealed", +] + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +dependencies = [ + "memchr", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904102108b780c9a5e3275c5f3c63dc348ec43ae5da5237868515498b447d51a" +dependencies = [ + "bare-metal", + "core-isa-parser", + "minijinja", + "r0", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "082cdede098bbec9af15b0e74085e5f3d16f2923597de7aed7b8112003af2da7" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.77", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d86a330 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "readdy" +version = "0.1.0" +edition = "2021" + +[dependencies] +display-interface-spi = "0.5.0" +embedded-graphics = "0.8.1" +embedded-hal-bus = "0.2.0" +esp-backtrace = { version = "0.13.0", features = ["esp32c6", "exception-handler", "panic-handler", "println"] } +esp-hal = { version = "0.19.0", features = ["esp32c6", "embedded-hal"] } +esp-println = { version = "0.10.0", default-features = false, features = ["esp32c6", "log", "jtag-serial"] } +heapless = "0.8.0" +log = { version = "0.4.21" } +nutype = { version = "0.5.0", default-features = false } +profont = "0.7.0" +rand = { version = "0.8.5", default-features = false, features = ["small_rng"] } +weact-studio-epd = { version = "0.1.2", features = ["blocking"] } + +shared = { path = "./shared", features = ['trng'] } +maze = { path = "./maze" } + +[profile.dev] +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" + +[profile.release] +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'fat' +opt-level = 's' +overflow-checks = false diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..5efe9c9 --- /dev/null +++ b/build.rs @@ -0,0 +1,3 @@ +fn main() { + println!("cargo:rustc-link-arg-bins=-Tlinkall.x"); +} diff --git a/maze/.gitignore b/maze/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/maze/.gitignore @@ -0,0 +1 @@ +target diff --git a/maze/Cargo.lock b/maze/Cargo.lock new file mode 100644 index 0000000..694c17a --- /dev/null +++ b/maze/Cargo.lock @@ -0,0 +1,271 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[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 = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[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 = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[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 = "kinded" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce4bdbb2f423660b19f0e9f7115182214732d8dd5f840cd0a3aee3e22562f34c" +dependencies = [ + "kinded_macros", +] + +[[package]] +name = "kinded_macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13b4ddc5dcb32f45dac3d6f606da2a52fdb9964a18427e63cd5ef6c0d13288d" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "libc" +version = "0.2.158" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "maze" +version = "0.1.0" +dependencies = [ + "bitflags", + "heapless", + "nutype", + "pretty_assertions", + "rand", + "shared", +] + +[[package]] +name = "nutype" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8789358e2d6cdffb0cb170c7802ee7548beb8067ed643f3122fa36c335f3c64" +dependencies = [ + "nutype_macros", +] + +[[package]] +name = "nutype_macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93a3e222ba1f06a03552910fe89a232a1661dcf8ad4c837531fb199828d0916b" +dependencies = [ + "cfg-if", + "kinded", + "proc-macro2", + "quote", + "syn", + "urlencoding", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "pretty_assertions" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "shared" +version = "0.1.0" +dependencies = [ + "nutype", + "rand", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/maze/Cargo.toml b/maze/Cargo.toml new file mode 100644 index 0000000..7257971 --- /dev/null +++ b/maze/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "maze" +version = "0.1.0" +edition = "2021" + +[dependencies] +nutype = { version = "0.5.0", default-features = false } +heapless = "0.8.0" + +shared = { path = "../shared" } +bitflags = "2.6.0" +rand = { version = "0.8.5", default-features = false, features = ["small_rng"] } + +[dev-dependencies] +rand = { version = "0.8.5", features = ["getrandom", "small_rng", "std", "std_rng"] } +shared = { path = "../shared", features = ['full-rand'] } +pretty_assertions = "1" diff --git a/maze/rust-toolchain.toml b/maze/rust-toolchain.toml new file mode 100644 index 0000000..b8fba13 --- /dev/null +++ b/maze/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["rust-src"] +# targets = ["riscv32imac-unknown-none-elf"] diff --git a/maze/src/lib.rs b/maze/src/lib.rs new file mode 100644 index 0000000..269938d --- /dev/null +++ b/maze/src/lib.rs @@ -0,0 +1,582 @@ +#![cfg_attr(not(test), no_std)] + +use core::fmt::Write; + +use bitflags::bitflags; +use nutype::nutype; +use rand::{Rng, SeedableRng}; +use shared::GenU32; + +pub type Coords = (usize, usize); + +bitflags! { + #[derive(Default, Debug, Copy, Clone, PartialEq)] + pub struct Cell: u8 { + const NORTH = 0b0001; + const SOUTH = 0b0010; + const EAST = 0b0100; + const WEST = 0b1000; + } +} + +impl Cell { + pub fn south_blocked(&self) -> bool { + self.contains(Cell::SOUTH) + } + + pub fn east_blocked(&self) -> bool { + self.contains(Cell::EAST) + } +} + +#[derive(Default, Copy, Clone, Debug)] +pub struct CellStatus { + visited: bool, + marked: bool, +} + +impl CellStatus { + pub fn visited(&self) -> bool { + self.visited + } + + pub fn marked(&self) -> bool { + self.marked + } + + pub fn visit(&mut self) { + self.visited = true; + } + + pub fn mark(&mut self) { + self.marked = true; + } +} + +#[nutype(derive(Deref, Debug, Clone, Copy, From, PartialEq, Eq, Hash, PartialOrd, Ord))] +pub struct XPos(usize); + +#[nutype(derive(Deref, Debug, Clone, Copy, From, PartialEq, Eq, Hash, PartialOrd, Ord))] +pub struct YPos(usize); + +#[derive(Debug, Clone)] +pub struct Grid { + pub cells: [Cell; SIZE], + pub cell_statuses: [CellStatus; SIZE], +} + +impl Grid { + pub fn new() -> Self { + Self { + cells: core::array::from_fn(|_x| Cell::default()), + cell_statuses: core::array::from_fn(|_x| CellStatus::default()), + } + } + + pub fn x(&self) -> usize { + X + } + + pub fn y(&self) -> usize { + Y + } + + pub fn mark_cell(&mut self, coords: Coords) { + self.get_cell_status_mut(coords).mark() + } + + pub fn is_cell_visited(&self, coords: Coords) -> bool { + self.get_cell_status(coords).visited() + } + + pub fn is_cell_marked(&self, coords: Coords) -> bool { + self.get_cell_status(coords).marked() + } + + pub fn get_cell_status(&self, coords: Coords) -> CellStatus { + let (x, y) = coords; + self.cell_statuses[y * X + x].clone() + } + + pub fn is_carved(&self, coords: Coords, direction: Cell) -> bool { + let (x, y) = coords; + self.cells[y * X + x].contains(direction) + } + + pub fn carve_passage(&mut self, coords: Coords, direction: Cell) -> TransitResult { + let (x, y) = coords; + let (nx, ny) = self.get_next_cell_coords(coords, direction)?; + + match direction { + Cell::NORTH => { + self.cells[y * X + x] |= Cell::NORTH; + self.cells[ny * X + nx] |= Cell::SOUTH; + } + Cell::SOUTH => { + self.cells[y * X + x] |= Cell::SOUTH; + self.cells[ny * X + nx] |= Cell::NORTH; + } + Cell::EAST => { + self.cells[y * X + x] |= Cell::EAST; + self.cells[ny * X + nx] |= Cell::WEST; + } + Cell::WEST => { + self.cells[y * X + x] |= Cell::WEST; + self.cells[ny * X + nx] |= Cell::EAST; + } + _ => (), + } + + self.visit_cell(coords); + self.visit_cell((nx, ny)); + + Ok((nx, ny)) + } + + pub fn get_next_cell_coords(&self, coords: Coords, direction: Cell) -> TransitResult { + self.validate_transit(coords, direction)?; + + let (x, y) = coords; + let (nx, ny) = match direction { + Cell::NORTH => (x, y - 1), + Cell::SOUTH => (x, y + 1), + Cell::WEST => (x - 1, y), + Cell::EAST => (x + 1, y), + _ => (x, y), + }; + Ok((nx, ny)) + } + + fn visit_cell(&mut self, coords: Coords) { + self.get_cell_status_mut(coords).visit() + } + + fn get_cell_status_mut(&mut self, coords: Coords) -> &mut CellStatus { + let (x, y) = coords; + &mut self.cell_statuses[y * X + x] + } + + fn validate_transit(&self, coords: Coords, direction: Cell) -> TransitResult<()> { + let (x, y) = coords; + let reason = match direction { + Cell::NORTH if y < 1 => "First row in the grid cannot go North", + Cell::SOUTH if y + 1 == Y => "Last row in the grid cannot go South", + Cell::WEST if x < 1 => "First cell in a row cannot go West", + Cell::EAST if x + 1 == X => "Last column in the grid cannot go East", + _ => return Ok(()), + }; + + Err(TransitError { + coords: (x, y), + reason, + }) + } +} + +type TransitResult = Result; + +#[derive(Debug, Clone)] +pub struct TransitError { + pub coords: Coords, + pub reason: &'static str, +} + +enum Orientation { + Horizontal, + Vertical, +} + +/// The "Recursive Division" algorithm for generating mazes +/// +/// According to [Wikipedia](https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_division_method) +/// and [James Buck's maze generation blogs](https://weblog.jamisbuck.org/2011/1/12/maze-generation-recursive-division-algorithm) +/// this algorithm should be implemented as a wall adder, as opposed to the rest of the algorithms +/// in this library which are designated as "passage carvers". In a nutshell, the idea is to +/// recursively divide the original grid with no walls — call this a "chamber" — into smaller +/// subchambers with randomly positioned walls and single passages within them. This fractal nature +/// makes this algorithm novel. You could theoretically continue the process indefinitely at +/// progressively finer and finer levels of detail on demand. This may be useful when developing a +/// game where a player wanders from one section of the maze to another without a need to store the +/// entire maze in the memory. +/// +/// My implementation of this algorithm is a bit different from the above. The design of this +/// library supports only the passage-carving technique (mixing both techniques would lead to an +/// uglier API and less efficient generation mechanism, which I tested using benchmarks). Given that +/// I've slightly modified the algorithm to be rather a "passage carver". The method and its fractal +/// nature remain though. Of course, the generation process would be less fancy this way, but this +/// library has nothing to do with visualizing the generation progress step-by-step. If you're +/// interested in this side of the maze generation world, feel free to check my other program for +/// the terminal called [Daedalus](https://github.com/unrenamed/daedalus). +/// +/// It's also worth mentioning that the algorithm's fractal nature leads to some visual artifacts +/// and bottlenecks like a single passage between two sections that effectively divide the entire +/// maze into two distinct regions, thus making it easy to spot the passage and work backward to a +/// solution. +pub struct RecursiveDivision; + +impl RecursiveDivision { + fn divide( + grid: &mut Grid, + x: usize, + y: usize, + ax: usize, + ay: usize, + trng: &mut impl GenU32, + ) { + // Calculate subfield width + let w = ax - x + 1; + // Calculate subfield height + let h = ay - y + 1; + + if w < 2 || h < 2 { + if w > 1 { + // Carve passages till the horizontal end of the subfield + for cx in x..ax { + grid.carve_passage((cx, y), Cell::EAST).unwrap(); + } + } else if h > 1 { + // Carve passages till the vertical end of the subfield + for cy in y..ay { + grid.carve_passage((x, cy), Cell::SOUTH).unwrap(); + } + } + return; + } + + let mut rng = rand::rngs::SmallRng::seed_from_u64(trng.random() as u64); + + // Which way a subfield with the given dimensions ought to be bisected + let orientation = choose_orientation(w, h, trng); + + // Get X and Y coordinates of a cell where a passage will be carved + let px = rng.gen_range(x..ax); + let py = rng.gen_range(y..ay); + + // Define what direction is corresponding to the wall orientation + let dir = match orientation { + Orientation::Horizontal => Cell::SOUTH, + Orientation::Vertical => Cell::EAST, + }; + + // Carve passage + let (nx, ny) = grid.carve_passage((px, py), dir).unwrap(); + + // Determine the bounds of the subfields and get them split + match orientation { + Orientation::Horizontal => { + // Top subfield + Self::divide(grid, x, y, ax, py, trng); + // Bottom subfield + Self::divide(grid, x, ny, ax, ay, trng); + } + Orientation::Vertical => { + // Left subfield + Self::divide(grid, x, y, px, ay, trng); + // Right subfield + Self::divide(grid, nx, y, ax, ay, trng); + } + } + } + + /// An implementation of the "Recursive Division" algorithm for generating mazes + /// + /// It works like this: + /// + /// 1. Begins with an original grid as a working field + /// + /// 2. Bisects the field either horizontally or vertically by carving a passage + /// through the wall from a random cell + /// + /// 3. Repeats step #2 with the areas on either side of the wall where the passage + /// was carved. + /// + /// 4. Continues, recursively, until the maze reaches the desired resolution + pub fn generate(&mut self, grid: &mut Grid, trng: &mut impl GenU32) { + RecursiveDivision::divide(grid, 0, 0, X - 1, Y - 1, trng); + } +} + +fn choose_orientation(width: usize, height: usize, trng: &mut impl GenU32) -> Orientation { + if width < height { + return Orientation::Horizontal; + } + + if height < width { + return Orientation::Vertical; + } + + if trng.random() % 1 == 0 { + Orientation::Horizontal + } else { + Orientation::Vertical + } +} + +#[cfg(test)] +mod tests { + use super::*; + use shared::GenU32; + + #[test] + fn create_maze() { + let maze = Grid::<4, 4, 16>::new(); + } + + #[test] + fn generate_4x4() { + let mut trng = rand::thread_rng(); + let mut grid = Grid::<4, 4, 16>::new(); + RecursiveDivision.generate(&mut grid, &mut trng); + } +} + +/// A formatter to emit the maze as ASCII with narrow passages +/// +/// # Example: +/// +/// ```no_test +/// _______ +/// | ___| | +/// |_ | _| +/// | | |_ | +/// |_______| +/// ``` +pub struct AsciiNarrow; + +/// An implementation of an broad ASCII formatter +impl AsciiNarrow { + /// Generate ASCII image which: + /// + /// * takes 2 characters per 1 cell + /// * each row ends with newline character + /// * has 1 additional row for top border + /// * each row starts with border + fn format(&self, grid: &Grid, result: &mut impl Write) { + write!(result, " ").unwrap(); + (0..(X * 2 - 1)).into_iter().for_each(|_| { + write!(result, "_").unwrap(); + }); + writeln!(result, " ").unwrap(); + + (0..Y).into_iter().for_each(|y| { + write!(result, "|").unwrap(); + + (0..X).into_iter().for_each(|x| { + if grid.is_carved((x, y), Cell::SOUTH) { + write!(result, " ").unwrap(); + } else { + write!(result, "_").unwrap(); + } + + if grid.is_carved((x, y), Cell::EAST) { + if grid.is_carved((x, y), Cell::SOUTH) + || grid.is_carved((x + 1, y), Cell::SOUTH) + { + write!(result, " ").unwrap(); + } else { + write!(result, "_").unwrap(); + } + } else { + write!(result, "|").unwrap(); + } + }); + + writeln!(result).unwrap(); + }); + // + } +} + +/// A formatter to emit the maze as ASCII with broad passages and "+" to contact walls +/// +/// # Example: +/// +/// ```no_test +/// +---+---+---+---+ +/// | | +/// +---+---+ + + +/// | | | +/// + +---+ + + +/// | | | | +/// + +---+---+ + +/// | | | +/// +---+---+---+---+ +/// ``` +pub struct AsciiBroad; + +/// An implementation of a narrow ASCII formatter +impl AsciiBroad { + // const CELL_SIZE: usize = 3; + // const LINE_SIZE: usize = X * Self::CELL_SIZE + 1; + // const BUFFER_SIZE: usize = Y + Self::CELL_SIZE * Self::LINE_SIZE; + + fn format(&self, grid: &Grid, output: &mut impl Write) { + write!(output, "#").unwrap(); + (0..X).into_iter().for_each(|_| { + write!(output, "##").unwrap(); + }); + writeln!(output, "").unwrap(); + + let mut top_line = heapless::String::::new(); + let mut bottom_line = heapless::String::::new(); + + for y in 0..Y { + top_line.clear(); + write!(top_line, "#").unwrap(); + bottom_line.clear(); + write!(bottom_line, "#").unwrap(); + + for x in 0..X { + write!(top_line, " ").unwrap(); + let east_boundary = if grid.is_carved((x, y), Cell::EAST) { + " " + } else { + "#" + }; + write!(top_line, "{east_boundary}").unwrap(); + + let south_boundary = if grid.is_carved((x, y), Cell::SOUTH) { + " " + } else { + "#" + }; + write!(bottom_line, "{south_boundary}#").unwrap(); + + if x == X - 1 { + writeln!(output, "{top_line}").unwrap(); + writeln!(output, "{bottom_line}").unwrap(); + } + } + } + } +} + +struct BufWriter<'s>(&'s mut [MazePart]); + +impl<'s> BufWriter<'s> { + pub fn push(&mut self, part: MazePart) { + self.0[0] = part; + self.0 = &mut self.0[1..]; + } +} + +pub struct BinaryMap; + +impl BinaryMap { + fn format(&self, grid: &Grid, buffer: &mut [MazePart]) { + let push = |p: MazePart, buffer: &mut [MazePart]| { + buffer[0] = p; + &mut buffer[1..] + }; + let copy = |src: &[MazePart], dst: &mut [MazePart]| { + src.iter() + .take_while(|p| **p != MazePart::Noop) + .for_each(|p| { + dst = push(*p, dst); + }); + }; + + buffer = push(MazePart::Wall, buffer); + (0..X).into_iter().for_each(|_| { + push(MazePart::Wall, buffer); + push(MazePart::Wall, buffer); + }); + + let mut top_line = [MazePart::Noop; SIZE]; + let mut bottom_line = [MazePart::Noop; SIZE]; + + for y in 0..Y { + top_line.fill(MazePart::Noop); + bottom_line.fill(MazePart::Noop); + let tl = &mut top_line; + let bl = &mut bottom_line; + + push(MazePart::Wall, tl); + push(MazePart::Wall, bl); + + for x in 0..X { + push(MazePart::Passage, tl); + push( + if grid.is_carved((x, y), Cell::EAST) { + MazePart::Passage + } else { + MazePart::Wall + }, + tl, + ); + + push( + if grid.is_carved((x, y), Cell::SOUTH) { + MazePart::Passage + } else { + MazePart::Wall + }, + bl, + ); + } + copy(&top_line, buffer); + copy(&bottom_line, buffer); + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum MazePart { + Noop, + Passage, + Wall, + Player, +} + +#[cfg(test)] +mod print_tests { + use super::*; + use std::io::Cursor; + use std::io::Write; + + #[test] + fn print() { + let mut trng = rand::thread_rng(); + let mut grid = Grid::<4, 4, 16>::new(); + RecursiveDivision.generate(&mut grid, &mut trng); + let mut result = String::with_capacity(40); + AsciiNarrow.format(&mut grid, &mut result); + println!("{result}"); + } + + #[test] + fn heapless_narrow() { + let mut trng = rand::thread_rng(); + let mut grid = Grid::<4, 4, 16>::new(); + RecursiveDivision.generate(&mut grid, &mut trng); + + // 4 rows * 2 + 1 newline + 1 border = 10 + // 4 rows + 1 header row = 5 + let mut result = heapless::String::<50>::new(); + AsciiNarrow.format(&mut grid, &mut result); + println!("{result}"); + } + + #[test] + fn heapless_broad() { + let mut trng = rand::thread_rng(); + let mut grid = Grid::<4, 4, 16>::new(); + RecursiveDivision.generate(&mut grid, &mut trng); + + // 4 rows * 3 = 12 + // 4 rows + 3 = 12 + let mut result = heapless::String::<144>::new(); + AsciiBroad.format(&mut grid, &mut result); + println!("{result}"); + } + + #[test] + fn large() { + let mut trng = rand::thread_rng(); + let mut grid = Grid::<20, 20, 400>::new(); + RecursiveDivision.generate(&mut grid, &mut trng); + let mut result = String::with_capacity(40); + AsciiBroad.format(&mut grid, &mut result); + println!("{result}"); + } +} diff --git a/maze/test.sh b/maze/test.sh new file mode 100755 index 0000000..e679e29 --- /dev/null +++ b/maze/test.sh @@ -0,0 +1 @@ +cargo test --target x86_64-unknown-linux-gnu $* diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..3951889 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["rust-src"] +targets = ["riscv32imac-unknown-none-elf"] diff --git a/shared/Cargo.toml b/shared/Cargo.toml new file mode 100644 index 0000000..2d5b8ff --- /dev/null +++ b/shared/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "shared" +version = "0.1.0" +edition = "2021" + +[features] +default-features = [] +trng = ["esp-hal"] +full-rand = [ 'rand' ] + +[dependencies] +nutype = { version = "0.5.0", default-features = false } +esp-hal = { version = "0.19.0", features = ["esp32c6", "embedded-hal"], optional = true } +rand = { version = "0.8.5", features = ["getrandom", "small_rng", "std", "std_rng"], optional = true } diff --git a/shared/src/lib.rs b/shared/src/lib.rs new file mode 100644 index 0000000..1004a83 --- /dev/null +++ b/shared/src/lib.rs @@ -0,0 +1,19 @@ +#![cfg_attr(not(test), no_std)] + +pub trait GenU32 { + fn random(&mut self) -> u32; +} + +#[cfg(feature = "trng")] +impl<'l> GenU32 for esp_hal::rng::Trng<'l> { + fn random(&mut self) -> u32 { + self.random() + } +} +#[cfg(feature = "full-rand")] +impl GenU32 for rand::rngs::ThreadRng { + fn random(&mut self) -> u32 { + use rand::RngCore; + self.next_u32() + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e3ff2cd --- /dev/null +++ b/src/main.rs @@ -0,0 +1,134 @@ +#![no_std] +#![no_main] + +use core::fmt::Write; +use display_interface_spi::SPIInterface; +use embedded_graphics::{ + geometry::Point, + mono_font::MonoTextStyle, + text::{Text, TextStyle}, + Drawable, +}; +use embedded_hal_bus::spi::ExclusiveDevice; +use esp_backtrace as _; +use esp_hal::{ + clock::ClockControl, + delay::Delay, + gpio::{Input, Io, Level, Output, NO_PIN}, + peripherals::Peripherals, + prelude::*, + rng::Trng, + spi::{master::Spi, SpiMode}, + system::SystemControl, +}; +use heapless::String; +use profont::PROFONT_24_POINT; +use shared::GenU32; +use weact_studio_epd::{graphics::Display290BlackWhite, Color}; +use weact_studio_epd::{graphics::DisplayRotation, WeActStudio290BlackWhiteDriver}; + +#[entry] +fn main() -> ! { + let peripherals = Peripherals::take(); + let system = SystemControl::new(peripherals.SYSTEM); + let io = Io::new(peripherals.GPIO, peripherals.IO_MUX); + let clocks = ClockControl::max(system.clock_control).freeze(); + let delay = Delay::new(&clocks); + let mut trng = Trng::new(peripherals.RNG, peripherals.ADC1); + + let _ = trng.random(); + + esp_println::logger::init_logger_from_env(); + + log::info!("Intializing SPI Bus..."); + + // Pins for Seeedstudio XIAO ESP32-C6 + let sclk = io.pins.gpio19; // D8 / GPIO19 + let mosi = io.pins.gpio18; // D10 / GPIO18 + let cs = io.pins.gpio20; // D9 / GPIO20 + let dc = io.pins.gpio21; // D3 / GPIO21 + let rst = io.pins.gpio22; // D4 / GPIO22 + let busy = io.pins.gpio23; // D5 / GPIO23 + + let spi_bus = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0, &clocks).with_pins( + Some(sclk), + Some(mosi), + NO_PIN, + NO_PIN, // cs is handled by the exclusive device + ); + + // Convert pins into InputPins and OutputPins + /* + CS: OutputPin, + BUSY: InputPin, + DC: OutputPin, + RST: OutputPin, + */ + let cs = Output::new(cs, Level::High); + let busy = Input::new(busy, esp_hal::gpio::Pull::Up); + let dc = Output::new(dc, Level::Low); + let rst = Output::new(rst, Level::High); + + log::info!("Intializing SPI Device..."); + let spi_device = ExclusiveDevice::new(spi_bus, cs, delay).expect("SPI device initialize error"); + let spi_interface = SPIInterface::new(spi_device, dc); + + // Setup EPD + log::info!("Intializing EPD..."); + let mut driver = WeActStudio290BlackWhiteDriver::new(spi_interface, busy, rst, delay); + let mut display = Display290BlackWhite::new(); + display.set_rotation(DisplayRotation::Rotate90); + driver.init().unwrap(); + + let style = MonoTextStyle::new(&PROFONT_24_POINT, Color::Black); + let _ = Text::with_text_style( + "Hello World!", + Point::new(8, 68), + style, + TextStyle::default(), + ) + .draw(&mut display); + + driver.full_update(&display).unwrap(); + + log::info!("Sleeping for 5s..."); + driver.sleep().unwrap(); + delay.delay(5_000.millis()); + + let mut n: u8 = 0; + loop { + log::info!("Wake up!"); + driver.wake_up().unwrap(); + + display.clear(Color::White); + + let mut string_buf = String::<30>::new(); + write!(string_buf, "Hello World {}!", n).unwrap(); + let _ = Text::with_text_style(&string_buf, Point::new(8, 68), style, TextStyle::default()) + .draw(&mut display) + .unwrap(); + string_buf.clear(); + + // TODO: try fast update? + driver.full_update(&display).unwrap(); + + n = n.wrapping_add(1); // Wrap from 0..255 + + log::info!("Sleeping for 5s..."); + driver.sleep().unwrap(); + delay.delay(5_000.millis()); + } +} + +#[derive(Debug, Default)] +struct MazeGame { + maze: Option>, +} + +impl MazeGame { + pub fn start(&mut self, trng: &mut Trng) { + let mut maze = maze::Grid::new(); + maze::RecursiveDivision.generate(&mut maze, trng); + self.maze = Some(maze); + } +}