Try jj
This commit is contained in:
parent
591c1153a4
commit
681d7410a4
8 changed files with 168 additions and 181 deletions
73
flake.lock
generated
73
flake.lock
generated
|
|
@ -41,11 +41,11 @@
|
|||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1750615580,
|
||||
"narHash": "sha256-8ucRXBCG5vA1nHCH1agRDBZaiuPKuqb/RsPxQEsHeVk=",
|
||||
"lastModified": 1751047748,
|
||||
"narHash": "sha256-KaS77WfbcLkLdqzeWP7GMgU5LltjOyjVxSzRhZbxPCc=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "e5dfaa34eed24f1ec79e99624666b15f51c4be97",
|
||||
"rev": "0350732a6725a550e4d2d69070774480dce86620",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -79,11 +79,11 @@
|
|||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1750574187,
|
||||
"narHash": "sha256-A2v6EQCnGk67cZstf5nxfH4ZUr9DpUovAvSrLaAfhUM=",
|
||||
"lastModified": 1751092526,
|
||||
"narHash": "sha256-vmbu97JXqr9/sTWR5XRh646jkp8a0J9m0o6JIQTdjE4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "263d9d394e9b9606a82c73941c4145052007799a",
|
||||
"rev": "6643d56d9a78afa157b577862c220298c09b891d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -248,11 +248,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1750117611,
|
||||
"narHash": "sha256-LTwASICtyN3AjzlF9l2ZNAIVZqclio3yRcwwZy3QSJA=",
|
||||
"lastModified": 1750955511,
|
||||
"narHash": "sha256-IDB/oh/P63ZTdhgSkey2LZHzeNhCdoKk+4j7AaPe1SE=",
|
||||
"owner": "cachix",
|
||||
"repo": "nix",
|
||||
"rev": "9e4fc95c388e2223d47da865503dee20d179776a",
|
||||
"rev": "afa41b08df4f67b8d77a8034b037ac28c71c77df",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -330,11 +330,11 @@
|
|||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1750365781,
|
||||
"narHash": "sha256-XE/lFNhz5lsriMm/yjXkvSZz5DfvKJLUjsS6pP8EC50=",
|
||||
"lastModified": 1750776420,
|
||||
"narHash": "sha256-/CG+w0o0oJ5itVklOoLbdn2dGB0wbZVOoDm4np6w09A=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "08f22084e6085d19bcfb4be30d1ca76ecb96fe54",
|
||||
"rev": "30a61f056ac492e3b7cdcb69c1e6abdcf00e39cf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -346,11 +346,11 @@
|
|||
},
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1750365781,
|
||||
"narHash": "sha256-XE/lFNhz5lsriMm/yjXkvSZz5DfvKJLUjsS6pP8EC50=",
|
||||
"lastModified": 1751011381,
|
||||
"narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "08f22084e6085d19bcfb4be30d1ca76ecb96fe54",
|
||||
"rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -376,6 +376,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_7": {
|
||||
"locked": {
|
||||
"lastModified": 1744536153,
|
||||
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
|
|
@ -383,17 +399,18 @@
|
|||
"fenix": "fenix",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"nixpkgs-python": "nixpkgs-python"
|
||||
"nixpkgs-python": "nixpkgs-python",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1750538096,
|
||||
"narHash": "sha256-8/KtURbFw0cd15WcqKJOMeF3JoxBbmjk2AWJ8Ud80WY=",
|
||||
"lastModified": 1750871759,
|
||||
"narHash": "sha256-hMNZXMtlhfjQdu1F4Fa/UFiMoXdZag4cider2R9a648=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "0ddaf2cd7b5c020addb5c35b09dc5ef409701522",
|
||||
"rev": "317542c1e4a3ec3467d21d1c25f6a43b80d83e7d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -403,6 +420,24 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_7"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1751078221,
|
||||
"narHash": "sha256-/SRmXIPxL7ixFLZgcDdgZDuIwt8eWQAamMYer0ODwbM=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "1712a6d3430ca75353d366b7ddd1c79d6b243efc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-python.url = "github:cachix/nixpkgs-python";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
|
||||
outputs = inputs @ {
|
||||
|
|
|
|||
122
xiao-esp32c6/Cargo.lock
generated
122
xiao-esp32c6/Cargo.lock
generated
|
|
@ -2,25 +2,6 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "Inflector"
|
||||
version = "0.11.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.3.0"
|
||||
|
|
@ -106,11 +87,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bt-hci"
|
||||
version = "0.2.1"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f377753756ec12e76b52d2dd657437be0448cc9736402ffadd0b8b8b9602c8a1"
|
||||
checksum = "fa7f7c19df9648c1da4f5356c4256533e38bd65633b6a41654922475a1c6d777"
|
||||
dependencies = [
|
||||
"embassy-sync 0.6.2",
|
||||
"embassy-sync 0.7.0",
|
||||
"embassy-time",
|
||||
"embedded-io",
|
||||
"embedded-io-async",
|
||||
|
|
@ -119,24 +100,11 @@ dependencies = [
|
|||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bt-hci"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa7f7c19df9648c1da4f5356c4256533e38bd65633b6a41654922475a1c6d777"
|
||||
dependencies = [
|
||||
"embassy-sync 0.7.0",
|
||||
"embedded-io",
|
||||
"embedded-io-async",
|
||||
"futures-intrusive",
|
||||
"heapless",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.18.1"
|
||||
version = "3.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee"
|
||||
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
|
|
@ -177,6 +145,15 @@ dependencies = [
|
|||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "convert_case"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.7"
|
||||
|
|
@ -716,7 +693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3700028d3d2ee57e6d2a5c5f60544711052f8d394e73a6f534b538fbfb9d058c"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"bt-hci 0.3.2",
|
||||
"bt-hci",
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"document-features",
|
||||
|
|
@ -924,9 +901,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.9.0"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
||||
checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
|
|
@ -967,12 +944,6 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.174"
|
||||
|
|
@ -1034,9 +1005,9 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
|
|||
|
||||
[[package]]
|
||||
name = "minijinja"
|
||||
version = "2.10.2"
|
||||
version = "2.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd72e8b4e42274540edabec853f607c015c73436159b06c39c7af85a20433155"
|
||||
checksum = "4e60ac08614cc09062820e51d5d94c2fce16b94ea4e5003bb81b99a95f84e876"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
|
@ -1203,35 +1174,6 @@ version = "0.9.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||
|
||||
[[package]]
|
||||
name = "riscv"
|
||||
version = "0.12.1"
|
||||
|
|
@ -1360,9 +1302,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
|||
|
||||
[[package]]
|
||||
name = "static_cell"
|
||||
version = "2.1.0"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d89b0684884a883431282db1e4343f34afc2ff6996fe1f4a1664519b66e14c1e"
|
||||
checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23"
|
||||
dependencies = [
|
||||
"portable-atomic",
|
||||
]
|
||||
|
|
@ -1458,13 +1400,13 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
|||
|
||||
[[package]]
|
||||
name = "trouble-host"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b31abacc7bd8bc686160f6de3347a3b7669ae4a31e4eef9a306466e97d297cea"
|
||||
checksum = "2f759a3da7d8501bf4be7a11d0754f1da3d2bad226d64cdad9314cec00288fbc"
|
||||
dependencies = [
|
||||
"bt-hci 0.2.1",
|
||||
"bt-hci",
|
||||
"embassy-futures",
|
||||
"embassy-sync 0.6.2",
|
||||
"embassy-sync 0.7.0",
|
||||
"embassy-time",
|
||||
"embedded-io",
|
||||
"futures",
|
||||
|
|
@ -1477,11 +1419,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "trouble-host-macros"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2798a58a818bdf9d98f5283cc7ac647f11ecbd1e5ff4cdc45a2a13c31bf86fd"
|
||||
checksum = "ab5c25c521a9a0cad8c62b86bd3ca9abd6c94842ecf62b64fc56f0d91bb1a426"
|
||||
dependencies = [
|
||||
"Inflector",
|
||||
"convert_case",
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -1507,6 +1449,12 @@ version = "1.0.18"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.17.0"
|
||||
|
|
@ -1747,7 +1695,7 @@ dependencies = [
|
|||
name = "xiao-esp32c6"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bt-hci 0.2.1",
|
||||
"bt-hci",
|
||||
"critical-section",
|
||||
"embassy-executor",
|
||||
"embassy-net",
|
||||
|
|
|
|||
|
|
@ -8,41 +8,38 @@ name = "xiao-esp32c6"
|
|||
path = "./src/bin/main.rs"
|
||||
|
||||
[dependencies]
|
||||
esp-bootloader-esp-idf = "0.1.0"
|
||||
esp-hal = { version = "=1.0.0-beta.1", features = [
|
||||
"esp32c6",
|
||||
"log-04",
|
||||
"unstable",
|
||||
bt-hci = { version = "*", features = [] }
|
||||
critical-section = "*"
|
||||
embassy-executor = { version = "*", features = [
|
||||
"log",
|
||||
"task-arena-size-20480",
|
||||
] }
|
||||
log = "0.4.27"
|
||||
|
||||
embassy-net = { version = "0.7.0", features = [
|
||||
embassy-net = { version = "*", features = [
|
||||
"dhcpv4",
|
||||
"log",
|
||||
"medium-ethernet",
|
||||
"tcp",
|
||||
"udp",
|
||||
] }
|
||||
embedded-io = "0.6.1"
|
||||
embedded-io-async = "0.6.1"
|
||||
esp-alloc = "0.8.0"
|
||||
esp-backtrace = { version = "0.16.0", features = [
|
||||
embassy-time = { version = "*", features = ["log"] }
|
||||
embedded-io = "*"
|
||||
embedded-io-async = "*"
|
||||
esp-alloc = "*"
|
||||
esp-backtrace = { version = "*", features = [
|
||||
"esp32c6",
|
||||
"exception-handler",
|
||||
"panic-handler",
|
||||
"println",
|
||||
] }
|
||||
esp-println = { version = "0.14.0", features = ["esp32c6", "log-04"] }
|
||||
# for more networking protocol support see https://crates.io/crates/edge-net
|
||||
bt-hci = { version = "0.2.1", features = [] }
|
||||
critical-section = "1.2.0"
|
||||
embassy-executor = { version = "0.7.0", features = [
|
||||
"log",
|
||||
"task-arena-size-20480",
|
||||
esp-bootloader-esp-idf = "*"
|
||||
esp-hal = { version = "=1.0.0-beta.1", features = [
|
||||
"esp32c6",
|
||||
"log-04",
|
||||
"unstable",
|
||||
] }
|
||||
embassy-time = { version = "0.4.0", features = ["log"] }
|
||||
esp-hal-embassy = { version = "0.8.1", features = ["esp32c6", "log-04"] }
|
||||
esp-wifi = { version = "0.14.1", features = [
|
||||
esp-hal-embassy = { version = "*", features = ["esp32c6", "log-04"] }
|
||||
esp-println = { version = "*", features = ["esp32c6", "log-04"] }
|
||||
esp-wifi = { version = "*", features = [
|
||||
"ble",
|
||||
"builtin-scheduler",
|
||||
"coex",
|
||||
|
|
@ -52,7 +49,8 @@ esp-wifi = { version = "0.14.1", features = [
|
|||
"smoltcp",
|
||||
"wifi",
|
||||
] }
|
||||
smoltcp = { version = "0.12.0", default-features = false, features = [
|
||||
log = "*"
|
||||
smoltcp = { version = "*", default-features = false, features = [
|
||||
"log",
|
||||
"medium-ethernet",
|
||||
"multicast",
|
||||
|
|
@ -65,8 +63,8 @@ smoltcp = { version = "0.12.0", default-features = false, features = [
|
|||
"socket-tcp",
|
||||
"socket-udp",
|
||||
] }
|
||||
static_cell = { version = "2.1.0", features = ["nightly"] }
|
||||
trouble-host = { version = "0.1.0", features = ["gatt"] }
|
||||
static_cell = { version = "*", features = ["nightly"] }
|
||||
trouble-host = { version = "*", features = ["gatt"] }
|
||||
|
||||
|
||||
[profile.dev]
|
||||
|
|
|
|||
|
|
@ -1,53 +1,53 @@
|
|||
#![no_std]
|
||||
|
||||
use bt_hci::controller::ExternalController;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use esp_hal::{
|
||||
clock::CpuClock,
|
||||
gpio::{Level, Output, OutputConfig},
|
||||
timer::{systimer::SystemTimer, timg::TimerGroup},
|
||||
timer::systimer::SystemTimer,
|
||||
};
|
||||
use esp_wifi::ble::controller::BleConnector;
|
||||
|
||||
pub mod tasks;
|
||||
|
||||
pub async fn entrypoint(spawner: Spawner) {
|
||||
// generator version: 0.4.0
|
||||
|
||||
pub async fn entrypoint(spawner: Spawner) -> ! {
|
||||
esp_println::logger::init_logger_from_env();
|
||||
|
||||
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||
let peripherals = esp_hal::init(config);
|
||||
|
||||
log::info!("Initialized peripherals");
|
||||
|
||||
esp_alloc::heap_allocator!(size: 64 * 1024);
|
||||
// COEX needs more RAM - so we've added some more
|
||||
esp_alloc::heap_allocator!(#[unsafe(link_section = ".dram2_uninit")] size: 64 * 1024);
|
||||
|
||||
let timer0 = SystemTimer::new(peripherals.SYSTIMER);
|
||||
esp_hal_embassy::init(timer0.alarm0);
|
||||
let system_timer = SystemTimer::new(peripherals.SYSTIMER);
|
||||
esp_hal_embassy::init(system_timer.alarm0);
|
||||
|
||||
log::info!("Embassy initialized!");
|
||||
log::info!("Initialized embassy");
|
||||
|
||||
let rng = esp_hal::rng::Rng::new(peripherals.RNG);
|
||||
let timer1 = TimerGroup::new(peripherals.TIMG0);
|
||||
let wifi_init = esp_wifi::init(timer1.timer0, rng, peripherals.RADIO_CLK)
|
||||
.expect("Failed to initialize WIFI/BLE controller");
|
||||
let (mut _wifi_controller, _interfaces) = esp_wifi::wifi::new(&wifi_init, peripherals.WIFI)
|
||||
.expect("Failed to initialize WIFI controller");
|
||||
// find more examples https://github.com/embassy-rs/trouble/tree/main/examples/esp32
|
||||
let transport = BleConnector::new(&wifi_init, peripherals.BT);
|
||||
let _ble_controller = ExternalController::<_, 20>::new(transport);
|
||||
|
||||
// TODO: Spawn some tasks
|
||||
let _ = spawner;
|
||||
log::info!("Initialized drivers");
|
||||
|
||||
spawner
|
||||
.spawn(tasks::wireless::setup_wireless(
|
||||
system_timer.alarm1,
|
||||
peripherals.BT,
|
||||
peripherals.RADIO_CLK,
|
||||
rng.clone(),
|
||||
peripherals.WIFI,
|
||||
))
|
||||
.expect("Failed to spawn task to setup wireless connections");
|
||||
|
||||
log::info!("Initializing wireless connections in background");
|
||||
|
||||
let mut led = Output::new(peripherals.GPIO15, Level::High, OutputConfig::default());
|
||||
|
||||
loop {
|
||||
log::info!("Blink!");
|
||||
log::info!("Slow blink!");
|
||||
led.toggle();
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after(Duration::from_secs(2)).await;
|
||||
}
|
||||
|
||||
// for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.0.0-beta.1/examples/src/bin
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
|
||||
pub mod wireless;
|
||||
|
|
|
|||
31
xiao-esp32c6/src/tasks/wireless.rs
Normal file
31
xiao-esp32c6/src/tasks/wireless.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
use bt_hci::controller::ExternalController;
|
||||
use embassy_executor::task;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use esp_hal::{
|
||||
peripherals::{BT, RADIO_CLK, WIFI},
|
||||
rng::Rng,
|
||||
timer::systimer::Alarm,
|
||||
};
|
||||
use esp_wifi::ble::controller::BleConnector;
|
||||
|
||||
#[task]
|
||||
pub async fn setup_wireless(
|
||||
alarm: Alarm<'static>,
|
||||
bt: BT<'static>,
|
||||
radio_clk: RADIO_CLK<'static>,
|
||||
rng: Rng,
|
||||
wifi: WIFI<'static>,
|
||||
) -> ! {
|
||||
let wifi_init =
|
||||
esp_wifi::init(alarm, rng, radio_clk).expect("Failed to initialize wireless module");
|
||||
// TODO: Use wifi controller
|
||||
let (_wifi_controller, _interfaces) =
|
||||
esp_wifi::wifi::new(&wifi_init, wifi).expect("Failed to initialize WIFI controller");
|
||||
let ble_connector = BleConnector::new(&wifi_init, bt);
|
||||
// TODO: Use bluetooth controller
|
||||
let _ble_controller = ExternalController::<_, 20>::new(ble_connector);
|
||||
loop {
|
||||
log::info!("No-op connection");
|
||||
Timer::after(Duration::from_secs(1)).await
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
//! Demo test suite using embedded-test
|
||||
//!
|
||||
//! You can run this using `cargo test` as usual.
|
||||
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
#[cfg(test)]
|
||||
#[embedded_test::tests(executor = esp_hal_embassy::Executor::new())]
|
||||
mod tests {
|
||||
use esp_hal::timer::systimer::SystemTimer;
|
||||
|
||||
#[init]
|
||||
fn init() {
|
||||
let peripherals = esp_hal::init(esp_hal::Config::default());
|
||||
|
||||
let timer0 = SystemTimer::new(peripherals.SYSTIMER);
|
||||
esp_hal_embassy::init(timer0.alarm0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
async fn hello_test() {
|
||||
embassy_time::Timer::after(embassy_time::Duration::from_millis(100)).await;
|
||||
assert_eq!(1 + 1, 2);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue