From a78669cb31dc3cdf71b738365da20db2b65191a0 Mon Sep 17 00:00:00 2001 From: aOK Date: Mon, 27 Nov 2023 21:35:33 +0300 Subject: [PATCH] first commit --- .cargo/config.toml | 26 + .github/workflows/rust_ci.yml | 40 + .gitignore | 10 + Cargo.lock | 1719 +++++++++++++++++++++++++++++++++ Cargo.toml | 59 ++ LICENSE-APACHE | 201 ++++ LICENSE-MIT | 25 + README.md | 0 rust-toolchain.toml | 2 + src/main.rs | 334 +++++++ src/modem/mod.rs | 96 ++ src/serial.rs | 120 +++ 12 files changed, 2632 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 .github/workflows/rust_ci.yml create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 LICENSE-APACHE create mode 100644 LICENSE-MIT create mode 100644 README.md create mode 100644 rust-toolchain.toml create mode 100644 src/main.rs create mode 100644 src/modem/mod.rs create mode 100644 src/serial.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..1d9e811 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,26 @@ +[target.xtensa-esp32-none-elf] +runner = "espflash flash --monitor" + +[env] +ESP_LOGLEVEL="DEBUG" +# [build] +# rustflags = [ +# "-C", "link-arg=-Tlinkall.x", +# "-C", "link-arg=-Trom_functions.x", + +# # trace +# "-C", "force-frame-pointers", +# "-C", "target-feature=-loop", +# ] + +[build] +rustflags = [ + "-C", "link-arg=-Tlinkall.x", + "-C", "link-arg=-nostartfiles", +] + +target = "xtensa-esp32-none-elf" + +[unstable] +build-std = ["alloc", "core"] + diff --git a/.github/workflows/rust_ci.yml b/.github/workflows/rust_ci.yml new file mode 100644 index 0000000..1e3241e --- /dev/null +++ b/.github/workflows/rust_ci.yml @@ -0,0 +1,40 @@ +name: Continuous Integration + +on: + push: + paths-ignore: + - "**/README.md" + pull_request: + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + rust-checks: + name: Rust Checks + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + action: + - command: build + args: --release + - command: fmt + args: --all -- --check --color always + - command: clippy + args: --all-targets --all-features --workspace -- -D warnings + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Enable caching + uses: Swatinem/rust-cache@v2 + - name: Setup Rust + uses: esp-rs/xtensa-toolchain@v1.5 + with: + default: true + buildtargets: esp32 + ldproxy: false + - name: Run command + run: cargo ${{ matrix.action.command }} ${{ matrix.action.args }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73fab07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..66b7232 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1719 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "as-slice" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0" +dependencies = [ + "generic-array 0.12.4", + "generic-array 0.13.3", + "generic-array 0.14.7", + "stable_deref_trait", +] + +[[package]] +name = "as-slice" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "atat" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436cd635e27423d3aa4d0265cb7d0605db525353ba77c5f8d4f1f4e8c42e45cb" +dependencies = [ + "atat_derive", + "embassy-sync 0.3.0", + "embassy-time", + "embedded-io 0.6.1", + "embedded-io-async", + "futures", + "heapless", + "heapless-bytes", + "log", + "nom", + "serde_at", + "serde_bytes", +] + +[[package]] +name = "atat_derive" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "587a1c3224f8760e4c59c4b9730214aad2b752cfdaddbaae8de77e56a69eb318" +dependencies = [ + "proc-macro2", + "quote", + "serde_at", + "syn 2.0.39", +] + +[[package]] +name = "atomic-polyfill" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" +dependencies = [ + "critical-section", +] + +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + +[[package]] +name = "atomic-pool" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c5fc22e05ec2884db458bf307dc7b278c9428888d2b6e6fad9c0ae7804f5f6" +dependencies = [ + "as-slice 0.1.5", + "as-slice 0.2.1", + "atomic-polyfill 1.0.3", + "stable_deref_trait", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atomic_enum" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6227a8d6fdb862bcb100c4314d0d9579e5cd73fa6df31a2e6f6e1acd3c5f1207" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[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.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f2139706359229bfa8f19142ac1155b4b80beafb7a60471ac5dd109d4a19778" +dependencies = [ + "serde", +] + +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + +[[package]] +name = "bitfield" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "blinky" +version = "0.1.0" +dependencies = [ + "atat", + "atomic-polyfill 1.0.3", + "atomic_enum", + "crc", + "critical-section", + "defmt", + "embassy-executor", + "embassy-futures", + "embassy-net", + "embassy-net-driver", + "embassy-sync 0.4.0", + "embassy-time", + "embedded-hal-async", + "embedded-io 0.6.1", + "embedded-io-async", + "embedded-storage", + "embedded-svc", + "esp-alloc", + "esp-backtrace", + "esp-hal-common", + "esp-println", + "esp-storage", + "esp-wifi", + "esp-wifi-sys", + "esp32-hal", + "heapless", + "log", + "nb 1.1.0", + "rust-mqtt", + "smoltcp", + "static_cell", +] + +[[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 = "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 = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.39", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "defmt" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54f0216f6c5acb5ae1a47050a6645024e6edafc2ee32d421955eccfef12ef92e" +dependencies = [ + "defmt-parser", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "defmt-parser" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "269924c02afd7f94bc4cecbfa5c379f6ffcf9766b3408fe63d22c728654eccd0" +dependencies = [ + "thiserror", +] + +[[package]] +name = "embassy-executor" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac5b3658a8ecdcddf6d3fe0967fe0843d407071e0e32aa77ed03b60c66fbecf2" +dependencies = [ + "critical-section", + "embassy-macros", + "embassy-time", +] + +[[package]] +name = "embassy-futures" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" + +[[package]] +name = "embassy-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94d3eef431adfc517df1601e367f72b1c28a51c6eb91def7dc297be7fc8789a4" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "embassy-net" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8073df9cb1f4941aaf7b328809d8d3c02da2bde228607883e332672515636929" +dependencies = [ + "as-slice 0.2.1", + "atomic-pool", + "embassy-net-driver", + "embassy-sync 0.4.0", + "embassy-time", + "embedded-io-async", + "embedded-nal-async", + "futures", + "generic-array 0.14.7", + "heapless", + "log", + "managed", + "smoltcp", + "stable_deref_trait", +] + +[[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.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0525b466ca3ace30b57f2db868a35215dfaecd038d8668cb2db03feb7c069a0" +dependencies = [ + "cfg-if", + "critical-section", + "futures-util", + "heapless", +] + +[[package]] +name = "embassy-sync" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c86460434eb3defd987d872ecc1b8bc6a106a6770232180589a892721b5d8446" +dependencies = [ + "cfg-if", + "critical-section", + "futures-util", + "heapless", +] + +[[package]] +name = "embassy-time" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03bcc866a1d3c678da6fa1d28f655a074840b6122123975e156cfca7f1ccc78a" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-hal 0.2.7", + "embedded-hal-async", + "futures-util", + "heapless", +] + +[[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-dma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" +dependencies = [ + "stable_deref_trait", +] + +[[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-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2894bc2f0457b8ca3d6b8ab8aad64d9337583672494013457f86c5a9146c0e22" + +[[package]] +name = "embedded-hal-async" +version = "1.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a8a3517745342155b3b00895a0f78417a453fb800d97a8bf4777d5720acde9" +dependencies = [ + "embedded-hal 1.0.0-rc.1", +] + +[[package]] +name = "embedded-hal-nb" +version = "1.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "257e3bb0163c69195acb0ebe0083b017b963235861d5ea9741626abdc55f39c9" +dependencies = [ + "embedded-hal 1.0.0-rc.1", + "nb 1.1.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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "embedded-io-async" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de03527d6fb488b2d7c7a4dc81dfb6a657efe264256bfc70bb899746821666b1" +dependencies = [ + "embedded-io 0.6.1", +] + +[[package]] +name = "embedded-nal" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447416d161ba378782c13e82b11b267d6d2104b4913679a7c5640e7e94f96ea7" +dependencies = [ + "heapless", + "nb 1.1.0", + "no-std-net 0.6.0", +] + +[[package]] +name = "embedded-nal-async" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0f75f0ac83505f354443332324ef1399463902718b95b4ce153ae9b3660f341" +dependencies = [ + "embedded-io-async", + "embedded-nal", + "heapless", + "no-std-net 0.6.0", +] + +[[package]] +name = "embedded-storage" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "156d7a2fdd98ebbf9ae579cbceca3058cff946e13f8e17b90e3511db0508c723" + +[[package]] +name = "embedded-svc" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55feac55fb81e14c747d5475f05ead553855a133a36f979fa4e7883a240ee829" +dependencies = [ + "atomic-waker", + "embedded-io 0.6.1", + "enumset", + "heapless", + "no-std-net 0.5.0", + "serde", +] + +[[package]] +name = "enum-as-inner" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "enumset" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "esp-alloc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83792eb7261a375bb838679fea2b45654b8f4a48da6bef10a96da5054aa81c7d" +dependencies = [ + "critical-section", + "linked_list_allocator", +] + +[[package]] +name = "esp-backtrace" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f1f532fb2f820e2eeb7e5c7d479cdb8bdd939fe5d5a33c511e94371b0667ae" +dependencies = [ + "esp-println", +] + +[[package]] +name = "esp-hal-common" +version = "0.13.1" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=0433968ed899aebdffcbcf67845acb1a20d5ac37#0433968ed899aebdffcbcf67845acb1a20d5ac37" +dependencies = [ + "basic-toml", + "bitfield", + "bitflags 2.4.1", + "cfg-if", + "critical-section", + "embassy-executor", + "embassy-futures", + "embassy-sync 0.4.0", + "embassy-time", + "embedded-can", + "embedded-dma", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0-rc.1", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io 0.6.1", + "embedded-io-async", + "esp-hal-procmacros", + "esp-riscv-rt", + "esp-synopsys-usb-otg", + "esp32", + "esp32c2", + "esp32c3", + "esp32c6", + "esp32s2", + "esp32s3", + "fugit", + "heapless", + "log", + "nb 1.1.0", + "paste", + "portable-atomic", + "serde", + "strum 0.25.0", + "usb-device", + "void", + "xtensa-lx", + "xtensa-lx-rt", +] + +[[package]] +name = "esp-hal-procmacros" +version = "0.7.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=0433968ed899aebdffcbcf67845acb1a20d5ac37#0433968ed899aebdffcbcf67845acb1a20d5ac37" +dependencies = [ + "darling", + "litrs", + "object", + "proc-macro-crate", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "esp-println" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678ad508e8e61561eccee27003a5033901fe07fe8700508c324849b3df930ef5" +dependencies = [ + "critical-section", + "log", +] + +[[package]] +name = "esp-riscv-rt" +version = "0.5.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=0433968ed899aebdffcbcf67845acb1a20d5ac37#0433968ed899aebdffcbcf67845acb1a20d5ac37" +dependencies = [ + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-storage" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fa3fc3afc3a56b91522a35b9f773d40d2332d0a66ff1e8a823152cda4ff1923" +dependencies = [ + "critical-section", + "embedded-storage", +] + +[[package]] +name = "esp-synopsys-usb-otg" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc6734e87e7b86858f7884649deae6bf634d1e6f5b2d078e457cf4d72c541ec" +dependencies = [ + "critical-section", + "embedded-hal 0.2.7", + "usb-device", + "vcell", +] + +[[package]] +name = "esp-wifi" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d63238617d88e12989ca665a01216c8235e51fb968fee84418cec605498a51" +dependencies = [ + "atomic-polyfill 1.0.3", + "atomic_enum", + "cfg-if", + "critical-section", + "embassy-futures", + "embassy-net", + "embassy-sync 0.4.0", + "embedded-io 0.6.1", + "embedded-io-async", + "embedded-svc", + "enumset", + "esp-wifi-sys", + "esp32-hal", + "esp32c2-hal", + "esp32c3-hal", + "esp32c6-hal", + "esp32s2-hal", + "esp32s3-hal", + "fugit", + "heapless", + "libm", + "linked_list_allocator", + "log", + "num-derive", + "num-traits", + "smoltcp", + "toml-cfg", +] + +[[package]] +name = "esp-wifi-sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f768a41dbcdaffad531cd64e26952befca118221e36a963db1d735bce48dc69" +dependencies = [ + "anyhow", +] + +[[package]] +name = "esp32" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d09b309c801163288d7291b3f3f927b278efe1c3fe0a6f854c4be6bb50b1cf9" +dependencies = [ + "critical-section", + "vcell", + "xtensa-lx", +] + +[[package]] +name = "esp32-hal" +version = "0.16.0" +source = "git+https://github.com/esp-rs/esp-hal.git?rev=0433968ed899aebdffcbcf67845acb1a20d5ac37#0433968ed899aebdffcbcf67845acb1a20d5ac37" +dependencies = [ + "embassy-time", + "esp-hal-common", +] + +[[package]] +name = "esp32c2" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e195e823b9c3b2b13377fea639e42cb67bc481cd71b49d12dfc5f246cf96d08" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32c2-hal" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bcd1c93096fd2d583f4c8cd5c084c0e70c2ee677a9dffde0407b142297b1bc" +dependencies = [ + "esp-hal-common", +] + +[[package]] +name = "esp32c3" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e5cc6c0874ae7d8ea3997eeba05bf06926b92c788b556002e2c3eea52f5882" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32c3-hal" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b11a787ccbf8dfb1895c1fe1207effc002061e0fc705fa1d633dd88bbf9f5c" +dependencies = [ + "cfg-if", + "esp-hal-common", +] + +[[package]] +name = "esp32c6" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e456c778e9169f81789b7f990aeb276680231d48b10c9c7a14f5ac42d00a507" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32c6-hal" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56e03581a43995bb0b79b9490b4b1988866bb68f3fb3894de0fe7d6de414727" +dependencies = [ + "esp-hal-common", +] + +[[package]] +name = "esp32s2" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08b66c2f65dae760a209609661a52235e95c612fd640c22663a90747028508ea" +dependencies = [ + "critical-section", + "vcell", + "xtensa-lx", +] + +[[package]] +name = "esp32s2-hal" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63bab3dab3741cb86b076d784f795ebbdcba71e319964551e0e091116ba8ab72" +dependencies = [ + "esp-hal-common", + "xtensa-atomic-emulation-trap", +] + +[[package]] +name = "esp32s3" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d963e4278c6417d939dd3791f144b89341abd387cc1bf612fbbd4cf585c0f669" +dependencies = [ + "critical-section", + "vcell", + "xtensa-lx", +] + +[[package]] +name = "esp32s3-hal" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567d3c5f0d708028533811bb255b099aff0a7d61e2ddbf0b44d2485eeb612c99" +dependencies = [ + "esp-hal-common", +] + +[[package]] +name = "flate2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[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 = "futures" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-io" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" + +[[package]] +name = "futures-macro" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[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.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309" +dependencies = [ + "typenum", +] + +[[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.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "heapless" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" +dependencies = [ + "atomic-polyfill 0.1.11", + "hash32", + "rustc_version", + "serde", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "heapless-bytes" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7285eba272c6af3e9f15fb9e1c1b6e7d35aa70580ffe0d47af017e97dfb6f48b" +dependencies = [ + "heapless", + "serde", + "typenum", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[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.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linked_list_allocator" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "minijinja" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "208758577ef2c86cf5dd3e85730d161413ec3284e2d73b2ef65d9a24d9971bcb" +dependencies = [ + "serde", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mutex-trait" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4bb1638d419e12f8b1c43d9e639abd0d1424285bdea2f76aa231e233c63cd3a" + +[[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 = "no-std-net" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bcece43b12349917e096cddfa66107277f123e6c96a5aea78711dc601a47152" + +[[package]] +name = "no-std-net" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "portable-atomic" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" + +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +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.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +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_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "riscv" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa3145d2fae3778b1e31ec2e827b228bdc6abd9b74bb5705ba46dcb82069bc4f" +dependencies = [ + "bit_field", + "critical-section", + "embedded-hal 0.2.7", +] + +[[package]] +name = "riscv-rt-macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38509d7b17c2f604ceab3e5ff8ac97bb8cd2f544688c512be75c715edaf4daf" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rust-mqtt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdc13ec0011fe629417adf19495d202855fdfa63abbf44c34552d18adce3b5f8" +dependencies = [ + "embedded-io 0.4.0", + "heapless", + "rand_core", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ruzstd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" +dependencies = [ + "byteorder", + "thiserror-core", + "twox-hash", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" + +[[package]] +name = "serde" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_at" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff104a9bc21b1b4bf5fda20ee281fab64f27b70f3cca03e3048c05de63ebabff" +dependencies = [ + "heapless", + "num-traits", + "serde", +] + +[[package]] +name = "serde_bytes" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "smoltcp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d2e3a36ac8fea7b94e666dfa3871063d6e0a5c9d5d4fec9a1a6b7b6760f0229" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "cfg-if", + "heapless", + "managed", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[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 = "static_cell" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa6ba4cf83bf80d3eb25f098ea5e790a0a1fcb5e357442259b231e412c2d3ca0" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros 0.25.3", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.39", +] + +[[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.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-core" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c001ee18b7e5e3f62cbf58c7fe220119e68d902bb7443179c0c8aef30090e999" +dependencies = [ + "thiserror-core-impl", +] + +[[package]] +name = "thiserror-core-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml-cfg" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91dbf509587452b781d208257bfe9923808873290d99505ee0eb0e6599540bdf" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "serde", + "syn 1.0.109", + "toml", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" + +[[package]] +name = "toml_edit" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +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 = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "usb-device" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" + +[[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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "winnow" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +dependencies = [ + "memchr", +] + +[[package]] +name = "xtensa-atomic-emulation-trap" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd1632531f5d8ba78dabeff8b006a0d675560f436727479138a3dd194f0582b" + +[[package]] +name = "xtensa-lx" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9490addc0a1edd86e571a9ed8063f33d8224f981e61bbf72279671ed0cb4bb7c" +dependencies = [ + "bare-metal", + "mutex-trait", + "spin", +] + +[[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.39", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..509acb4 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,59 @@ +[package] +name = "blinky" +version = "0.1.0" +authors = ["aok"] +edition = "2021" +license = "MIT OR Apache-2.0" + +[profile.dev] +lto = "off" +[profile.release] +lto = "off" + +[dependencies] +# hal = { package = "esp32-hal", version = "0.16.0" } +# esp-backtrace = { version = "0.9.0", features = ["esp32", "panic-handler", "exception-handler", "print-uart"] } +# esp-println = { version = "0.7.0", features = ["esp32"] } +defmt = "=0.3.5" +critical-section = "1.1.1" +atomic-polyfill = "1.0.3" +atomic_enum = "0.2.0" +# 0433968ed899aebdffcbcf67845acb1a20d5ac37 +# hal = { package = "esp32-hal", version = "0.16.0", features=["embassy","async","embassy-time-timg0"]} +hal = { package = "esp32-hal", version = "0.16.0", features=["embassy","async","embassy-time-timg0", "embassy-executor-thread"]} +esp-hal-common = "0.13.1" +esp-backtrace = { version = "0.9.0", features = ["esp32", "panic-handler", "exception-handler", "print-uart"] } +esp-println = { version = "0.7.0", features = ["esp32", "log"] } +log = { version = "0.4.18"} +esp-alloc = { version = "0.3.0" } +# esp-wifi = { version = "https://github.com/esp-rs/esp-wifi/", rev = "97a2c4c", features = ["esp32", "embedded-svc", "wifi", "embassy-net", "async"] } +esp-wifi = { version = "0.1.1", features = ["esp32", "embedded-svc", "wifi", "embassy-net", "async"] } +# esp-wifi-sys = { git = "https://github.com/esp-rs/esp-wifi/", rev = "97a2c4c"} +esp-wifi-sys = { version = "0.1.0" } +smoltcp = { version = "0.10.0", default-features=false, features = ["proto-igmp", "proto-ipv4", "socket-tcp", "socket-icmp", "socket-udp", "medium-ethernet", "proto-dhcpv4", "socket-raw", "socket-dhcpv4"], optional = true} +embedded-svc = { version = "0.26.4", default-features = false, features = []} +embedded-io = " 0.6.1" +heapless = { version = "0.7.16", default-features = false } +embassy-time = "0.1.5" +embassy-executor = { version="0.3.3", features = ["nightly", "integrated-timers","arch-xtensa"] } +# embassy-executor = { version="0.3.3", features = ["nightly", "integrated-timers","arch-xtensa", "executor-thread"] } +static_cell = { version = "2.0.0", features = ["nightly"] } +embassy-net = { version = "0.2.1", features = ["nightly","tcp","proto-ipv4","medium-ethernet","dhcpv4", "dns", "log", "udp", "medium-ip" ]} +embassy-net-driver = { version = "0.2.0"} +embassy-sync = "0.4.0" +embassy-futures = "0.1.1" +embedded-storage = "0.3.0" +crc = "3.0.0" +rust-mqtt = { version = "0.1.5", default-features = false } +esp-storage = { version = "0.3.0", features = ["esp32"] } +embedded-hal-async = "1.0.0-rc.1" +embedded-io-async = "0.6.0" +nb = "1.1.0" +# atat = { version = "0.20.0", features = ["async"] } +atat = { version="0.20.0", features = ["async", "log"]} + +[patch.crates-io] +# esp32-hal = { git = "https://github.com/esp-rs/esp-hal.git", rev = "0433968ed899aebdffcbcf67845acb1a20d5ac37" } +hal = { package = "esp32-hal", git = "https://github.com/esp-rs/esp-hal.git", rev = "0433968ed899aebdffcbcf67845acb1a20d5ac37" } +esp-hal-common = { git = "https://github.com/esp-rs/esp-hal.git", rev = "0433968ed899aebdffcbcf67845acb1a20d5ac37" } +# esp-wifi = { git = "https://github.com/esp-rs/esp-wifi.git", rev = "0433968ed899aebdffcbcf67845acb1a20d5ac37" } diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..d2c040e --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..3d3dcba --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright [year] [fullname] + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 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/main.rs b/src/main.rs new file mode 100644 index 0000000..8482c18 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,334 @@ +//! The following wiring is setup: +//! - TX => GPIO15 +//! - RX => GPIO14 + +#![no_std] +#![no_main] +#![feature(type_alias_impl_trait)] +#![feature(utf8_chunks)] +mod modem; +mod serial; + +extern crate alloc; +use core::mem::MaybeUninit; +use esp_backtrace as _; +use esp_println::println; +// use hal::embassy::executor::Executor; + +use esp_wifi::{initialize, EspWifiInitFor}; + +use embassy_time::{Instant, Duration}; +use hal::{timer::TimerGroup, Rng}; +use embassy_executor::Spawner; +use embassy_sync::{blocking_mutex::raw::NoopRawMutex, signal::Signal}; +use hal::{ + clock::ClockControl, + embassy, + gpio::IO, + interrupt, + uart::{ + config::{Config, DataBits, Parity, StopBits}, + TxRxPins, + }, + Delay, + peripherals::{Interrupt, Peripherals, UART1}, + prelude::*, + Uart, + gpio::GpioPin, +}; +use hal::clock::{CpuClock, Clocks}; +use esp_hal_common::uart::{config::AtCmdConfig, UartRx, UartTx}; +use static_cell::make_static; + +use atat::{ + asynch::{ + AtatClient, + Client, + }, + AtatIngress, + Buffers, + DefaultDigester, + Ingress, + AtDigester, +}; + +#[global_allocator] +static ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty(); + +fn init_heap() { + const HEAP_SIZE: usize = 32 * 1024; + static mut HEAP: MaybeUninit<[u8; HEAP_SIZE]> = MaybeUninit::uninit(); + + unsafe { + ALLOCATOR.init(HEAP.as_mut_ptr() as *mut u8, HEAP_SIZE); + } +} +const AT_CMD: u8 = 0x04; + +const READ_BUF_SIZE: usize = 64; +const INGRESS_BUF_SIZE: usize = 1024; +const URC_CAPACITY: usize = 128; +const URC_SUBSCRIBERS: usize = 3; + +#[embassy_executor::task] +async fn ingress_task( + mut ingress: Ingress< + 'static, + DefaultDigester, + modem::Urc, + INGRESS_BUF_SIZE, + URC_CAPACITY, + URC_SUBSCRIBERS, + >, + mut rx: UartRx<'static, UART1>) +{ + log::info!("reading in ingress_task..."); + ingress.read_from(&mut rx).await; +} + +#[embassy_executor::task] +async fn test_send(mut client: Client<'static, UartTx<'static, UART1>, INGRESS_BUF_SIZE>) { + let mut state: u8 = 0; + loop { + match state { + 0 => { + match client.send(&modem::GetModelId).await { + Ok(d) => log::info!("GetModelId Sent: {:?}", d), + Err(e) => { + match e { + atat::Error::Timeout => log::error!("[GetModelId] - Timeout Error: {:?}", e), + atat::Error::Parse => log::error!("[GetModelId] - Parse Error: Cound not parse: {:?}", e), + _ => {} + } + }, + } + } + 1 => { + // println!("sending a single message (GetManufacturerId)"); + // log::info!("sending a single message (GetManufacturerId)"); + // client.send(&modem::GetManufacturerId).await.unwrap(); + // log::info!("(GetManufacturerId) sent"); + match client.send(&modem::GetManufacturerId).await { + Ok(d) => log::info!("GetManufacturerId Sent: {:?}", d), + Err(e) => { + match e { + atat::Error::Timeout => log::error!("[GetManufacturerId] - Timeout Error: {:?}", e), + atat::Error::Parse => log::error!("[GetManufacturerId] - Parse Error: Cound not parse: {:?}", e), + _ => {} + } + }, + } + } + 2 => { + // println!("sending a single message (GetSoftwareVersion)"); + // log::info!("sending a single message (GetSoftwareVersion)"); + // client.send(&modem::GetSoftwareVersion).await.unwrap(); + // log::info!("(GetSoftwareVersion) sent"); + match client.send(&modem::GetSoftwareVersion).await { + Ok(d) => log::info!("GetSoftwareVersion Sent: {:?}", d), + Err(e) => { + match e { + atat::Error::Timeout => log::error!("[GetSoftwareVersion] - Timeout Error: {:?}", e), + atat::Error::Parse => log::error!("[GetSoftwareVersion] - Parse Error: Cound not parse: {:?}", e), + _ => {} + } + }, + } + } + 3 => { + // println!("sending a single message (GetWifiMac)"); + // log::info!("sending a single message (GetWifiMac)"); + // client.send(&modem::GetWifiMac).await.unwrap(); + // log::info!("(GetWifiMac) sent"); + match client.send(&modem::GetWifiMac).await { + Ok(d) => log::info!("GetWifiMac Sent: {:?}", d), + Err(e) => { + match e { + atat::Error::Timeout => log::error!("[GetWifiMac] - Timeout Error: {:?}", e), + atat::Error::Parse => log::error!("[GetWifiMac] - Parse Error: Cound not parse: {:?}", e), + _ => {} + } + }, + } + } + 4 => { + // println!("sending a single message (GetAT)"); + // log::info!("sending a single message (GetAT)"); + // client.send(&modem::GetAT).await.unwrap(); + // log::info!("(GetAT) sent"); + match client.send(&modem::GetAT).await { + Ok(d) => log::info!("GetAT Sent: {:?}", d), + Err(e) => { + match e { + atat::Error::Timeout => log::error!("[GetAT] - Timeout Error: {:?}", e), + atat::Error::Parse => log::error!("[GetAT] - Parse Error: Cound not parse: {:?}", e), + _ => {} + } + }, + } + // log::info!("AT Command Hit"); + } + // _ => state = 0, + _ => break, + } + + embassy_time::Timer::after(embassy_time::Duration::from_secs(2)).await; + // log::info!("{}", state); + + state += 1; + } +} +pub struct LossyStr<'a>(pub &'a [u8]); + +impl<'a> core::fmt::Debug for LossyStr<'a> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match core::str::from_utf8(self.0) { + Ok(s) => write!(f, "{:?}", s), + Err(_) => write!(f, "{:?}", self.0), + } + } +} +#[entry] +fn main() -> ! { + init_heap(); + esp_println::logger::init_logger_from_env(); + log::info!("Logger is setup"); + let peripherals = Peripherals::take(); + let system = peripherals.SYSTEM.split(); + let clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze(); + let mut delay = Delay::new(&clocks); + + + let timer_group0 = TimerGroup::new( + peripherals.TIMG0, + &clocks, + ); + embassy::init(&clocks, timer_group0.timer0); + let io = IO::new(peripherals.GPIO, peripherals.IO_MUX); + interrupt::enable(Interrupt::UART1, interrupt::Priority::Priority1).unwrap(); + + let (ingress, client, rx14) = + // let (tx, rx, signal) = + uart_device_setup( + // serial::uart_serial_setup( + delay, + io.pins.gpio15, + io.pins.gpio14, + peripherals.UART1, + &clocks, + ); + + println!("Starting embassy executor ..."); + + // let executor = make_static!(embassy_executor::Executor::new()); + // let executor = make_static!(hal::embassy::executor::Executor::new()); + static CELL: static_cell::StaticCell = static_cell::StaticCell::new(); + let executor = CELL.init(hal::embassy::executor::Executor::new()); + executor.run(|spawner| { + let _ = spawner.spawn(ingress_task(ingress, rx14)); + let _ = spawner.spawn(test_send(client)); + }) +} + +pub fn uart_device_setup( + mut delay: Delay, + gpio15: GpioPin, + gpio14: GpioPin, + UART1_per: UART1, + clocks: &Clocks<'static> +) -> ( + Ingress<'static, AtDigester, modem::Urc, INGRESS_BUF_SIZE, URC_CAPACITY, URC_SUBSCRIBERS>, + atat::asynch::Client<'static, UartTx<'static, hal::peripherals::UART1>, INGRESS_BUF_SIZE>, + UartRx<'static, UART1> +){ + + let modem_uart_pins = TxRxPins::new_tx_rx( + gpio15.into_push_pull_output(), + gpio14.into_floating_input(), + ); + + let config = Config { + baudrate: 115200, + data_bits: DataBits::DataBits8, + parity: Parity::ParityNone, + stop_bits: StopBits::STOP1, + }; + + // UART interface for the GSM modem + let mut uart = Uart::new_with_config( + UART1_per, + config, + Some(modem_uart_pins), + &clocks, + ); + uart.set_at_cmd(AtCmdConfig::new(None, None, None, AT_CMD, None)); + uart.set_rx_fifo_full_threshold(READ_BUF_SIZE as u16).unwrap(); + // uart.set_rx_fifo_full_threshold(1).unwrap(); + let (mut tx, mut rx) = uart.split(); + + static BUFFERS: Buffers = + Buffers::::new(); + + let digester = DefaultDigester::::default(); + // .with_custom_success(|buf| { + // let mut mbuf = buf.to_vec(); // Make a mutable copy + // let filtered_buf = filter_sequence(&mut mbuf); + // let result = core::str::from_utf8(&filtered_buf);//.unwrap_or("Invalid UTF-8"); + // match result { + // Ok(data_str) => { + // println!("Valid UTF-8:\n {}", data_str); + // } + // Err(e) => { + // // println!("Invalid UTF-8:\n {:?}", mbuf); + // println!("Invalid UTF-8:\n {:?}", e); + // } + // } + // Ok((buf, buf.len())) + // }); + + // Atat client + let config = atat::Config::default() + .flush_timeout(Duration::from_millis(2000)) + .cmd_cooldown(Duration::from_millis(200)) + .tx_timeout(Duration::from_millis(2000)); + let (ingress, client) = BUFFERS.split( + tx, + digester, + config, + ); + (ingress, client, rx) +} + +fn filter_sequence(buf: &mut [u8]) -> &[u8] { + let mut read_idx = 0; + let mut write_idx = 0; + + while read_idx < buf.len() { + let byte = buf[read_idx]; + + if byte != 0 && byte != 202 && byte != 61 && byte != 129 && byte != 37 + { + buf[write_idx] = byte; + write_idx += 1; + } + + read_idx += 1; + } + + &buf[..write_idx] +} + +fn replace_newline_with_ctrl_d(input_str: &[u8]) -> alloc::vec::Vec { + // Byte value for Ctrl+D + let ctrl_d: u8 = 4; + + // Replace "\n" with Ctrl+D in the input string + let mut replaced_str = input_str.to_vec(); + for byte in replaced_str.iter_mut() { + if *byte == b'\n' { + *byte = ctrl_d; + } + } + + replaced_str +} \ No newline at end of file diff --git a/src/modem/mod.rs b/src/modem/mod.rs new file mode 100644 index 0000000..abcfc12 --- /dev/null +++ b/src/modem/mod.rs @@ -0,0 +1,96 @@ +//! Responses for General Commands +use atat::heapless::String; +use atat::atat_derive::AtatUrc; + +use atat::atat_derive::{AtatCmd, AtatResp}; + +#[derive(Clone, AtatResp)] +pub struct NoResponse; + +#[derive(Clone, AtatCmd)] +#[at_cmd("", NoResponse, timeout_ms = 1000)] +pub struct AT; + +#[derive(Clone, AtatUrc)] +pub enum Urc { + #[at_urc("+UMWI")] + MessageWaitingIndication(MessageWaitingIndication), +} + + +#[derive(Clone, AtatResp)] +pub struct MessageWaitingIndication; + + + + +/// 4.1 Manufacturer identification +/// Text string identifying the manufacturer. +#[derive(Clone, Debug, AtatResp)] +pub struct ManufacturerId { + pub id: String<64>, +} + +/// Model identification +/// Text string identifying the manufacturer. +#[derive(Clone, Debug, AtatResp)] +pub struct ModelId { + pub id: String<64>, +} + +/// Software version identification +/// Read a text string that identifies the software version of the module. +#[derive(Clone, Debug, AtatResp)] +pub struct SoftwareVersion { + pub id: String<64>, +} + +/// 7.11 Wi-Fi Access point station list +UWAPSTALIST +#[derive(Clone, Debug, AtatResp)] +pub struct WifiMac { + pub mac_addr: atat::heapless_bytes::Bytes<12>, +} + +#[derive(Clone, Debug, AtatResp)] +pub struct ATCOMMAND { + pub id: String<64>, +} + +// use atat::atat_derive::AtatCmd; +// use responses::*; + +/// 4.1 Manufacturer identification +CGMI +/// +/// Text string identifying the manufacturer. +#[derive(Clone, AtatCmd)] +#[at_cmd("+CGMI", ManufacturerId)] +pub struct GetManufacturerId; + +/// Model identification +CGMM +/// +/// Read a text string that identifies the device model. +#[derive(Clone, AtatCmd)] +#[at_cmd("+CGMM", ModelId)] +pub struct GetModelId; + +/// Software version identification +CGMR +/// +/// Read a text string that identifies the software version of the module +#[derive(Clone, AtatCmd)] +#[at_cmd("+CGMR", SoftwareVersion)] +pub struct GetSoftwareVersion; + +/// 7.12 Wi-Fi MAC address +UWAPMACADDR +/// +/// Lists the currently used MAC address. +#[derive(Clone, AtatCmd)] +#[at_cmd("+UWAPMACADDR", WifiMac)] +pub struct GetWifiMac; + + +/// 7.12 check if device ok AT +/// +/// Lists the currently used MAC address. +#[derive(Clone, AtatCmd)] +#[at_cmd("", ATCOMMAND)] +pub struct GetAT; \ No newline at end of file diff --git a/src/serial.rs b/src/serial.rs new file mode 100644 index 0000000..eaab714 --- /dev/null +++ b/src/serial.rs @@ -0,0 +1,120 @@ +use embassy_time::{Timer, Duration}; +use hal::{peripherals::UART1, gpio::GpioPin}; +use hal::{ + uart::{ + config::{Config, DataBits, Parity, StopBits}, + TxRxPins, + }, + Uart, clock::Clocks +}; +use embassy_sync::{blocking_mutex::raw::NoopRawMutex, signal::Signal}; +use esp_hal_common::uart::config::AtCmdConfig; +use esp_hal_common::uart::{ UartRx, UartTx}; +use esp_backtrace as _; +use static_cell::make_static; + +#[allow(dead_code)] +const READ_BUF_SIZE: usize = 64; + +#[allow(dead_code)] +const AT_CMD: u8 = 0x04; + +pub fn uart_serial_setup(gpio1: GpioPin, gpio3: GpioPin, uart0_per: UART1, clocks: &Clocks<'static>) -> ( + UartTx<'static, UART1>, + UartRx<'static, UART1>, + &'static Signal, +){ + let config = Config { + baudrate: 115200, + data_bits: DataBits::DataBits8, + parity: Parity::ParityNone, + stop_bits: StopBits::STOP1, + }; + + let pins = TxRxPins::new_tx_rx( + gpio1.into_push_pull_output(), + gpio3.into_floating_input(), + ); + + let mut serial1 = Uart::new_with_config(uart0_per, config, Some(pins), &clocks); + serial1 + .set_rx_fifo_full_threshold(READ_BUF_SIZE as u16) + .unwrap(); + let (tx15, rx14) = serial1.split(); + + let signal = &*make_static!(Signal::new()); + + (tx15, rx14, signal) + +} + +#[embassy_executor::task] +pub async fn at_writer(mut tx: UartTx<'static, UART1>, signal: &'static Signal) { + use core::fmt::Write; + // embedded_io_async::Write::write( + // // embedded_io_async::Write::write_all( + // &mut tx, + // b"AT+CGMI", + // // b"AT with EOT (CTRL-D).\r\n", + // ) + // .await + // .unwrap(); + + embedded_io_async::Write::write(&mut tx, b"AT+CGMI").await.unwrap(); + // embedded_io_async::Write::write_all(cmd).await.map_err(|_| Error::Write)?; + + // for _ in 0..3 { + // match embedded_io_async::Write::write_all(&mut tx, b"AT+CGMI").await { + // Ok(_r) => {},//esp_println::println!("SIZE RESPONSE: {:?}", r), + // // Err(atat::Error::Timeout) => {}, + // Err(_) => log::error!("Write Error"), + // }; + // // embedded_io_async::Write::flush(&mut tx).await.unwrap(); + // } + + + embedded_io_async::Write::flush(&mut tx).await.unwrap(); + // loop { + // let bytes_read = signal.wait().await; + // signal.reset(); + // write!(&mut tx, "\r\n-- received {} bytes --\r\n", bytes_read).unwrap(); + // embedded_io_async::Write::flush(&mut tx).await.unwrap(); + // } +} +#[embassy_executor::task] +pub async fn at_reader(mut rx: UartRx<'static, UART1>, signal: &'static Signal) { + const MAX_BUFFER_SIZE: usize = 100 * READ_BUF_SIZE + 16; + + let mut rbuf: [u8; MAX_BUFFER_SIZE] = [0u8; MAX_BUFFER_SIZE]; + let mut offset = 0; + loop { + let r = embedded_io_async::Read::read(&mut rx, &mut rbuf[offset..]).await; + match r { + Ok(len) => { + offset += len; + // if &rbuf[..offset] == b"OK\r\n" { + // esp_println::println!("Received OK response"); + // } else if &rbuf[..offset] == b"+CME ERROR: 58\r\n" { + // esp_println::println!("Received Error response: 58"); + // } + + // +CME ERROR: 58 + let data_str = core::str::from_utf8(&rbuf[..offset]).unwrap_or("Invalid UTF-8"); + // log::info!("Read: {}, data: {}", len, data_str); + if data_str.contains("OK") { + esp_println::println!("Received OK response"); + } else if data_str.contains("+CME ERROR: 58") { + esp_println::println!("Received Error response: 58"); + } else { + // Timer::after(Duration::from_millis(3000)).await; + esp_println::println!("Read: {}, data: {}\n", len, data_str); + } + // esp_println::println!("Read: {}, data: {}\n", len, data_str); + // esp_println::println!("Read: {len}, data: {:?}", &rbuf[..offset]); + offset = 0; + signal.signal(len); + } + Err(e) => esp_println::println!("RX Error: {:?}", e), + } + } +} \ No newline at end of file