mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-17 13:22:53 +01:00
add esp-wifi example embassy_dhcp
This commit is contained in:
parent
574376bef4
commit
1469af8dab
@ -3,8 +3,12 @@ runner = "espflash flash --monitor"
|
||||
|
||||
[build]
|
||||
rustflags = [
|
||||
"-C", "link-arg=-nostartfiles",
|
||||
"-C", "link-arg=-Wl,-Tlinkall.x",
|
||||
"-C",
|
||||
"link-arg=-nostartfiles",
|
||||
"-C",
|
||||
"link-arg=-Wl,-Tlinkall.x",
|
||||
"-C",
|
||||
"link-arg=-Trom_functions.x",
|
||||
]
|
||||
|
||||
target = "xtensa-esp32s3-none-elf"
|
||||
|
419
Cargo.lock
generated
419
Cargo.lock
generated
@ -17,6 +17,27 @@ version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
|
||||
|
||||
[[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 = "atomic-polyfill"
|
||||
version = "0.1.11"
|
||||
@ -35,6 +56,18 @@ 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.2",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
@ -56,6 +89,12 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.2.1"
|
||||
@ -113,6 +152,16 @@ dependencies = [
|
||||
"darling_macro 0.14.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944"
|
||||
dependencies = [
|
||||
"darling_core 0.20.1",
|
||||
"darling_macro 0.20.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.13.4"
|
||||
@ -141,6 +190,19 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.13.4"
|
||||
@ -163,6 +225,17 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a"
|
||||
dependencies = [
|
||||
"darling_core 0.20.1",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-executor"
|
||||
version = "0.2.0"
|
||||
@ -172,11 +245,25 @@ dependencies = [
|
||||
"atomic-polyfill 1.0.2",
|
||||
"critical-section",
|
||||
"embassy-macros",
|
||||
"embassy-time",
|
||||
"embassy-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-util",
|
||||
"static_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-futures"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47e5367165d347c039360f784812f493b001583ab6a3dd8622f4ce9c30374ec3"
|
||||
|
||||
[[package]]
|
||||
name = "embassy-hal-common"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy?rev=fb27594#fb27594b2eb2cca2aea25dd92a7b730c185b6ecc"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-macros"
|
||||
version = "0.2.0"
|
||||
@ -189,6 +276,58 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy?rev=fb27594#fb27594b2eb2cca2aea25dd92a7b730c185b6ecc"
|
||||
dependencies = [
|
||||
"as-slice 0.2.1",
|
||||
"atomic-polyfill 1.0.2",
|
||||
"atomic-pool",
|
||||
"embassy-hal-common",
|
||||
"embassy-net-driver",
|
||||
"embassy-sync 0.2.0 (git+https://github.com/embassy-rs/embassy?rev=fb27594)",
|
||||
"embassy-time 0.1.1 (git+https://github.com/embassy-rs/embassy?rev=fb27594)",
|
||||
"embedded-io 0.4.0",
|
||||
"embedded-nal-async",
|
||||
"futures",
|
||||
"generic-array 0.14.7",
|
||||
"heapless",
|
||||
"managed",
|
||||
"smoltcp",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net-driver"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy?rev=fb27594#fb27594b2eb2cca2aea25dd92a7b730c185b6ecc"
|
||||
|
||||
[[package]]
|
||||
name = "embassy-sync"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0dad296a6f70bfdc32ef52442a31f98c28e1608893c1cecc9b6f419bab005a0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"embedded-io 0.4.0",
|
||||
"futures-util",
|
||||
"heapless",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-sync"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/embassy-rs/embassy?rev=fb27594#fb27594b2eb2cca2aea25dd92a7b730c185b6ecc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"embedded-io 0.4.0",
|
||||
"futures-util",
|
||||
"heapless",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time"
|
||||
version = "0.1.1"
|
||||
@ -204,6 +343,19 @@ dependencies = [
|
||||
"heapless",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/embassy-rs/embassy?rev=fb27594#fb27594b2eb2cca2aea25dd92a7b730c185b6ecc"
|
||||
dependencies = [
|
||||
"atomic-polyfill 1.0.2",
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"embedded-hal 0.2.7",
|
||||
"futures-util",
|
||||
"heapless",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-dma"
|
||||
version = "0.2.0"
|
||||
@ -238,6 +390,54 @@ dependencies = [
|
||||
"embedded-hal 1.0.0-alpha.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-io"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33dfba9e6c113f2fd8537c943780a7345945e66c86972e356b1152e19481bcf5"
|
||||
|
||||
[[package]]
|
||||
name = "embedded-io"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced"
|
||||
|
||||
[[package]]
|
||||
name = "embedded-nal"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db9efecb57ab54fa918730f2874d7d37647169c50fa1357fecb81abee840b113"
|
||||
dependencies = [
|
||||
"heapless",
|
||||
"nb 1.1.0",
|
||||
"no-std-net 0.5.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-nal-async"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27ce84f518ca912777ec143db235f4d615e3bf8d4e46d507d6ef12daf5b1df98"
|
||||
dependencies = [
|
||||
"embedded-io 0.4.0",
|
||||
"embedded-nal",
|
||||
"heapless",
|
||||
"no-std-net 0.6.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-svc"
|
||||
version = "0.24.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2079f8182848872fb6e8eed2c1ba3aea409fc71984a9e8090733c08c404e7864"
|
||||
dependencies = [
|
||||
"embedded-io 0.3.1",
|
||||
"enumset",
|
||||
"heapless",
|
||||
"no-std-net 0.5.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enum-as-inner"
|
||||
version = "0.4.0"
|
||||
@ -250,6 +450,27 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumset"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59b025475ad197bd8b4a9bdce339216b6cf3bd568bf2e107c286b51613f0b3cf"
|
||||
dependencies = [
|
||||
"enumset_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumset_derive"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14c2852ff17a4c9a2bb2abbca3074737919cb05dc24b0a8ca9498081a7033dd6"
|
||||
dependencies = [
|
||||
"darling 0.20.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-backtrace"
|
||||
version = "0.7.0"
|
||||
@ -266,10 +487,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d077ffedaa2632004cf73e713438a18706d6d04d2fb0632ffe5a5f02bb9c17e0"
|
||||
dependencies = [
|
||||
"basic-toml",
|
||||
"bitflags",
|
||||
"bitflags 2.2.1",
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"embassy-time",
|
||||
"embassy-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-dma",
|
||||
"embedded-hal 0.2.7",
|
||||
"esp-hal-procmacros",
|
||||
@ -322,6 +543,41 @@ dependencies = [
|
||||
"vcell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-wifi"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/esp-rs/esp-wifi?rev=c446177984b82b5e1658d6b24318e7214460ded8#c446177984b82b5e1658d6b24318e7214460ded8"
|
||||
dependencies = [
|
||||
"atomic-polyfill 1.0.2",
|
||||
"critical-section",
|
||||
"embassy-futures",
|
||||
"embassy-net",
|
||||
"embassy-net-driver",
|
||||
"embassy-sync 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-hal 0.2.7",
|
||||
"embedded-io 0.4.0",
|
||||
"embedded-svc",
|
||||
"enumset",
|
||||
"esp-hal-common",
|
||||
"esp-wifi-sys",
|
||||
"esp32s3-hal",
|
||||
"fugit",
|
||||
"heapless",
|
||||
"linked_list_allocator",
|
||||
"log",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"smoltcp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp-wifi-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/esp-rs/esp-wifi?rev=c446177984b82b5e1658d6b24318e7214460ded8#c446177984b82b5e1658d6b24318e7214460ded8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "esp32s3"
|
||||
version = "0.18.0"
|
||||
@ -340,7 +596,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "552c3669d592a96479b2a526268e7b29421888defd08029c7bdc3c0c77cdee7c"
|
||||
dependencies = [
|
||||
"bare-metal",
|
||||
"embassy-time",
|
||||
"embassy-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-hal 0.2.7",
|
||||
"esp-hal-common",
|
||||
]
|
||||
@ -350,9 +606,13 @@ name = "esp_miner"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"embassy-executor",
|
||||
"embassy-time",
|
||||
"embassy-net",
|
||||
"embassy-time 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-io 0.4.0",
|
||||
"embedded-svc",
|
||||
"esp-backtrace",
|
||||
"esp-println",
|
||||
"esp-wifi",
|
||||
"esp32s3-hal",
|
||||
"fugit",
|
||||
"static_cell",
|
||||
@ -373,12 +633,59 @@ dependencies = [
|
||||
"gcd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.28"
|
||||
@ -392,6 +699,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
@ -403,6 +712,34 @@ 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"
|
||||
@ -453,6 +790,12 @@ dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linked_list_allocator"
|
||||
version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.9"
|
||||
@ -463,6 +806,21 @@ dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "managed"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
@ -499,6 +857,38 @@ 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 = "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.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.17.1"
|
||||
@ -645,6 +1035,19 @@ dependencies = [
|
||||
"syn 2.0.15",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smoltcp"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e9786ac45091b96f946693e05bfa4d8ca93e2d3341237d97a380107a6b38dea"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"byteorder",
|
||||
"cfg-if",
|
||||
"heapless",
|
||||
"managed",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
@ -736,6 +1139,12 @@ dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.8"
|
||||
|
34
Cargo.toml
34
Cargo.toml
@ -12,29 +12,45 @@ keywords = ["embedded", "embedded-hal", "esp", "esp32s3", "no-std"]
|
||||
categories = ["embedded", "no-std", "bitcoin"]
|
||||
|
||||
[dependencies]
|
||||
embassy-time = { version = "0.1.1", package = "embassy-time", features = [
|
||||
"nightly",
|
||||
"tick-hz-16_000_000",
|
||||
] }
|
||||
esp32s3-hal = { version = "0.9.0", package = "esp32s3-hal", features = [
|
||||
"embassy",
|
||||
"embassy-time-systick",
|
||||
] }
|
||||
embassy-executor = { version = "0.2.0", features = [
|
||||
"nightly",
|
||||
"integrated-timers",
|
||||
"arch-xtensa",
|
||||
"executor-thread",
|
||||
] }
|
||||
embassy-net = { git = "https://github.com/embassy-rs/embassy", rev = "fb27594", features = [
|
||||
"nightly",
|
||||
"tcp",
|
||||
"udp",
|
||||
"dhcpv4",
|
||||
"medium-ethernet",
|
||||
] }
|
||||
embassy-time = { version = "0.1.1", package = "embassy-time", features = [
|
||||
"nightly",
|
||||
"tick-hz-1_000_000",
|
||||
] }
|
||||
embedded-io = "0.4.0"
|
||||
embedded-svc = { version = "0.24.0", default-features = false, features = [] }
|
||||
esp-backtrace = { version = "0.7.0", features = [
|
||||
"esp32s3",
|
||||
"panic-handler",
|
||||
"exception-handler",
|
||||
"print-uart",
|
||||
] }
|
||||
esp32s3-hal = { version = "0.9.0", package = "esp32s3-hal", features = [
|
||||
"embassy",
|
||||
"embassy-time-timg0",
|
||||
] }
|
||||
esp-println = { version = "0.5.0", features = ["esp32s3"] }
|
||||
static_cell = "1.0.0"
|
||||
esp-wifi = { version = "0.1.0", git = "https://github.com/esp-rs/esp-wifi", rev = "c446177984b82b5e1658d6b24318e7214460ded8", features = [
|
||||
"async",
|
||||
"embassy-net",
|
||||
"embedded-svc",
|
||||
"esp32s3",
|
||||
"wifi",
|
||||
] }
|
||||
fugit = "0.3.6"
|
||||
static_cell = "1.0.0"
|
||||
|
||||
[features]
|
||||
generate-clki = []
|
||||
|
175
src/main.rs
175
src/main.rs
@ -3,7 +3,11 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use embassy_executor::Executor;
|
||||
use embassy_executor::_export::StaticCell;
|
||||
use embassy_net::tcp::TcpSocket;
|
||||
use embassy_net::{Config, Ipv4Address, Stack, StackResources};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embedded_svc::wifi::{ClientConfiguration, Configuration, Wifi};
|
||||
#[cfg(feature = "generate-clki")]
|
||||
use esp32s3_hal::ledc::{
|
||||
channel::{self, ChannelIFace},
|
||||
@ -11,28 +15,30 @@ use esp32s3_hal::ledc::{
|
||||
LSGlobalClkSource, LowSpeed, LEDC,
|
||||
};
|
||||
use esp32s3_hal::{
|
||||
clock::ClockControl, embassy, gpio::IO, peripherals::Peripherals, prelude::*,
|
||||
timer::TimerGroup, Delay, Rtc,
|
||||
clock::{ClockControl, CpuClock},
|
||||
embassy,
|
||||
gpio::IO,
|
||||
peripherals::Peripherals,
|
||||
prelude::*,
|
||||
timer::TimerGroup,
|
||||
Delay, Rng, Rtc,
|
||||
};
|
||||
use esp_backtrace as _;
|
||||
use esp_println::println;
|
||||
use esp_wifi::initialize;
|
||||
use esp_wifi::wifi::{WifiController, WifiDevice, WifiEvent, WifiMode, WifiState};
|
||||
use fugit::HertzU32;
|
||||
use static_cell::StaticCell;
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn run1() {
|
||||
loop {
|
||||
println!("Hello world from embassy using esp-hal-async!");
|
||||
Timer::after(Duration::from_millis(1_000)).await;
|
||||
}
|
||||
}
|
||||
const SSID: &str = env!("SSID");
|
||||
const PASSWORD: &str = env!("PASSWORD");
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn run2() {
|
||||
loop {
|
||||
println!("Bing!");
|
||||
Timer::after(Duration::from_millis(5_000)).await;
|
||||
}
|
||||
macro_rules! singleton {
|
||||
($val:expr) => {{
|
||||
type T = impl Sized;
|
||||
static STATIC_CELL: StaticCell<T> = StaticCell::new();
|
||||
let (x,) = STATIC_CELL.init(($val,));
|
||||
x
|
||||
}};
|
||||
}
|
||||
|
||||
static EXECUTOR: StaticCell<Executor> = StaticCell::new();
|
||||
@ -42,7 +48,7 @@ fn main() -> ! {
|
||||
println!("Init!");
|
||||
let peripherals = Peripherals::take();
|
||||
let mut system = peripherals.SYSTEM.split();
|
||||
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
|
||||
let clocks = ClockControl::configure(system.clock_control, CpuClock::Clock240MHz).freeze();
|
||||
|
||||
// Disable the RTC and TIMG watchdog timers
|
||||
let mut rtc = Rtc::new(peripherals.RTC_CNTL);
|
||||
@ -65,13 +71,18 @@ fn main() -> ! {
|
||||
wdt0.disable();
|
||||
wdt1.disable();
|
||||
|
||||
// #[cfg(feature = "embassy-time-systick")]
|
||||
embassy::init(
|
||||
let wifi_timer = timer_group1.timer0;
|
||||
initialize(
|
||||
wifi_timer,
|
||||
Rng::new(peripherals.RNG),
|
||||
system.radio_clock_control,
|
||||
&clocks,
|
||||
esp32s3_hal::systimer::SystemTimer::new(peripherals.SYSTIMER),
|
||||
);
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let (wifi, _) = peripherals.RADIO.split();
|
||||
let (wifi_interface, controller) = esp_wifi::wifi::new_with_mode(wifi, WifiMode::Sta);
|
||||
|
||||
#[cfg(feature = "embassy-time-timg0")]
|
||||
embassy::init(&clocks, timer_group0.timer0);
|
||||
|
||||
let io = IO::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||
@ -119,9 +130,125 @@ fn main() -> ! {
|
||||
bm_rst.set_high().unwrap();
|
||||
println!("Release BM1397 RST with gpio1 HIGH");
|
||||
|
||||
let wifi_config = Config::Dhcp(Default::default());
|
||||
let wifi_seed = 1234; // very random, very secure seed
|
||||
|
||||
// Init network stack
|
||||
let stack = &*singleton!(Stack::new(
|
||||
wifi_interface,
|
||||
wifi_config,
|
||||
singleton!(StackResources::<3>::new()),
|
||||
wifi_seed
|
||||
));
|
||||
|
||||
let executor = EXECUTOR.init(Executor::new());
|
||||
executor.run(|spawner| {
|
||||
spawner.spawn(run1()).ok();
|
||||
spawner.spawn(run2()).ok();
|
||||
spawner.spawn(connection(controller)).ok();
|
||||
spawner.spawn(net_task(&stack)).ok();
|
||||
spawner.spawn(task(&stack)).ok();
|
||||
});
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn connection(mut controller: WifiController<'static>) {
|
||||
println!("start connection task");
|
||||
println!("Device capabilities: {:?}", controller.get_capabilities());
|
||||
loop {
|
||||
match esp_wifi::wifi::get_wifi_state() {
|
||||
WifiState::StaConnected => {
|
||||
// wait until we're no longer connected
|
||||
controller.wait_for_event(WifiEvent::StaDisconnected).await;
|
||||
Timer::after(Duration::from_millis(5000)).await
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if !matches!(controller.is_started(), Ok(true)) {
|
||||
let client_config = Configuration::Client(ClientConfiguration {
|
||||
ssid: SSID.into(),
|
||||
password: PASSWORD.into(),
|
||||
..Default::default()
|
||||
});
|
||||
controller.set_configuration(&client_config).unwrap();
|
||||
println!("Starting wifi");
|
||||
controller.start().await.unwrap();
|
||||
println!("Wifi started!");
|
||||
}
|
||||
println!("About to connect...");
|
||||
|
||||
match controller.connect().await {
|
||||
Ok(_) => println!("Wifi connected!"),
|
||||
Err(e) => {
|
||||
println!("Failed to connect to wifi: {e:?}");
|
||||
Timer::after(Duration::from_millis(5000)).await
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn net_task(stack: &'static Stack<WifiDevice<'static>>) {
|
||||
stack.run().await
|
||||
}
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn task(stack: &'static Stack<WifiDevice<'static>>) {
|
||||
let mut rx_buffer = [0; 4096];
|
||||
let mut tx_buffer = [0; 4096];
|
||||
|
||||
loop {
|
||||
if stack.is_link_up() {
|
||||
break;
|
||||
}
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
}
|
||||
|
||||
println!("Waiting to get IP address...");
|
||||
loop {
|
||||
if let Some(config) = stack.config() {
|
||||
println!("Got IP: {}", config.address);
|
||||
break;
|
||||
}
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
}
|
||||
|
||||
loop {
|
||||
Timer::after(Duration::from_millis(1_000)).await;
|
||||
|
||||
let mut socket = TcpSocket::new(&stack, &mut rx_buffer, &mut tx_buffer);
|
||||
|
||||
socket.set_timeout(Some(embassy_net::SmolDuration::from_secs(10)));
|
||||
|
||||
let remote_endpoint = (Ipv4Address::new(142, 250, 185, 115), 80);
|
||||
println!("connecting...");
|
||||
let r = socket.connect(remote_endpoint).await;
|
||||
if let Err(e) = r {
|
||||
println!("connect error: {:?}", e);
|
||||
continue;
|
||||
}
|
||||
println!("connected!");
|
||||
let mut buf = [0; 1024];
|
||||
loop {
|
||||
use embedded_io::asynch::Write;
|
||||
let r = socket
|
||||
.write_all(b"GET / HTTP/1.0\r\nHost: www.mobile-j.de\r\n\r\n")
|
||||
.await;
|
||||
if let Err(e) = r {
|
||||
println!("write error: {:?}", e);
|
||||
break;
|
||||
}
|
||||
let n = match socket.read(&mut buf).await {
|
||||
Ok(0) => {
|
||||
println!("read EOF");
|
||||
break;
|
||||
}
|
||||
Ok(n) => n,
|
||||
Err(e) => {
|
||||
println!("read error: {:?}", e);
|
||||
break;
|
||||
}
|
||||
};
|
||||
println!("{}", core::str::from_utf8(&buf[..n]).unwrap());
|
||||
}
|
||||
Timer::after(Duration::from_millis(3000)).await;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user