scratch repo for intrusive networking

Compare changes

Choose any two refs to compare.

Changed files
+1850 -7247
.github
assets
crates
demos
esp32c3
esp32c3-serial
src
esp32c6
esp32c6-serial
src
microbit
nrf52840
nrf52840-eusb
src
rp2040
rp2350
shared-icd
std
ergot-bridge-client
ergot-bridge-client-tcp
ergot-bridge-pair-udp
ergot-client
ergot-client-tcp
ergot-nusb-router
src
ergot-router
src
ergot-seed-router
src
log-client
log-client-tcp
log-router
log-router-serial
src
log-router-tcp
stream-plotting
src
tilt-app
src
stm32f303vc
stm32h723zg
.cargo
nucleoh723zg-blinky
nucleoh723zg-net-udp-pair
stm32h743zi
.cargo
nucleoh743zi-blinky
nucleoh743zi-net-udp-pair
notes
-6
.github/workflows/build-demos-nostd.yml
··· 46 working-directory: ./demos/rp2350 47 run: cargo build --all 48 # 49 - # ESP32C3 demos 50 - # 51 - - name: Check ESP32C3 Demos 52 - working-directory: ./demos/esp32c3 53 - run: cargo build --all 54 - # 55 # ESP32C6 demos 56 # 57 - name: Check ESP32C6 Demos
··· 46 working-directory: ./demos/rp2350 47 run: cargo build --all 48 # 49 # ESP32C6 demos 50 # 51 - name: Check ESP32C6 Demos
assets/eurorust-2025-ergot.pdf

This is a binary file and will not be displayed.

-1
checkall.sh
··· 13 cargo check --all --target=thumbv7em-none-eabi --manifest-path=./demos/microbit/Cargo.toml 14 cargo check --all --target=thumbv7em-none-eabi --manifest-path=./demos/nrf52840/Cargo.toml 15 cargo check --all --target=thumbv6m-none-eabi --manifest-path=./demos/rp2040/Cargo.toml 16 - cargo check --all --target=riscv32imc-unknown-none-elf --manifest-path=./demos/esp32c3/Cargo.toml 17 cargo check --all --target=riscv32imac-unknown-none-elf --manifest-path=./demos/esp32c6/Cargo.toml 18 cargo check --all --target=thumbv8m.main-none-eabihf --manifest-path=./demos/rp2350/Cargo.toml 19 cargo check --all --target=thumbv7em-none-eabi --manifest-path=./demos/stm32f303vc/Cargo.toml
··· 13 cargo check --all --target=thumbv7em-none-eabi --manifest-path=./demos/microbit/Cargo.toml 14 cargo check --all --target=thumbv7em-none-eabi --manifest-path=./demos/nrf52840/Cargo.toml 15 cargo check --all --target=thumbv6m-none-eabi --manifest-path=./demos/rp2040/Cargo.toml 16 cargo check --all --target=riscv32imac-unknown-none-elf --manifest-path=./demos/esp32c6/Cargo.toml 17 cargo check --all --target=thumbv8m.main-none-eabihf --manifest-path=./demos/rp2350/Cargo.toml 18 cargo check --all --target=thumbv7em-none-eabi --manifest-path=./demos/stm32f303vc/Cargo.toml
+7 -7
crates/cobs-acc/src/lib.rs
··· 256 got_data += 1; 257 ch = remaining; 258 } 259 - e => panic!("{:?}", e), 260 } 261 } 262 } ··· 316 bad_data += 1; 317 ch = remaining; 318 } 319 - e => panic!("{:?}", e), 320 } 321 } 322 } ··· 368 let mut fed = 0; 369 for mut ch in sandwich.chunks_mut(chsz) { 370 fed += ch.len(); 371 - println!("CH: {:?}", ch); 372 'feed: loop { 373 - println!("{:?} <- {:?}", acc.contents(), ch); 374 match acc.feed_raw(ch) { 375 FeedResult::Consumed => break 'feed, 376 FeedResult::Success { data, remaining } => { ··· 386 FeedResult::OverFull(remaining) => { 387 ch = remaining; 388 } 389 - e => panic!("{:?}", e), 390 } 391 } 392 } ··· 473 let mut fed = 0; 474 for mut ch in input_stream.chunks_mut(chsz) { 475 fed += ch.len(); 476 - println!("CH: {:?}", ch); 477 'feed: loop { 478 - println!("{:?} <- {:?}", acc.contents(), ch); 479 match acc.feed_raw(ch) { 480 FeedResult::Consumed => break 'feed, 481 FeedResult::Success { data, remaining } => {
··· 256 got_data += 1; 257 ch = remaining; 258 } 259 + e => panic!("{e:?}"), 260 } 261 } 262 } ··· 316 bad_data += 1; 317 ch = remaining; 318 } 319 + e => panic!("{e:?}"), 320 } 321 } 322 } ··· 368 let mut fed = 0; 369 for mut ch in sandwich.chunks_mut(chsz) { 370 fed += ch.len(); 371 + println!("CH: {ch:?}"); 372 'feed: loop { 373 + println!("{:?} <- {ch:?}", acc.contents()); 374 match acc.feed_raw(ch) { 375 FeedResult::Consumed => break 'feed, 376 FeedResult::Success { data, remaining } => { ··· 386 FeedResult::OverFull(remaining) => { 387 ch = remaining; 388 } 389 + e => panic!("{e:?}"), 390 } 391 } 392 } ··· 473 let mut fed = 0; 474 for mut ch in input_stream.chunks_mut(chsz) { 475 fed += ch.len(); 476 + println!("CH: {ch:?}"); 477 'feed: loop { 478 + println!("{:?} <- {ch:?}", acc.contents()); 479 match acc.feed_raw(ch) { 480 FeedResult::Consumed => break 'feed, 481 FeedResult::Success { data, remaining } => {
+122 -88
crates/ergot/Cargo.lock
··· 262 checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 263 264 [[package]] 265 - name = "defmt" 266 - version = "0.3.100" 267 source = "registry+https://github.com/rust-lang/crates.io-index" 268 - checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" 269 dependencies = [ 270 - "defmt 1.0.1", 271 ] 272 273 [[package]] ··· 312 ] 313 314 [[package]] 315 - name = "embassy-executor-timer-queue" 316 - version = "0.1.0" 317 source = "registry+https://github.com/rust-lang/crates.io-index" 318 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 319 320 [[package]] 321 name = "embassy-futures" ··· 324 checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" 325 326 [[package]] 327 - name = "embassy-net" 328 - version = "0.7.1" 329 - source = "registry+https://github.com/rust-lang/crates.io-index" 330 - checksum = "0558a231a47e7d4a06a28b5278c92e860f1200f24821d2f365a2f40fe3f3c7b2" 331 - dependencies = [ 332 - "defmt 1.0.1", 333 - "document-features", 334 - "embassy-net-driver", 335 - "embassy-sync", 336 - "embassy-time", 337 - "embedded-io-async", 338 - "embedded-nal-async", 339 - "heapless 0.8.0", 340 - "managed", 341 - "smoltcp", 342 - ] 343 - 344 - [[package]] 345 name = "embassy-net-driver" 346 version = "0.2.0" 347 source = "registry+https://github.com/rust-lang/crates.io-index" 348 checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" 349 - dependencies = [ 350 - "defmt 0.3.100", 351 - ] 352 353 [[package]] 354 name = "embassy-net-driver-channel" ··· 358 dependencies = [ 359 "embassy-futures", 360 "embassy-net-driver", 361 - "embassy-sync", 362 ] 363 364 [[package]] 365 name = "embassy-sync" 366 - version = "0.7.2" 367 source = "registry+https://github.com/rust-lang/crates.io-index" 368 - checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 369 dependencies = [ 370 "cfg-if", 371 "critical-section", 372 "embedded-io-async", 373 - "futures-core", 374 "futures-sink", 375 "heapless 0.8.0", 376 ] 377 378 [[package]] 379 name = "embassy-time" 380 - version = "0.5.0" 381 source = "registry+https://github.com/rust-lang/crates.io-index" 382 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 383 dependencies = [ 384 "cfg-if", 385 "critical-section", 386 - "defmt 1.0.1", 387 "document-features", 388 "embassy-time-driver", 389 "embassy-time-queue-utils", 390 "embedded-hal 0.2.7", 391 "embedded-hal 1.0.0", 392 "embedded-hal-async", 393 - "futures-core", 394 ] 395 396 [[package]] 397 name = "embassy-time-driver" 398 - version = "0.2.1" 399 source = "registry+https://github.com/rust-lang/crates.io-index" 400 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 401 dependencies = [ 402 "document-features", 403 ] 404 405 [[package]] 406 name = "embassy-time-queue-utils" 407 - version = "0.3.0" 408 source = "registry+https://github.com/rust-lang/crates.io-index" 409 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 410 dependencies = [ 411 - "embassy-executor-timer-queue", 412 "heapless 0.8.0", 413 ] 414 415 [[package]] ··· 420 dependencies = [ 421 "embassy-futures", 422 "embassy-net-driver-channel", 423 - "embassy-sync", 424 - "embassy-usb-driver", 425 "embedded-io-async", 426 "heapless 0.8.0", 427 "ssmarshal", 428 "usbd-hid", 429 ] 430 431 [[package]] 432 name = "embassy-usb-driver" ··· 484 ] 485 486 [[package]] 487 - name = "embedded-nal" 488 - version = "0.9.0" 489 - source = "registry+https://github.com/rust-lang/crates.io-index" 490 - checksum = "c56a28be191a992f28f178ec338a0bf02f63d7803244add736d026a471e6ed77" 491 - dependencies = [ 492 - "nb 1.1.0", 493 - ] 494 - 495 - [[package]] 496 - name = "embedded-nal-async" 497 - version = "0.8.0" 498 - source = "registry+https://github.com/rust-lang/crates.io-index" 499 - checksum = "76959917cd2b86f40a98c28dd5624eddd1fa69d746241c8257eac428d83cb211" 500 - dependencies = [ 501 - "embedded-io-async", 502 - "embedded-nal", 503 - ] 504 - 505 - [[package]] 506 name = "encode_unicode" 507 version = "0.3.6" 508 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 533 534 [[package]] 535 name = "ergot" 536 - version = "0.12.0" 537 dependencies = [ 538 "bbq2", 539 "cobs 0.3.0", ··· 541 "const-fnv1a-hash", 542 "cordyceps", 543 "critical-section", 544 - "defmt 1.0.1", 545 "embassy-futures", 546 - "embassy-net", 547 "embassy-time", 548 - "embassy-usb", 549 "embedded-io-async", 550 "env_logger", 551 "heapless 0.9.1", ··· 576 ] 577 578 [[package]] 579 name = "futures" 580 version = "0.3.31" 581 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 742 source = "registry+https://github.com/rust-lang/crates.io-index" 743 checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" 744 dependencies = [ 745 - "defmt 0.3.100", 746 "hash32 0.3.1", 747 "stable_deref_trait", 748 ] ··· 753 source = "registry+https://github.com/rust-lang/crates.io-index" 754 checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 755 dependencies = [ 756 - "defmt 1.0.1", 757 "hash32 0.3.1", 758 "serde", 759 "stable_deref_trait", 760 ] 761 762 [[package]] 763 name = "io-kit-sys" ··· 875 "portable-atomic", 876 "tracing", 877 ] 878 - 879 - [[package]] 880 - name = "managed" 881 - version = "0.8.0" 882 - source = "registry+https://github.com/rust-lang/crates.io-index" 883 - checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" 884 885 [[package]] 886 name = "matchers" ··· 1369 checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" 1370 1371 [[package]] 1372 - name = "smoltcp" 1373 - version = "0.12.0" 1374 - source = "registry+https://github.com/rust-lang/crates.io-index" 1375 - checksum = "dad095989c1533c1c266d9b1e8d70a1329dd3723c3edac6d03bbd67e7bf6f4bb" 1376 - dependencies = [ 1377 - "bitflags 1.3.2", 1378 - "byteorder", 1379 - "cfg-if", 1380 - "defmt 0.3.100", 1381 - "heapless 0.8.0", 1382 - "managed", 1383 - ] 1384 - 1385 - [[package]] 1386 name = "socket2" 1387 version = "0.5.10" 1388 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1425 dependencies = [ 1426 "portable-atomic", 1427 ] 1428 1429 [[package]] 1430 name = "syn"
··· 262 checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 263 264 [[package]] 265 + name = "darling" 266 + version = "0.20.11" 267 + source = "registry+https://github.com/rust-lang/crates.io-index" 268 + checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" 269 + dependencies = [ 270 + "darling_core", 271 + "darling_macro", 272 + ] 273 + 274 + [[package]] 275 + name = "darling_core" 276 + version = "0.20.11" 277 + source = "registry+https://github.com/rust-lang/crates.io-index" 278 + checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" 279 + dependencies = [ 280 + "fnv", 281 + "ident_case", 282 + "proc-macro2", 283 + "quote", 284 + "strsim", 285 + "syn 2.0.101", 286 + ] 287 + 288 + [[package]] 289 + name = "darling_macro" 290 + version = "0.20.11" 291 source = "registry+https://github.com/rust-lang/crates.io-index" 292 + checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" 293 dependencies = [ 294 + "darling_core", 295 + "quote", 296 + "syn 2.0.101", 297 ] 298 299 [[package]] ··· 338 ] 339 340 [[package]] 341 + name = "embassy-executor" 342 + version = "0.7.0" 343 + source = "registry+https://github.com/rust-lang/crates.io-index" 344 + checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" 345 + dependencies = [ 346 + "critical-section", 347 + "document-features", 348 + "embassy-executor-macros", 349 + ] 350 + 351 + [[package]] 352 + name = "embassy-executor-macros" 353 + version = "0.6.2" 354 source = "registry+https://github.com/rust-lang/crates.io-index" 355 + checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" 356 + dependencies = [ 357 + "darling", 358 + "proc-macro2", 359 + "quote", 360 + "syn 2.0.101", 361 + ] 362 363 [[package]] 364 name = "embassy-futures" ··· 367 checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" 368 369 [[package]] 370 name = "embassy-net-driver" 371 version = "0.2.0" 372 source = "registry+https://github.com/rust-lang/crates.io-index" 373 checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" 374 375 [[package]] 376 name = "embassy-net-driver-channel" ··· 380 dependencies = [ 381 "embassy-futures", 382 "embassy-net-driver", 383 + "embassy-sync 0.7.0", 384 ] 385 386 [[package]] 387 name = "embassy-sync" 388 + version = "0.6.2" 389 source = "registry+https://github.com/rust-lang/crates.io-index" 390 + checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" 391 dependencies = [ 392 "cfg-if", 393 "critical-section", 394 "embedded-io-async", 395 "futures-sink", 396 + "futures-util", 397 + "heapless 0.8.0", 398 + ] 399 + 400 + [[package]] 401 + name = "embassy-sync" 402 + version = "0.7.0" 403 + source = "registry+https://github.com/rust-lang/crates.io-index" 404 + checksum = "cef1a8a1ea892f9b656de0295532ac5d8067e9830d49ec75076291fd6066b136" 405 + dependencies = [ 406 + "cfg-if", 407 + "critical-section", 408 + "embedded-io-async", 409 + "futures-sink", 410 + "futures-util", 411 "heapless 0.8.0", 412 ] 413 414 [[package]] 415 name = "embassy-time" 416 + version = "0.4.0" 417 source = "registry+https://github.com/rust-lang/crates.io-index" 418 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 419 dependencies = [ 420 "cfg-if", 421 "critical-section", 422 "document-features", 423 "embassy-time-driver", 424 "embassy-time-queue-utils", 425 "embedded-hal 0.2.7", 426 "embedded-hal 1.0.0", 427 "embedded-hal-async", 428 + "futures-util", 429 ] 430 431 [[package]] 432 name = "embassy-time-driver" 433 + version = "0.2.0" 434 source = "registry+https://github.com/rust-lang/crates.io-index" 435 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 436 dependencies = [ 437 "document-features", 438 ] 439 440 [[package]] 441 name = "embassy-time-queue-utils" 442 + version = "0.1.0" 443 + source = "registry+https://github.com/rust-lang/crates.io-index" 444 + checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" 445 + dependencies = [ 446 + "embassy-executor", 447 + "heapless 0.8.0", 448 + ] 449 + 450 + [[package]] 451 + name = "embassy-usb" 452 + version = "0.4.0" 453 source = "registry+https://github.com/rust-lang/crates.io-index" 454 + checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386" 455 dependencies = [ 456 + "embassy-futures", 457 + "embassy-net-driver-channel", 458 + "embassy-sync 0.6.2", 459 + "embassy-usb-driver 0.1.0", 460 "heapless 0.8.0", 461 + "ssmarshal", 462 + "usbd-hid", 463 ] 464 465 [[package]] ··· 470 dependencies = [ 471 "embassy-futures", 472 "embassy-net-driver-channel", 473 + "embassy-sync 0.7.0", 474 + "embassy-usb-driver 0.2.0", 475 "embedded-io-async", 476 "heapless 0.8.0", 477 "ssmarshal", 478 "usbd-hid", 479 ] 480 + 481 + [[package]] 482 + name = "embassy-usb-driver" 483 + version = "0.1.0" 484 + source = "registry+https://github.com/rust-lang/crates.io-index" 485 + checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" 486 487 [[package]] 488 name = "embassy-usb-driver" ··· 540 ] 541 542 [[package]] 543 name = "encode_unicode" 544 version = "0.3.6" 545 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 570 571 [[package]] 572 name = "ergot" 573 + version = "0.11.0" 574 dependencies = [ 575 "bbq2", 576 "cobs 0.3.0", ··· 578 "const-fnv1a-hash", 579 "cordyceps", 580 "critical-section", 581 + "defmt", 582 "embassy-futures", 583 "embassy-time", 584 + "embassy-usb 0.4.0", 585 + "embassy-usb 0.5.0", 586 "embedded-io-async", 587 "env_logger", 588 "heapless 0.9.1", ··· 613 ] 614 615 [[package]] 616 + name = "fnv" 617 + version = "1.0.7" 618 + source = "registry+https://github.com/rust-lang/crates.io-index" 619 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 620 + 621 + [[package]] 622 name = "futures" 623 version = "0.3.31" 624 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 785 source = "registry+https://github.com/rust-lang/crates.io-index" 786 checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" 787 dependencies = [ 788 "hash32 0.3.1", 789 "stable_deref_trait", 790 ] ··· 795 source = "registry+https://github.com/rust-lang/crates.io-index" 796 checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 797 dependencies = [ 798 + "defmt", 799 "hash32 0.3.1", 800 "serde", 801 "stable_deref_trait", 802 ] 803 + 804 + [[package]] 805 + name = "ident_case" 806 + version = "1.0.1" 807 + source = "registry+https://github.com/rust-lang/crates.io-index" 808 + checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 809 810 [[package]] 811 name = "io-kit-sys" ··· 923 "portable-atomic", 924 "tracing", 925 ] 926 927 [[package]] 928 name = "matchers" ··· 1411 checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" 1412 1413 [[package]] 1414 name = "socket2" 1415 version = "0.5.10" 1416 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1453 dependencies = [ 1454 "portable-atomic", 1455 ] 1456 + 1457 + [[package]] 1458 + name = "strsim" 1459 + version = "0.11.1" 1460 + source = "registry+https://github.com/rust-lang/crates.io-index" 1461 + checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1462 1463 [[package]] 1464 name = "syn"
+9 -13
crates/ergot/Cargo.toml
··· 1 [package] 2 name = "ergot" 3 - version = "0.12.0" 4 authors = ["James Munns <james@onevariable.com>"] 5 edition = "2024" 6 readme = "README.md" ··· 42 "tokio", 43 "std", 44 ] 45 - embassy-usb-v0_5 = [ 46 "defmt-v1", 47 - "dep:embassy-usb-0_5", 48 "dep:static_cell", 49 - "dep:embassy-time" 50 ] 51 - embassy-net-v0_7 = [ 52 "defmt-v1", 53 - "dep:embassy-net-0_7", 54 "dep:static_cell", 55 ] 56 embedded-io-async-v0_6 = [ ··· 75 _all-features-hack = [ 76 "ssmarshal/std", 77 ] 78 - alloc = [ 79 - "postcard-schema/alloc" 80 - ] 81 82 [dependencies] 83 const-fnv1a-hash = "1.1.0" ··· 91 bbq2 = { version = "0.4.2", default-features = false, features = ["maitake-sync-0_2"] } 92 cobs = { version = "0.3.0", default-features = false } 93 cordyceps = { version = "0.3.4", default-features = false } 94 - embassy-time = { version = "0.5.0", optional = true } 95 maitake-sync = { version = "0.2.2", default-features = false } 96 mutex = { version = "1.0.0", features = ["impl-critical-section"] } 97 serde = { version = "1.0", default-features = false, features = ["derive"] } ··· 109 defmt = { version = "1.0.0", optional = true } 110 static_cell = { version = "2.1", optional = true } 111 112 # embassy-usb-v0_5 113 embassy-usb-0_5 = { version = "0.5", optional = true, package = "embassy-usb" } 114 - 115 - # embassy-usb-v0_7 116 - embassy-net-0_7 = { version = "0.7", optional = true, package = "embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet", "dns", "proto-ipv4", "proto-ipv6"] } 117 118 # embedded-io-async 119 embedded-io-async-0_6 = { version = "0.6", optional = true, package = "embedded-io-async" }
··· 1 [package] 2 name = "ergot" 3 + version = "0.11.0" 4 authors = ["James Munns <james@onevariable.com>"] 5 edition = "2024" 6 readme = "README.md" ··· 42 "tokio", 43 "std", 44 ] 45 + embassy-usb-v0_4 = [ 46 "defmt-v1", 47 + "dep:embassy-usb-0_4", 48 "dep:static_cell", 49 ] 50 + embassy-usb-v0_5 = [ 51 "defmt-v1", 52 + "dep:embassy-usb-0_5", 53 "dep:static_cell", 54 ] 55 embedded-io-async-v0_6 = [ ··· 74 _all-features-hack = [ 75 "ssmarshal/std", 76 ] 77 78 [dependencies] 79 const-fnv1a-hash = "1.1.0" ··· 87 bbq2 = { version = "0.4.2", default-features = false, features = ["maitake-sync-0_2"] } 88 cobs = { version = "0.3.0", default-features = false } 89 cordyceps = { version = "0.3.4", default-features = false } 90 + embassy-time = { version = "0.4.0" } 91 maitake-sync = { version = "0.2.2", default-features = false } 92 mutex = { version = "1.0.0", features = ["impl-critical-section"] } 93 serde = { version = "1.0", default-features = false, features = ["derive"] } ··· 105 defmt = { version = "1.0.0", optional = true } 106 static_cell = { version = "2.1", optional = true } 107 108 + # embassy-usb-v0_4 109 + embassy-usb-0_4 = { version = "0.4", optional = true, package = "embassy-usb" } 110 + 111 # embassy-usb-v0_5 112 embassy-usb-0_5 = { version = "0.5", optional = true, package = "embassy-usb" } 113 114 # embedded-io-async 115 embedded-io-async-0_6 = { version = "0.6", optional = true, package = "embedded-io-async" }
+2 -2
crates/ergot/src/book/_03_feature_overview.rs
··· 119 //! **For examples, see:** 120 //! 121 //! * [`ergot-router`] for the "Server" application shown above 122 - //! * [`ergot-client-tcp`] for the "Process" application shown above 123 //! 124 //! [`ergot-router`]: https://github.com/jamesmunns/ergot/tree/main/demos/std/ergot-router 125 - //! [`ergot-client-tcp`]: https://github.com/jamesmunns/ergot/tree/main/demos/std/ergot-client 126 //! 127 //! ### Direct connection, MCU to MCU 128 //!
··· 119 //! **For examples, see:** 120 //! 121 //! * [`ergot-router`] for the "Server" application shown above 122 + //! * [`ergot-client`] for the "Process" application shown above 123 //! 124 //! [`ergot-router`]: https://github.com/jamesmunns/ergot/tree/main/demos/std/ergot-router 125 + //! [`ergot-client`]: https://github.com/jamesmunns/ergot/tree/main/demos/std/ergot-client 126 //! 127 //! ### Direct connection, MCU to MCU 128 //!
+1 -1
crates/ergot/src/conformance/net_stack.rs
··· 167 data: &T, 168 ) -> Result<(), InterfaceSendError> { 169 let data = postcard::to_stdvec(data).expect("Serializing send failed"); 170 - log::trace!("{}: Sending data:{:02X?}", hdr, data); 171 let now = self.expected_sends.pop_front().expect("Unexpected send"); 172 assert_eq!(&now.hdr, hdr, "Send header mismatch"); 173 assert_eq!(&now.data, &data, "Send data mismatch");
··· 167 data: &T, 168 ) -> Result<(), InterfaceSendError> { 169 let data = postcard::to_stdvec(data).expect("Serializing send failed"); 170 + log::trace!("{hdr}: Sending data:{data:02X?}"); 171 let now = self.expected_sends.pop_front().expect("Unexpected send"); 172 assert_eq!(&now.hdr, hdr, "Send header mismatch"); 173 assert_eq!(&now.data, &data, "Send data mismatch");
-27
crates/ergot/src/interface_manager/interface_impls/embassy_net_udp.rs
··· 1 - use core::marker::PhantomData; 2 - 3 - use bbq2::queue::BBQueue; 4 - use bbq2::traits::bbqhdl::BbqHandle; 5 - use bbq2::traits::notifier::maitake::MaiNotSpsc; 6 - use bbq2::traits::storage::Inline; 7 - 8 - use crate::interface_manager::Interface; 9 - use crate::interface_manager::utils::framed_stream; 10 - 11 - /// A type alias for the outgoing packet queue typically used by the [`EmbassyInterface`] 12 - pub type Queue<const N: usize, C> = BBQueue<Inline<N>, C, MaiNotSpsc>; 13 - /// A type alias for the InterfaceSink typically used by the [`EmbassyInterface`] 14 - pub type EmbassySink<Q> = framed_stream::Sink<Q>; 15 - 16 - /// An Embassy-USB interface implementation 17 - pub struct EmbassyNetInterface<Q: BbqHandle + 'static> { 18 - _pd: PhantomData<Q>, 19 - } 20 - 21 - /// Interface Implementation 22 - impl<Q: BbqHandle + 'static> Interface for EmbassyNetInterface<Q> { 23 - type Sink = EmbassySink<Q>; 24 - } 25 - 26 - #[cfg(feature = "embassy-net-v0_7")] 27 - pub mod enet_0_7 {}
···
+296 -2
crates/ergot/src/interface_manager/interface_impls/embassy_usb.rs
··· 108 pub mod eusb_0_5 { 109 use core::sync::atomic::Ordering; 110 111 - use crate::logging::{info, warn}; 112 use bbq2::{ 113 prod_cons::framed::FramedConsumer, 114 queue::BBQueue, 115 traits::{coordination::Coord, notifier::maitake::MaiNotSpsc, storage::Inline}, 116 }; 117 use embassy_futures::select::{Either, select}; 118 use embassy_time::Timer; 119 use embassy_usb_0_5::{ ··· 161 // Wait for an outgoing frame 162 let frame = rx.wait_read().await; 163 164 - defmt::debug!("Got frame to send len {=usize}", frame.len()); 165 166 // Attempt to send it 167 let res = send_all::<D>( ··· 403 } 404 } 405 }
··· 108 pub mod eusb_0_5 { 109 use core::sync::atomic::Ordering; 110 111 use bbq2::{ 112 prod_cons::framed::FramedConsumer, 113 queue::BBQueue, 114 traits::{coordination::Coord, notifier::maitake::MaiNotSpsc, storage::Inline}, 115 }; 116 + use defmt::{debug, info, warn}; 117 use embassy_futures::select::{Either, select}; 118 use embassy_time::Timer; 119 use embassy_usb_0_5::{ ··· 161 // Wait for an outgoing frame 162 let frame = rx.wait_read().await; 163 164 + debug!("Got frame to send len {=usize}", frame.len()); 165 166 // Attempt to send it 167 let res = send_all::<D>( ··· 403 } 404 } 405 } 406 + 407 + #[cfg(feature = "embassy-usb-v0_4")] 408 + pub mod eusb_0_4 { 409 + use core::sync::atomic::Ordering; 410 + 411 + use bbq2::{ 412 + prod_cons::framed::FramedConsumer, 413 + queue::BBQueue, 414 + traits::{coordination::Coord, notifier::maitake::MaiNotSpsc, storage::Inline}, 415 + }; 416 + use defmt::{debug, info, warn}; 417 + use embassy_futures::select::{Either, select}; 418 + use embassy_time::Timer; 419 + use embassy_usb_0_4::{ 420 + Builder, UsbDevice, 421 + driver::{Driver, Endpoint, EndpointIn}, 422 + msos::{self, windows_version}, 423 + }; 424 + use static_cell::ConstStaticCell; 425 + 426 + use crate::interface_manager::interface_impls::embassy_usb::TransmitError; 427 + 428 + use super::{DEVICE_INTERFACE_GUIDS, ErgotHandler, HDLR, STINDX, UsbDeviceBuffers}; 429 + 430 + /// A helper type for `static` storage of buffers and driver components 431 + pub struct WireStorage< 432 + const CONFIG: usize = 256, 433 + const BOS: usize = 256, 434 + const CONTROL: usize = 64, 435 + const MSOS: usize = 256, 436 + > { 437 + /// Usb buffer storage 438 + pub bufs_usb: ConstStaticCell<UsbDeviceBuffers<CONFIG, BOS, CONTROL, MSOS>>, 439 + } 440 + 441 + /// Transmitter worker task 442 + /// 443 + /// Takes a bbqueue from the NetStack of packets to send. While sending, 444 + /// we will timeout if 445 + pub async fn tx_worker<'a, D: Driver<'a>, const N: usize, C: Coord>( 446 + ep_in: &mut D::EndpointIn, 447 + rx: FramedConsumer<&'static BBQueue<Inline<N>, C, MaiNotSpsc>>, 448 + timeout_ms_per_frame: usize, 449 + max_usb_frame_size: usize, 450 + ) { 451 + assert!(max_usb_frame_size.is_power_of_two()); 452 + info!("Started tx_worker"); 453 + let mut pending = false; 454 + loop { 455 + // Wait for the endpoint to be connected... 456 + ep_in.wait_enabled().await; 457 + 458 + info!("Endpoint marked connected"); 459 + 460 + 'connection: loop { 461 + // Wait for an outgoing frame 462 + let frame = rx.wait_read().await; 463 + 464 + debug!("Got frame to send len {=usize}", frame.len()); 465 + 466 + // Attempt to send it 467 + let res = send_all::<D>( 468 + ep_in, 469 + &frame, 470 + &mut pending, 471 + timeout_ms_per_frame, 472 + max_usb_frame_size, 473 + ) 474 + .await; 475 + 476 + // Done with this frame, free the buffer space 477 + frame.release(); 478 + 479 + match res { 480 + Ok(()) => {} 481 + Err(TransmitError::Timeout) => { 482 + // TODO: treat enough timeouts like a connection closed? 483 + warn!("Transmit timeout!"); 484 + } 485 + Err(TransmitError::ConnectionClosed) => break 'connection, 486 + } 487 + } 488 + 489 + // Drain any pending frames - the connection was lost. 490 + while let Ok(frame) = rx.read() { 491 + frame.release(); 492 + } 493 + } 494 + } 495 + 496 + #[inline] 497 + async fn send_all<'a, D>( 498 + ep_in: &mut D::EndpointIn, 499 + out: &[u8], 500 + pending_frame: &mut bool, 501 + timeout_ms_per_frame: usize, 502 + max_usb_frame_size: usize, 503 + ) -> Result<(), TransmitError> 504 + where 505 + D: Driver<'a>, 506 + { 507 + if out.is_empty() { 508 + return Ok(()); 509 + } 510 + 511 + // Calculate an estimated timeout based on the number of frames we need to send 512 + // For now, we use 2ms/frame by default, rounded UP 513 + let frames = out.len().div_ceil(max_usb_frame_size); 514 + let timeout_ms = frames * timeout_ms_per_frame; 515 + 516 + let send_fut = async { 517 + // If we left off a pending frame, send one now so we don't leave an unterminated 518 + // message 519 + if *pending_frame && ep_in.write(&[]).await.is_err() { 520 + return Err(TransmitError::ConnectionClosed); 521 + } 522 + *pending_frame = true; 523 + 524 + // write in segments of max_usb_frame_size. The last chunk may 525 + // be 0 < len <= max_usb_frame_size. 526 + for ch in out.chunks(max_usb_frame_size) { 527 + if ep_in.write(ch).await.is_err() { 528 + return Err(TransmitError::ConnectionClosed); 529 + } 530 + } 531 + // If the total we sent was a multiple of max_usb_frame_size, send an 532 + // empty message to "flush" the transaction. We already checked 533 + // above that the len != 0. 534 + if (out.len() & (max_usb_frame_size - 1)) == 0 && ep_in.write(&[]).await.is_err() { 535 + return Err(TransmitError::ConnectionClosed); 536 + } 537 + 538 + *pending_frame = false; 539 + Ok(()) 540 + }; 541 + 542 + match select(send_fut, Timer::after_millis(timeout_ms as u64)).await { 543 + Either::First(res) => res, 544 + Either::Second(()) => Err(TransmitError::Timeout), 545 + } 546 + } 547 + 548 + // impl WireStorage 549 + 550 + impl<const CONFIG: usize, const BOS: usize, const CONTROL: usize, const MSOS: usize> 551 + WireStorage<CONFIG, BOS, CONTROL, MSOS> 552 + { 553 + /// Create a new, uninitialized static set of buffers 554 + pub const fn new() -> Self { 555 + Self { 556 + bufs_usb: ConstStaticCell::new(UsbDeviceBuffers::new()), 557 + } 558 + } 559 + 560 + /// Initialize the static storage, reporting as ergot compatible 561 + /// 562 + /// This must only be called once. 563 + pub fn init_ergot<D: Driver<'static> + 'static>( 564 + &'static self, 565 + driver: D, 566 + config: embassy_usb_0_4::Config<'static>, 567 + ) -> (UsbDevice<'static, D>, D::EndpointIn, D::EndpointOut) { 568 + let bufs = self.bufs_usb.take(); 569 + 570 + let mut builder = Builder::new( 571 + driver, 572 + config, 573 + &mut bufs.config_descriptor, 574 + &mut bufs.bos_descriptor, 575 + &mut bufs.msos_descriptor, 576 + &mut bufs.control_buf, 577 + ); 578 + 579 + // Register a ergot-compatible string handler 580 + let hdlr = HDLR.take(); 581 + builder.handler(hdlr); 582 + 583 + // Add the Microsoft OS Descriptor (MSOS/MOD) descriptor. 584 + // We tell Windows that this entire device is compatible with the "WINUSB" feature, 585 + // which causes it to use the built-in WinUSB driver automatically, which in turn 586 + // can be used by libusb/rusb software without needing a custom driver or INF file. 587 + // In principle you might want to call msos_feature() just on a specific function, 588 + // if your device also has other functions that still use standard class drivers. 589 + builder.msos_descriptor(windows_version::WIN8_1, 0); 590 + builder.msos_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", "")); 591 + builder.msos_feature(msos::RegistryPropertyFeatureDescriptor::new( 592 + "DeviceInterfaceGUIDs", 593 + msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), 594 + )); 595 + 596 + // Add a vendor-specific function (class 0xFF), and corresponding interface, 597 + // that uses our custom handler. 598 + let mut function = builder.function(0xFF, 0, 0); 599 + let mut interface = function.interface(); 600 + let stindx = interface.string(); 601 + STINDX.store(stindx.0, Ordering::Relaxed); 602 + let mut alt = interface.alt_setting(0xFF, 0xCA, 0x7D, Some(stindx)); 603 + let ep_out = alt.endpoint_bulk_out(64); 604 + let ep_in = alt.endpoint_bulk_in(64); 605 + drop(function); 606 + 607 + // Build the builder. 608 + let usb = builder.build(); 609 + 610 + (usb, ep_in, ep_out) 611 + } 612 + 613 + /// Initialize the static storage. 614 + /// 615 + /// This must only be called once. 616 + pub fn init<D: Driver<'static> + 'static>( 617 + &'static self, 618 + driver: D, 619 + config: embassy_usb_0_4::Config<'static>, 620 + ) -> (UsbDevice<'static, D>, D::EndpointIn, D::EndpointOut) { 621 + let (builder, wtx, wrx) = self.init_without_build(driver, config); 622 + let usb = builder.build(); 623 + (usb, wtx, wrx) 624 + } 625 + /// Initialize the static storage, without building `Builder` 626 + /// 627 + /// This must only be called once. 628 + pub fn init_without_build<D: Driver<'static> + 'static>( 629 + &'static self, 630 + driver: D, 631 + config: embassy_usb_0_4::Config<'static>, 632 + ) -> (Builder<'static, D>, D::EndpointIn, D::EndpointOut) { 633 + let bufs = self.bufs_usb.take(); 634 + 635 + let mut builder = Builder::new( 636 + driver, 637 + config, 638 + &mut bufs.config_descriptor, 639 + &mut bufs.bos_descriptor, 640 + &mut bufs.msos_descriptor, 641 + &mut bufs.control_buf, 642 + ); 643 + 644 + // Add the Microsoft OS Descriptor (MSOS/MOD) descriptor. 645 + // We tell Windows that this entire device is compatible with the "WINUSB" feature, 646 + // which causes it to use the built-in WinUSB driver automatically, which in turn 647 + // can be used by libusb/rusb software without needing a custom driver or INF file. 648 + // In principle you might want to call msos_feature() just on a specific function, 649 + // if your device also has other functions that still use standard class drivers. 650 + builder.msos_descriptor(windows_version::WIN8_1, 0); 651 + builder.msos_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", "")); 652 + builder.msos_feature(msos::RegistryPropertyFeatureDescriptor::new( 653 + "DeviceInterfaceGUIDs", 654 + msos::PropertyData::RegMultiSz(DEVICE_INTERFACE_GUIDS), 655 + )); 656 + 657 + // Add a vendor-specific function (class 0xFF), and corresponding interface, 658 + // that uses our custom handler. 659 + let mut function = builder.function(0xFF, 0, 0); 660 + let mut interface = function.interface(); 661 + let mut alt = interface.alt_setting(0xFF, 0, 0, None); 662 + let ep_out = alt.endpoint_bulk_out(64); 663 + let ep_in = alt.endpoint_bulk_in(64); 664 + drop(function); 665 + 666 + (builder, ep_in, ep_out) 667 + } 668 + } 669 + 670 + impl<const CONFIG: usize, const BOS: usize, const CONTROL: usize, const MSOS: usize> Default 671 + for WireStorage<CONFIG, BOS, CONTROL, MSOS> 672 + { 673 + fn default() -> Self { 674 + Self::new() 675 + } 676 + } 677 + 678 + // impl ErgotHandler 679 + 680 + impl embassy_usb_0_4::Handler for ErgotHandler { 681 + fn get_string( 682 + &mut self, 683 + index: embassy_usb_0_4::types::StringIndex, 684 + lang_id: u16, 685 + ) -> Option<&str> { 686 + use embassy_usb_0_4::descriptor::lang_id; 687 + 688 + let stindx = STINDX.load(Ordering::Relaxed); 689 + if stindx == 0xFF { 690 + return None; 691 + } 692 + if lang_id == lang_id::ENGLISH_US && index.0 == stindx { 693 + Some("ergot") 694 + } else { 695 + None 696 + } 697 + } 698 + } 699 + }
+1 -1
crates/ergot/src/interface_manager/interface_impls/embedded_io.rs
··· 1 - use crate::logging::info; 2 use bbq2::{ 3 prod_cons::stream::StreamConsumer, 4 queue::BBQueue, ··· 7 }, 8 }; 9 use core::marker::PhantomData; 10 use embedded_io_async_0_6::Write; 11 12 use crate::interface_manager::{Interface, utils::cobs_stream};
··· 1 use bbq2::{ 2 prod_cons::stream::StreamConsumer, 3 queue::BBQueue, ··· 6 }, 7 }; 8 use core::marker::PhantomData; 9 + use defmt::info; 10 use embedded_io_async_0_6::Write; 11 12 use crate::interface_manager::{Interface, utils::cobs_stream};
+1 -6
crates/ergot/src/interface_manager/interface_impls/mod.rs
··· 5 6 #[cfg(feature = "tokio-std")] 7 pub mod tokio_tcp; 8 - #[cfg(feature = "tokio-std")] 9 - pub mod tokio_udp; 10 11 #[cfg(feature = "tokio-serial-v5")] 12 pub mod tokio_serial_cobs; 13 14 - #[cfg(feature = "embassy-usb-v0_5")] 15 pub mod embassy_usb; 16 - 17 - #[cfg(feature = "embassy-net-v0_7")] 18 - pub mod embassy_net_udp; 19 20 #[cfg(feature = "nusb-v0_1")] 21 pub mod nusb_bulk;
··· 5 6 #[cfg(feature = "tokio-std")] 7 pub mod tokio_tcp; 8 9 #[cfg(feature = "tokio-serial-v5")] 10 pub mod tokio_serial_cobs; 11 12 + #[cfg(any(feature = "embassy-usb-v0_4", feature = "embassy-usb-v0_5"))] 13 pub mod embassy_usb; 14 15 #[cfg(feature = "nusb-v0_1")] 16 pub mod nusb_bulk;
+7 -7
crates/ergot/src/interface_manager/interface_impls/nusb_bulk.rs
··· 12 Interface, 13 utils::{framed_stream, std::StdQueue}, 14 }; 15 - use crate::logging::{debug, info, trace, warn}; 16 17 /// Interface impl using Nusb Bulk packets 18 pub struct NusbBulk {} ··· 71 let mut devices = match nusb::list_devices() { 72 Ok(d) => d, 73 Err(e) => { 74 - warn!("Error listing devices: {:?}", e); 75 return vec![]; 76 } 77 }; ··· 94 let dev = match found.open() { 95 Ok(d) => d, 96 Err(e) => { 97 - warn!("Failed opening device: {:?}", e); 98 continue; 99 } 100 }; 101 let interface = match dev.claim_interface(interface_id as u8) { 102 Ok(i) => i, 103 Err(e) => { 104 - warn!("Failed claiming interface: {:?}", e); 105 continue; 106 } 107 }; ··· 128 } 129 130 if let Some(max_packet_size) = &mps { 131 - debug!("Detected max packet size: {}", max_packet_size); 132 } else { 133 warn!("Unable to detect Max Packet Size!"); 134 }; ··· 137 warn!("Failed to find OUT EP"); 138 continue; 139 }; 140 - debug!("OUT EP: {}", ep_out); 141 142 let Some(ep_in) = ep_in else { 143 warn!("Failed to find IN EP"); 144 continue; 145 }; 146 - debug!("IN EP: {}", ep_in); 147 148 let boq = interface.bulk_out_queue(ep_out); 149 let biq = interface.bulk_in_queue(ep_in);
··· 12 Interface, 13 utils::{framed_stream, std::StdQueue}, 14 }; 15 + use log::{debug, info, trace, warn}; 16 17 /// Interface impl using Nusb Bulk packets 18 pub struct NusbBulk {} ··· 71 let mut devices = match nusb::list_devices() { 72 Ok(d) => d, 73 Err(e) => { 74 + warn!("Error listing devices: {e:?}"); 75 return vec![]; 76 } 77 }; ··· 94 let dev = match found.open() { 95 Ok(d) => d, 96 Err(e) => { 97 + warn!("Failed opening device: {e:?}"); 98 continue; 99 } 100 }; 101 let interface = match dev.claim_interface(interface_id as u8) { 102 Ok(i) => i, 103 Err(e) => { 104 + warn!("Failed claiming interface: {e:?}"); 105 continue; 106 } 107 }; ··· 128 } 129 130 if let Some(max_packet_size) = &mps { 131 + debug!("Detected max packet size: {max_packet_size}"); 132 } else { 133 warn!("Unable to detect Max Packet Size!"); 134 }; ··· 137 warn!("Failed to find OUT EP"); 138 continue; 139 }; 140 + debug!("OUT EP: {ep_out}"); 141 142 let Some(ep_in) = ep_in else { 143 warn!("Failed to find IN EP"); 144 continue; 145 }; 146 + debug!("IN EP: {ep_in}"); 147 148 let boq = interface.bulk_out_queue(ep_out); 149 let biq = interface.bulk_in_queue(ep_in);
-13
crates/ergot/src/interface_manager/interface_impls/tokio_udp.rs
··· 1 - //! std udp interface impl 2 - 3 - use crate::interface_manager::{ 4 - Interface, 5 - utils::{framed_stream, std::StdQueue}, 6 - }; 7 - 8 - /// An interface implementation for UDP using tokio 9 - pub struct TokioUdpInterface {} 10 - 11 - impl Interface for TokioUdpInterface { 12 - type Sink = framed_stream::Sink<StdQueue>; 13 - }
···
-7
crates/ergot/src/interface_manager/mod.rs
··· 101 /// The kind of type that is used to identify a single interface. 102 /// If a Profile only supports a single interface, this is often the `()` type. 103 /// If a Profile supports many interfaces, this could be an enum or integer type. 104 - #[cfg(feature = "defmt-v1")] 105 - type InterfaceIdent: Clone + core::fmt::Debug + defmt::Format; 106 - #[cfg(not(feature = "defmt-v1"))] 107 type InterfaceIdent: Clone + core::fmt::Debug; 108 109 /// Send a serializable message to the Profile. ··· 211 } 212 213 /// An error when deregistering an interface 214 - #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 215 #[derive(Debug, PartialEq, Eq)] 216 #[non_exhaustive] 217 pub enum DeregisterError { 218 NoSuchInterface, 219 } 220 221 - #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 222 #[derive(Clone, Copy, Debug, PartialEq)] 223 pub enum InterfaceState { 224 // Missing sink, no net id ··· 231 Active { net_id: u16, node_id: u8 }, 232 } 233 234 - #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 235 #[derive(Clone, Copy, Debug, PartialEq)] 236 #[non_exhaustive] 237 pub enum RegisterSinkError { 238 AlreadyActive, 239 } 240 241 - #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 242 #[derive(Clone, Copy, Debug, PartialEq)] 243 #[non_exhaustive] 244 pub enum SetStateError {
··· 101 /// The kind of type that is used to identify a single interface. 102 /// If a Profile only supports a single interface, this is often the `()` type. 103 /// If a Profile supports many interfaces, this could be an enum or integer type. 104 type InterfaceIdent: Clone + core::fmt::Debug; 105 106 /// Send a serializable message to the Profile. ··· 208 } 209 210 /// An error when deregistering an interface 211 #[derive(Debug, PartialEq, Eq)] 212 #[non_exhaustive] 213 pub enum DeregisterError { 214 NoSuchInterface, 215 } 216 217 #[derive(Clone, Copy, Debug, PartialEq)] 218 pub enum InterfaceState { 219 // Missing sink, no net id ··· 226 Active { net_id: u16, node_id: u8 }, 227 } 228 229 #[derive(Clone, Copy, Debug, PartialEq)] 230 #[non_exhaustive] 231 pub enum RegisterSinkError { 232 AlreadyActive, 233 } 234 235 #[derive(Clone, Copy, Debug, PartialEq)] 236 #[non_exhaustive] 237 pub enum SetStateError {
-181
crates/ergot/src/interface_manager/profiles/direct_edge/embassy_net_udp_0_7.rs
··· 1 - use crate::interface_manager::profiles::direct_edge::{ 2 - CENTRAL_NODE_ID, EDGE_NODE_ID, process_frame, 3 - }; 4 - use crate::interface_manager::{InterfaceState, Profile}; 5 - use crate::net_stack::NetStackHandle; 6 - use crate::wire_frames::MAX_HDR_ENCODED_SIZE; 7 - use bbq2::prod_cons::framed::FramedConsumer; 8 - use bbq2::queue::BBQueue; 9 - use bbq2::traits::coordination::Coord; 10 - use bbq2::traits::notifier::maitake::MaiNotSpsc; 11 - use bbq2::traits::storage::Inline; 12 - use defmt::{error, trace}; 13 - use embassy_futures::select::{Either, select}; 14 - use embassy_net_0_7::udp::{RecvError, SendError, UdpMetadata, UdpSocket}; 15 - 16 - pub const UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX: usize = 1500 - 8 - 20; 17 - pub const UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX: usize = 18 - UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX - MAX_HDR_ENCODED_SIZE; 19 - #[derive(Debug, PartialEq)] 20 - pub struct SocketAlreadyActive; 21 - 22 - #[derive(PartialEq, Eq, Clone, Copy, Debug)] 23 - pub enum RxTxError { 24 - TxError(SendError), 25 - RxError(RecvError), 26 - } 27 - 28 - pub struct RxTxWorker<const NN: usize, N, C> 29 - where 30 - N: NetStackHandle, 31 - C: Coord + 'static, 32 - { 33 - nsh: N, 34 - socket: UdpSocket<'static>, 35 - net_id: Option<u16>, 36 - ident: <<N as NetStackHandle>::Profile as Profile>::InterfaceIdent, 37 - is_controller: bool, 38 - consumer: FramedConsumer<&'static BBQueue<Inline<NN>, C, MaiNotSpsc>>, 39 - remote_endpoint: UdpMetadata, 40 - } 41 - 42 - impl<const NN: usize, N, C> RxTxWorker<NN, N, C> 43 - where 44 - N: NetStackHandle, 45 - C: Coord, 46 - { 47 - pub fn new_target<EP>( 48 - net: N, 49 - socket: UdpSocket<'static>, 50 - ident: <<N as NetStackHandle>::Profile as Profile>::InterfaceIdent, 51 - consumer: FramedConsumer<&'static BBQueue<Inline<NN>, C, MaiNotSpsc>>, 52 - remote_endpoint: EP, 53 - ) -> Self 54 - where 55 - EP: Into<UdpMetadata>, 56 - { 57 - Self { 58 - nsh: net, 59 - socket, 60 - net_id: None, 61 - ident, 62 - is_controller: false, 63 - consumer, 64 - remote_endpoint: remote_endpoint.into(), 65 - } 66 - } 67 - 68 - pub fn new_controller<EP>( 69 - net: N, 70 - socket: UdpSocket<'static>, 71 - ident: <<N as NetStackHandle>::Profile as Profile>::InterfaceIdent, 72 - consumer: FramedConsumer<&'static BBQueue<Inline<NN>, C, MaiNotSpsc>>, 73 - remote_endpoint: EP, 74 - ) -> Self 75 - where 76 - EP: Into<UdpMetadata>, 77 - { 78 - Self { 79 - nsh: net, 80 - socket, 81 - net_id: None, 82 - ident, 83 - is_controller: true, 84 - consumer, 85 - remote_endpoint: remote_endpoint.into(), 86 - } 87 - } 88 - 89 - pub async fn run(&mut self, scratch: &mut [u8]) -> Result<(), RxTxError> { 90 - // Mark the interface as established 91 - _ = self 92 - .nsh 93 - .stack() 94 - .manage_profile(|im| { 95 - if self.is_controller { 96 - trace!("UDP controller is active"); 97 - self.net_id = Some(1); 98 - im.set_interface_state( 99 - self.ident.clone(), 100 - InterfaceState::Active { 101 - net_id: 1, 102 - node_id: CENTRAL_NODE_ID, 103 - }, 104 - ) 105 - } else { 106 - trace!("UDP target is active"); 107 - self.net_id = Some(1); 108 - im.set_interface_state( 109 - self.ident.clone(), 110 - InterfaceState::Active { 111 - net_id: 1, 112 - node_id: EDGE_NODE_ID, 113 - }, 114 - ) 115 - } 116 - }) 117 - .inspect_err(|err| error!("Error setting interface state: {:?}", err)); 118 - 119 - let res = self.run_inner(scratch).await; 120 - _ = self 121 - .nsh 122 - .stack() 123 - .manage_profile(|im| im.set_interface_state(self.ident.clone(), InterfaceState::Down)); 124 - res 125 - } 126 - 127 - pub async fn run_inner(&mut self, scratch: &mut [u8]) -> Result<(), RxTxError> { 128 - let Self { 129 - nsh, 130 - socket, 131 - net_id, 132 - ident, 133 - is_controller: _, 134 - consumer: rx, 135 - remote_endpoint, 136 - } = self; 137 - loop { 138 - trace!("Waiting for data from socket or tx queue"); 139 - let a = socket.recv_from(scratch); 140 - let b = rx.wait_read(); 141 - 142 - match select(a, b).await { 143 - Either::First(recv_result) => { 144 - trace!("Socket future"); 145 - // TODO compare the metadata.endpoint to self.remote_endpoint and possibly reject 146 - let (used, metadata) = recv_result.map_err(RxTxError::RxError)?; 147 - trace!( 148 - "Received data from socket. used: {}, metadata: {:?}", 149 - used, metadata 150 - ); 151 - 152 - let data = &scratch[..used]; 153 - 154 - process_frame(net_id, data, nsh, ident.clone()); 155 - } 156 - Either::Second(data) => { 157 - trace!("Tx queue future"); 158 - socket 159 - .send_to(&data, *remote_endpoint) 160 - .await 161 - .map_err(RxTxError::TxError)?; 162 - trace!("Sent data to socket"); 163 - data.release(); 164 - } 165 - } 166 - } 167 - } 168 - } 169 - 170 - impl<const NN: usize, N, C> Drop for RxTxWorker<NN, N, C> 171 - where 172 - N: NetStackHandle, 173 - C: Coord, 174 - { 175 - fn drop(&mut self) { 176 - // No receiver? Drop the interface. 177 - self.nsh.stack().manage_profile(|im| { 178 - _ = im.set_interface_state(self.ident.clone(), InterfaceState::Down); 179 - }) 180 - } 181 - }
···
+171
crates/ergot/src/interface_manager/profiles/direct_edge/eusb_0_4.rs
···
··· 1 + //! A point to point "Edge" profile using USB bulk packets 2 + //! 3 + //! This is useful for devices that are directly connected to a PC via USB with 4 + //! no additional interfaces. 5 + 6 + use crate::{ 7 + interface_manager::{ 8 + InterfaceState, Profile, 9 + interface_impls::embassy_usb::EmbassyInterface, 10 + profiles::direct_edge::{DirectEdge, process_frame}, 11 + }, 12 + net_stack::NetStackHandle, 13 + }; 14 + use bbq2::traits::bbqhdl::BbqHandle; 15 + use defmt::info; 16 + use embassy_usb_0_4::driver::{Driver, Endpoint, EndpointError, EndpointOut}; 17 + 18 + pub type EmbassyUsbManager<Q> = DirectEdge<EmbassyInterface<Q>>; 19 + 20 + /// The Receive Worker 21 + /// 22 + /// This manages the receiver operations, as well as manages the connection state. 23 + /// 24 + /// The `N` const generic buffer is the size of the outgoing buffer. 25 + pub struct RxWorker<Q, N, D> 26 + where 27 + N: NetStackHandle<Profile = EmbassyUsbManager<Q>>, 28 + Q: BbqHandle + 'static, 29 + D: Driver<'static>, 30 + { 31 + nsh: N, 32 + rx: D::EndpointOut, 33 + net_id: Option<u16>, 34 + } 35 + 36 + /// Errors observable by the receiver 37 + enum ReceiverError { 38 + ReceivedMessageTooLarge, 39 + ConnectionClosed, 40 + } 41 + 42 + // ---- impls ---- 43 + 44 + impl<Q, N, D> RxWorker<Q, N, D> 45 + where 46 + N: NetStackHandle<Profile = EmbassyUsbManager<Q>>, 47 + Q: BbqHandle + 'static, 48 + D: Driver<'static>, 49 + { 50 + /// Create a new receiver object 51 + pub fn new(stack: N, rx: D::EndpointOut) -> Self { 52 + Self { 53 + nsh: stack, 54 + rx, 55 + net_id: None, 56 + } 57 + } 58 + 59 + /// Runs forever, processing incoming frames. 60 + /// 61 + /// The provided slice is used for receiving a frame via USB. It is used as the MTU 62 + /// for the entire connections. 63 + /// 64 + /// `max_usb_frame_size` is the largest size of USB frame we can receive. For example, 65 + /// it would be 64. This is NOT the largest message we can receive. It MUST be a power 66 + /// of two. 67 + pub async fn run(mut self, frame: &mut [u8], max_usb_frame_size: usize) -> ! { 68 + assert!(max_usb_frame_size.is_power_of_two()); 69 + loop { 70 + self.rx.wait_enabled().await; 71 + info!("Connection established"); 72 + 73 + // Mark the interface as established 74 + _ = self 75 + .nsh 76 + .stack() 77 + .manage_profile(|im| im.set_interface_state((), InterfaceState::Inactive)); 78 + 79 + // Handle all frames for the connection 80 + self.one_conn(frame, max_usb_frame_size).await; 81 + 82 + // Mark the connection as lost 83 + info!("Connection lost"); 84 + self.nsh.stack().manage_profile(|im| { 85 + _ = im.set_interface_state((), InterfaceState::Down); 86 + }); 87 + } 88 + } 89 + 90 + /// Handle all frames, returning when a connection error occurs 91 + async fn one_conn(&mut self, frame: &mut [u8], max_usb_frame_size: usize) { 92 + loop { 93 + match self.one_frame(frame, max_usb_frame_size).await { 94 + Ok(f) => { 95 + // NOTE: this is BLOCKING, but does NOT wait for the request to 96 + // be processed, we just copy the frame into its destination 97 + // buffers. 98 + // 99 + // We COULD potentially gain some throughput by having another 100 + // buffer here, so we can immediately begin receiving the next 101 + // frame, at the cost of extra buffer space and copies. 102 + process_frame(&mut self.net_id, f, &self.nsh, ()); 103 + } 104 + Err(ReceiverError::ConnectionClosed) => break, 105 + Err(_e) => { 106 + continue; 107 + } 108 + } 109 + } 110 + } 111 + 112 + /// Receive a single ergot frame, which might be across multiple reads of the endpoint 113 + /// 114 + /// No checking of the frame is done, only that the bulk endpoint gave us a frame. 115 + async fn one_frame<'a>( 116 + &mut self, 117 + frame: &'a mut [u8], 118 + max_frame_len: usize, 119 + ) -> Result<&'a mut [u8], ReceiverError> { 120 + let buflen = frame.len(); 121 + let mut window = &mut frame[..]; 122 + 123 + while !window.is_empty() { 124 + let n = match self.rx.read(window).await { 125 + Ok(n) => n, 126 + Err(EndpointError::BufferOverflow) => { 127 + return Err(ReceiverError::ReceivedMessageTooLarge); 128 + } 129 + Err(EndpointError::Disabled) => return Err(ReceiverError::ConnectionClosed), 130 + }; 131 + 132 + let (_now, later) = window.split_at_mut(n); 133 + window = later; 134 + if n != max_frame_len { 135 + // We now have a full frame! Great! 136 + let wlen = window.len(); 137 + let len = buflen - wlen; 138 + let frame = &mut frame[..len]; 139 + 140 + return Ok(frame); 141 + } 142 + } 143 + 144 + // If we got here, we've run out of space. That's disappointing. Accumulate to the 145 + // end of this packet 146 + loop { 147 + match self.rx.read(frame).await { 148 + Ok(n) if n == max_frame_len => {} 149 + Ok(_) => return Err(ReceiverError::ReceivedMessageTooLarge), 150 + Err(EndpointError::BufferOverflow) => { 151 + return Err(ReceiverError::ReceivedMessageTooLarge); 152 + } 153 + Err(EndpointError::Disabled) => return Err(ReceiverError::ConnectionClosed), 154 + }; 155 + } 156 + } 157 + } 158 + 159 + impl<Q, N, D> Drop for RxWorker<Q, N, D> 160 + where 161 + N: NetStackHandle<Profile = EmbassyUsbManager<Q>>, 162 + Q: BbqHandle + 'static, 163 + D: Driver<'static>, 164 + { 165 + fn drop(&mut self) { 166 + // No receiver? Drop the interface. 167 + self.nsh.stack().manage_profile(|im| { 168 + _ = im.set_interface_state((), InterfaceState::Down); 169 + }) 170 + } 171 + }
+1 -1
crates/ergot/src/interface_manager/profiles/direct_edge/eusb_0_5.rs
··· 3 //! This is useful for devices that are directly connected to a PC via USB with 4 //! no additional interfaces. 5 6 - use crate::logging::info; 7 use crate::{ 8 interface_manager::{ 9 InterfaceState, Profile, ··· 13 net_stack::NetStackHandle, 14 }; 15 use bbq2::traits::bbqhdl::BbqHandle; 16 use embassy_usb_0_5::driver::{Driver, Endpoint, EndpointError, EndpointOut}; 17 18 pub type EmbassyUsbManager<Q> = DirectEdge<EmbassyInterface<Q>>;
··· 3 //! This is useful for devices that are directly connected to a PC via USB with 4 //! no additional interfaces. 5 6 use crate::{ 7 interface_manager::{ 8 InterfaceState, Profile, ··· 12 net_stack::NetStackHandle, 13 }; 14 use bbq2::traits::bbqhdl::BbqHandle; 15 + use defmt::info; 16 use embassy_usb_0_5::driver::{Driver, Endpoint, EndpointError, EndpointOut}; 17 18 pub type EmbassyUsbManager<Q> = DirectEdge<EmbassyInterface<Q>>;
+8 -12
crates/ergot/src/interface_manager/profiles/direct_edge/mod.rs
··· 10 //! any outgoing packets, rather than trying to determine whether that packet is 11 //! actually routable to a node on the network. 12 13 - use crate::logging::{debug, trace, warn}; 14 - 15 use serde::Serialize; 16 17 #[cfg(feature = "embedded-io-async-v0_6")] 18 pub mod eio_0_6; 19 20 #[cfg(feature = "embassy-usb-v0_5")] 21 pub mod eusb_0_5; 22 23 #[cfg(feature = "tokio-std")] 24 pub mod tokio_tcp; 25 - 26 - #[cfg(feature = "tokio-std")] 27 - pub mod tokio_udp; 28 - 29 - #[cfg(feature = "embassy-net-v0_7")] 30 - pub mod embassy_net_udp_0_7; 31 32 use crate::{ 33 Header, HeaderSeq, ProtocolError, ··· 84 ) -> Result<(&'b mut I::Sink, HeaderSeq), InterfaceSendError> { 85 let net_id = match &self.state { 86 InterfaceState::Down => { 87 - trace!("{}: ignoring send, interface down", hdr); 88 return Err(InterfaceSendError::NoRouteToDest); 89 } 90 InterfaceState::Inactive => { 91 - trace!("{}: ignoring send, interface inactive", hdr); 92 return Err(InterfaceSendError::NoRouteToDest); 93 } 94 InterfaceState::ActiveLocal { .. } => { 95 // TODO: maybe also handle this? 96 - trace!("{}: ignoring send, interface local only", hdr); 97 return Err(InterfaceSendError::NoRouteToDest); 98 } 99 InterfaceState::Active { net_id, node_id: _ } => *net_id, 100 }; 101 102 - trace!("{}: common_send", hdr); 103 104 if net_id == 0 { 105 debug!("Attempted to send via interface before we have been assigned a net ID");
··· 10 //! any outgoing packets, rather than trying to determine whether that packet is 11 //! actually routable to a node on the network. 12 13 + use log::{debug, trace, warn}; 14 use serde::Serialize; 15 16 #[cfg(feature = "embedded-io-async-v0_6")] 17 pub mod eio_0_6; 18 + 19 + #[cfg(feature = "embassy-usb-v0_4")] 20 + pub mod eusb_0_4; 21 22 #[cfg(feature = "embassy-usb-v0_5")] 23 pub mod eusb_0_5; 24 25 #[cfg(feature = "tokio-std")] 26 pub mod tokio_tcp; 27 28 use crate::{ 29 Header, HeaderSeq, ProtocolError, ··· 80 ) -> Result<(&'b mut I::Sink, HeaderSeq), InterfaceSendError> { 81 let net_id = match &self.state { 82 InterfaceState::Down => { 83 + trace!("{hdr}: ignoring send, interface down"); 84 return Err(InterfaceSendError::NoRouteToDest); 85 } 86 InterfaceState::Inactive => { 87 + trace!("{hdr}: ignoring send, interface inactive"); 88 return Err(InterfaceSendError::NoRouteToDest); 89 } 90 InterfaceState::ActiveLocal { .. } => { 91 // TODO: maybe also handle this? 92 + trace!("{hdr}: ignoring send, interface local only"); 93 return Err(InterfaceSendError::NoRouteToDest); 94 } 95 InterfaceState::Active { net_id, node_id: _ } => *net_id, 96 }; 97 98 + trace!("{hdr}: common_send"); 99 100 if net_id == 0 { 101 debug!("Attempted to send via interface before we have been assigned a net ID");
+2 -2
crates/ergot/src/interface_manager/profiles/direct_edge/tokio_tcp.rs
··· 18 net_stack::NetStackHandle, 19 }; 20 21 - use crate::logging::{error, info, trace, warn}; 22 use bbq2::{prod_cons::stream::StreamConsumer, traits::bbqhdl::BbqHandle}; 23 use maitake_sync::WaitQueue; 24 use tokio::{ 25 io::{AsyncReadExt, AsyncWriteExt}, ··· 158 let res = tx.write_all(&frame).await; 159 frame.release(len); 160 if let Err(e) = res { 161 - error!("Err: {:?}", e); 162 break; 163 } 164 }
··· 18 net_stack::NetStackHandle, 19 }; 20 21 use bbq2::{prod_cons::stream::StreamConsumer, traits::bbqhdl::BbqHandle}; 22 + use log::{error, info, trace, warn}; 23 use maitake_sync::WaitQueue; 24 use tokio::{ 25 io::{AsyncReadExt, AsyncWriteExt}, ··· 158 let res = tx.write_all(&frame).await; 159 frame.release(len); 160 if let Err(e) = res { 161 + error!("Err: {e:?}"); 162 break; 163 } 164 }
-190
crates/ergot/src/interface_manager/profiles/direct_edge/tokio_udp.rs
··· 1 - //! A std+udp edge device profile 2 - //! 3 - //! This is useful for std based devices/applications that can directly connect to a DirectRouter 4 - //! using a udp connection. 5 - 6 - use std::sync::Arc; 7 - 8 - use crate::{ 9 - interface_manager::{ 10 - InterfaceState, Profile, 11 - interface_impls::tokio_udp::TokioUdpInterface, 12 - profiles::direct_edge::{DirectEdge, process_frame}, 13 - utils::std::{ReceiverError, StdQueue}, 14 - }, 15 - net_stack::NetStackHandle, 16 - }; 17 - 18 - use crate::interface_manager::profiles::direct_edge::{CENTRAL_NODE_ID, EDGE_NODE_ID}; 19 - use crate::logging::{error, info, trace, warn}; 20 - use bbq2::prod_cons::framed::FramedConsumer; 21 - use bbq2::traits::bbqhdl::BbqHandle; 22 - use maitake_sync::WaitQueue; 23 - use tokio::{net::UdpSocket, select}; 24 - 25 - pub type StdUdpClientIm = DirectEdge<TokioUdpInterface>; 26 - 27 - pub struct RxWorker<N: NetStackHandle> { 28 - stack: N, 29 - skt: Arc<UdpSocket>, 30 - closer: Arc<WaitQueue>, 31 - net_id: u16, 32 - } 33 - 34 - // ---- impls ---- 35 - 36 - impl<N> RxWorker<N> 37 - where 38 - N: NetStackHandle<Profile = DirectEdge<TokioUdpInterface>>, 39 - { 40 - pub async fn run(mut self) -> Result<(), ReceiverError> { 41 - info!("Started rx_worker"); 42 - 43 - let res = self.run_inner().await; 44 - 45 - info!("Finished rx_worker"); 46 - 47 - self.stack.stack().manage_profile(|im| { 48 - _ = im.set_interface_state((), InterfaceState::Down); 49 - }); 50 - res 51 - } 52 - 53 - pub async fn run_inner(&mut self) -> Result<(), ReceiverError> { 54 - let mut raw_buf = [0u8; 4096]; 55 - let mut net_id = Some(self.net_id); 56 - 57 - loop { 58 - let rd = self.skt.recv_from(&mut raw_buf); 59 - let close = self.closer.wait(); 60 - 61 - let ct = select! { 62 - r = rd => { 63 - match r { 64 - Ok((0, _)) => { 65 - warn!("received nothing, retrying"); 66 - continue 67 - }, 68 - Err(e) => { 69 - warn!("receiver error, retrying. error: {}", e); 70 - continue 71 - //return Err(ReceiverError::SocketClosed) 72 - }, 73 - Ok((ct, remote_address)) => { 74 - // TODO ensure the remote address is allowed to connect to this edge 75 - // this implementation blindly accepts all connections 76 - trace!("received {} bytes from {}", ct, remote_address); 77 - ct 78 - }, 79 - } 80 - } 81 - _c = close => { 82 - return Err(ReceiverError::SocketClosed); 83 - } 84 - }; 85 - 86 - let buf = &mut raw_buf[..ct]; 87 - process_frame(&mut net_id, buf, &self.stack, ()); 88 - } 89 - } 90 - } 91 - 92 - #[derive(Debug, PartialEq)] 93 - pub struct SocketAlreadyActive; 94 - 95 - // Helper functions 96 - 97 - pub enum InterfaceKind { 98 - Target, 99 - Controller, 100 - } 101 - 102 - pub async fn register_interface<N>( 103 - stack: N, 104 - socket: UdpSocket, 105 - queue: StdQueue, 106 - interface_kind: InterfaceKind, 107 - ident: <<N as NetStackHandle>::Profile as Profile>::InterfaceIdent, 108 - ) -> Result<(), SocketAlreadyActive> 109 - where 110 - N: NetStackHandle<Profile = DirectEdge<TokioUdpInterface>>, 111 - N: Send + 'static, 112 - { 113 - let arc_socket = Arc::new(socket); 114 - let (rx, tx) = (arc_socket.clone(), arc_socket); 115 - 116 - let net_id = 1_u16; 117 - 118 - let closer = Arc::new(WaitQueue::new()); 119 - stack.stack().manage_profile(|im| { 120 - match im.interface_state(()) { 121 - Some(InterfaceState::Down) => {} 122 - Some(InterfaceState::Inactive) => return Err(SocketAlreadyActive), 123 - Some(InterfaceState::ActiveLocal { .. }) => return Err(SocketAlreadyActive), 124 - Some(InterfaceState::Active { .. }) => return Err(SocketAlreadyActive), 125 - None => {} 126 - } 127 - 128 - match interface_kind { 129 - InterfaceKind::Controller => { 130 - trace!("UDP controller is active"); 131 - im.set_interface_state( 132 - ident, 133 - InterfaceState::Active { 134 - net_id, 135 - node_id: CENTRAL_NODE_ID, 136 - }, 137 - ) 138 - } 139 - InterfaceKind::Target => { 140 - trace!("UDP target is active"); 141 - im.set_interface_state( 142 - ident, 143 - InterfaceState::Active { 144 - net_id, 145 - node_id: EDGE_NODE_ID, 146 - }, 147 - ) 148 - } 149 - } 150 - .map_err(|_| SocketAlreadyActive)?; 151 - 152 - Ok(()) 153 - })?; 154 - let rx_worker = RxWorker { 155 - stack, 156 - skt: rx, 157 - closer: closer.clone(), 158 - net_id, 159 - }; 160 - // TODO: spawning in a non-async context! 161 - tokio::task::spawn(tx_worker(tx, queue.framed_consumer(), closer.clone())); 162 - tokio::task::spawn(rx_worker.run()); 163 - Ok(()) 164 - } 165 - 166 - async fn tx_worker(tx: Arc<UdpSocket>, rx: FramedConsumer<StdQueue>, closer: Arc<WaitQueue>) { 167 - info!("Started tx_worker"); 168 - loop { 169 - let rxf = rx.wait_read(); 170 - let clf = closer.wait(); 171 - 172 - let frame = select! { 173 - r = rxf => r, 174 - _c = clf => { 175 - break; 176 - } 177 - }; 178 - 179 - let len = frame.len(); 180 - trace!("sending pkt len:{}", len); 181 - let res = tx.send(&frame).await; 182 - frame.release(); 183 - if let Err(e) = res { 184 - error!("Err: {e:?}"); 185 - break; 186 - } 187 - } 188 - // TODO: GC waker? 189 - warn!("Closing interface"); 190 - }
···
+24 -46
crates/ergot/src/interface_manager/profiles/direct_router/mod.rs
··· 5 //! as well as messages to/from itself and an edge device. It does not currently handle 6 //! multi-hop routing. 7 8 - #[cfg(all(feature = "embassy-net-v0_7", not(feature = "_all-features-hack")))] 9 - use embassy_time::Duration; 10 - #[cfg(all(feature = "embassy-net-v0_7", not(feature = "_all-features-hack")))] 11 - use embassy_time::Instant; 12 - #[cfg(any(feature = "std", feature = "_all-features-hack"))] 13 - use std::time::{Duration, Instant}; 14 - 15 - #[cfg(feature = "std")] 16 - use std::collections::{BTreeMap, HashMap}; 17 18 - use crate::logging::{debug, info, trace, warn}; 19 - #[cfg(feature = "std")] 20 use rand::Rng; 21 22 use crate::{ ··· 32 33 use super::direct_edge::EDGE_NODE_ID; 34 35 - #[cfg(feature = "tokio-std")] 36 pub mod tokio_tcp; 37 - #[cfg(feature = "tokio-std")] 38 - pub mod tokio_udp; 39 40 #[cfg(feature = "nusb-v0_1")] 41 pub mod nusb_0_1; ··· 164 if hdr.any_all.is_none() { 165 return Err(InterfaceSendError::AnyPortMissingKey); 166 } 167 - if self.direct_links.is_empty() { 168 - return Err(InterfaceSendError::NoRouteToDest); 169 - } 170 - 171 - // use this error until we find a non-origin destination 172 - let mut default_error = InterfaceSendError::RoutingLoop; 173 - 174 let mut any_good = false; 175 for (_ident, p) in self.direct_links.iter_mut() { 176 // Don't send back to the origin 177 if source == p.ident { 178 continue; 179 } 180 - // if there's a non-origin destination, and we can't send to it, then use this error 181 - default_error = InterfaceSendError::NoRouteToDest; 182 183 // For broadcast messages, rewrite the destination address 184 // to the address of the next hop. ··· 186 hdr.dst.node_id = EDGE_NODE_ID; 187 any_good |= p.edge.send_raw(&hdr, data).is_ok(); 188 } 189 - if any_good { Ok(()) } else { Err(default_error) } 190 } else { 191 let nshdr = hdr.clone().into(); 192 let intfc = self.find(&nshdr, Some(source))?; ··· 277 let now = Instant::now(); 278 // Are we ALREADY expired? 279 if *expiration_time <= now { 280 - warn!("Tombstoning net_id: {}", req_refresh_net); 281 rte.kind = RouteKind::Tombstone { 282 clear_time: now + Duration::from_secs(30), 283 }; ··· 418 } => { 419 // If a route has expired, mark it tombstoned to avoid re-using it for a bit 420 if expiration_time <= now { 421 - warn!("Tombstoning net_id: {}", net_id); 422 rte.kind = RouteKind::Tombstone { 423 clear_time: now + Duration::from_secs(30), 424 }; ··· 427 RouteKind::Tombstone { clear_time } => { 428 // If we've cleared the tombstone time, then re-use this net id 429 if clear_time <= now { 430 - info!("Reclaiming tombstoned net_id: {}", net_id); 431 to_evict = Some(*net_id); 432 break; 433 } 434 } 435 } 436 if *net_id > new_net_id { 437 - trace!("Found gap: {}", net_id); 438 break; 439 } 440 debug_assert!(*net_id == new_net_id); ··· 489 }; 490 if let Some(rte) = self.routes.remove(&node.net_id) { 491 debug!( 492 - "removing interface with net_id: {}, ident: {:?}", 493 - node.net_id, ident, 494 ); 495 assert!(matches!(rte.kind, RouteKind::DirectAssigned)); 496 } else { ··· 500 self.routes.retain(|net_id, rte| { 501 let keep = rte.ident != ident; 502 if !keep { 503 - debug!( 504 - "removing indirect route with net_id: {}, ident: {:?}", 505 - net_id, ident 506 - ) 507 } 508 keep 509 }); ··· 540 // Successfully received a packet, now we need to 541 // do something with it. 542 if let Some(mut frame) = de_frame(data) { 543 - trace!("{} got frame from {:?}", frame.hdr, ident); 544 // If the message comes in and has a src net_id of zero, 545 // we should rewrite it so it isn't later understood as a 546 // local packet. 547 if frame.hdr.src.network_id == 0 { 548 match frame.hdr.src.node_id { 549 0 => { 550 - log::warn!( 551 - "{}: device is sending us frames without a node id, ignoring", 552 - frame.hdr 553 - ); 554 return; 555 } 556 CENTRAL_NODE_ID => { ··· 559 } 560 EDGE_NODE_ID => {} 561 _ => { 562 - log::warn!( 563 - "{}: device is sending us frames with a bad node id, ignoring", 564 - frame.hdr 565 - ); 566 return; 567 } 568 } ··· 585 Ok(()) => {} 586 Err(e) => { 587 // TODO: match on error, potentially try to send NAK? 588 - warn!("{} recv->send error: {:?}", frame.hdr, e); 589 } 590 } 591 } else { ··· 594 } 595 596 mod edge_interface_plus { 597 - use crate::logging::trace; 598 use serde::Serialize; 599 600 use crate::{ ··· 642 InterfaceState::Active { net_id, node_id: _ } => *net_id, 643 }; 644 645 - trace!("{} common_send", hdr); 646 647 // TODO: when this WAS a real Profile, we did a lot of these things, but 648 // now they should be done by the router. For now, we just have asserts,
··· 5 //! as well as messages to/from itself and an edge device. It does not currently handle 6 //! multi-hop routing. 7 8 + use core::time::Duration; 9 + use std::{ 10 + collections::{BTreeMap, HashMap}, 11 + time::Instant, 12 + }; 13 14 + use log::{debug, info, trace, warn}; 15 use rand::Rng; 16 17 use crate::{ ··· 27 28 use super::direct_edge::EDGE_NODE_ID; 29 30 pub mod tokio_tcp; 31 32 #[cfg(feature = "nusb-v0_1")] 33 pub mod nusb_0_1; ··· 156 if hdr.any_all.is_none() { 157 return Err(InterfaceSendError::AnyPortMissingKey); 158 } 159 let mut any_good = false; 160 for (_ident, p) in self.direct_links.iter_mut() { 161 // Don't send back to the origin 162 if source == p.ident { 163 continue; 164 } 165 166 // For broadcast messages, rewrite the destination address 167 // to the address of the next hop. ··· 169 hdr.dst.node_id = EDGE_NODE_ID; 170 any_good |= p.edge.send_raw(&hdr, data).is_ok(); 171 } 172 + if any_good { 173 + Ok(()) 174 + } else { 175 + Err(InterfaceSendError::NoRouteToDest) 176 + } 177 } else { 178 let nshdr = hdr.clone().into(); 179 let intfc = self.find(&nshdr, Some(source))?; ··· 264 let now = Instant::now(); 265 // Are we ALREADY expired? 266 if *expiration_time <= now { 267 + warn!("Tombstoning net_id: {req_refresh_net}"); 268 rte.kind = RouteKind::Tombstone { 269 clear_time: now + Duration::from_secs(30), 270 }; ··· 405 } => { 406 // If a route has expired, mark it tombstoned to avoid re-using it for a bit 407 if expiration_time <= now { 408 + warn!("Tombstoning net_id: {net_id}"); 409 rte.kind = RouteKind::Tombstone { 410 clear_time: now + Duration::from_secs(30), 411 }; ··· 414 RouteKind::Tombstone { clear_time } => { 415 // If we've cleared the tombstone time, then re-use this net id 416 if clear_time <= now { 417 + info!("Reclaiming tombstoned net_id: {net_id}"); 418 to_evict = Some(*net_id); 419 break; 420 } 421 } 422 } 423 if *net_id > new_net_id { 424 + trace!("Found gap: {net_id}"); 425 break; 426 } 427 debug_assert!(*net_id == new_net_id); ··· 476 }; 477 if let Some(rte) = self.routes.remove(&node.net_id) { 478 debug!( 479 + "removing interface with net_id: {}, ident: {ident:?}", 480 + node.net_id 481 ); 482 assert!(matches!(rte.kind, RouteKind::DirectAssigned)); 483 } else { ··· 487 self.routes.retain(|net_id, rte| { 488 let keep = rte.ident != ident; 489 if !keep { 490 + debug!("removing indirect route with net_id: {net_id}, ident: {ident:?}") 491 } 492 keep 493 }); ··· 524 // Successfully received a packet, now we need to 525 // do something with it. 526 if let Some(mut frame) = de_frame(data) { 527 + trace!("{} got frame from {ident:?}", frame.hdr); 528 // If the message comes in and has a src net_id of zero, 529 // we should rewrite it so it isn't later understood as a 530 // local packet. 531 if frame.hdr.src.network_id == 0 { 532 match frame.hdr.src.node_id { 533 0 => { 534 + log::warn!("{}: device is sending us frames without a node id, ignoring", frame.hdr); 535 return; 536 } 537 CENTRAL_NODE_ID => { ··· 540 } 541 EDGE_NODE_ID => {} 542 _ => { 543 + log::warn!("{}: device is sending us frames with a bad node id, ignoring", frame.hdr); 544 return; 545 } 546 } ··· 563 Ok(()) => {} 564 Err(e) => { 565 // TODO: match on error, potentially try to send NAK? 566 + warn!("{} recv->send error: {e:?}", frame.hdr); 567 } 568 } 569 } else { ··· 572 } 573 574 mod edge_interface_plus { 575 + use log::trace; 576 use serde::Serialize; 577 578 use crate::{ ··· 620 InterfaceState::Active { net_id, node_id: _ } => *net_id, 621 }; 622 623 + trace!("{hdr} common_send"); 624 625 // TODO: when this WAS a real Profile, we did a lot of these things, but 626 // now they should be done by the router. For now, we just have asserts,
+9 -9
crates/ergot/src/interface_manager/profiles/direct_router/nusb_0_1.rs
··· 2 //! 3 //! This implementation can be used to connect to a number of direct edge USB devices. 4 5 - use crate::logging::{debug, error, info, trace, warn}; 6 use bbq2::{prod_cons::framed::FramedConsumer, traits::bbqhdl::BbqHandle}; 7 use maitake_sync::WaitQueue; 8 use nusb::transfer::{Queue, RequestBuffer, TransferError}; 9 use std::sync::Arc; ··· 92 93 let send_res = self.boq.next_complete().await; 94 if let Err(e) = send_res.status { 95 - error!("Output Queue Error: {:?}", e); 96 return; 97 } 98 99 if needs_zlp { 100 let send_res = self.boq.next_complete().await; 101 if let Err(e) = send_res.status { 102 - error!("Output Queue Error: {:?}", e); 103 return; 104 } 105 } ··· 123 run = self.run_inner() => { 124 // Halt the TX worker 125 self.closer.close(); 126 - error!("Receive Error: {:?}", run); 127 }, 128 _clf = close.wait() => {}, 129 } ··· 148 self.consecutive_errs += 1; 149 150 error!( 151 - "In Worker error: {:?}, consecutive: {}", 152 - e, self.consecutive_errs, 153 ); 154 155 // Docs only recommend this for Stall, but it seems to work with ··· 187 match self.biq.clear_halt() { 188 Ok(()) => false, 189 Err(e) => { 190 - error!("Failed to clear stall: {:?}, Fatal.", e); 191 true 192 } 193 } 194 } else { 195 error!( 196 - "Giving up after {} errors in a row, final error: {:?}", 197 - e, self.consecutive_errs, 198 ); 199 true 200 };
··· 2 //! 3 //! This implementation can be used to connect to a number of direct edge USB devices. 4 5 use bbq2::{prod_cons::framed::FramedConsumer, traits::bbqhdl::BbqHandle}; 6 + use log::{debug, error, info, trace, warn}; 7 use maitake_sync::WaitQueue; 8 use nusb::transfer::{Queue, RequestBuffer, TransferError}; 9 use std::sync::Arc; ··· 92 93 let send_res = self.boq.next_complete().await; 94 if let Err(e) = send_res.status { 95 + error!("Output Queue Error: {e:?}"); 96 return; 97 } 98 99 if needs_zlp { 100 let send_res = self.boq.next_complete().await; 101 if let Err(e) = send_res.status { 102 + error!("Output Queue Error: {e:?}"); 103 return; 104 } 105 } ··· 123 run = self.run_inner() => { 124 // Halt the TX worker 125 self.closer.close(); 126 + error!("Receive Error: {run:?}"); 127 }, 128 _clf = close.wait() => {}, 129 } ··· 148 self.consecutive_errs += 1; 149 150 error!( 151 + "In Worker error: {e:?}, consecutive: {}", 152 + self.consecutive_errs 153 ); 154 155 // Docs only recommend this for Stall, but it seems to work with ··· 187 match self.biq.clear_halt() { 188 Ok(()) => false, 189 Err(e) => { 190 + error!("Failed to clear stall: {e:?}, Fatal."); 191 true 192 } 193 } 194 } else { 195 error!( 196 + "Giving up after {} errors in a row, final error: {e:?}", 197 + self.consecutive_errs 198 ); 199 true 200 };
+4 -4
crates/ergot/src/interface_manager/profiles/direct_router/tokio_serial_5.rs
··· 2 //! 3 //! This implementation can be used to connect to a number of direct edge serial devices. 4 5 - use crate::logging::{debug, error, info, warn}; 6 use crate::{ 7 interface_manager::{ 8 InterfaceState, Profile, ··· 21 }; 22 use bbq2::{prod_cons::stream::StreamConsumer, traits::bbqhdl::BbqHandle}; 23 use cobs::max_encoding_overhead; 24 use maitake_sync::WaitQueue; 25 use std::sync::Arc; 26 use tokio::{ ··· 80 let res = self.tx.write_all(&frame).await; 81 frame.release(len); 82 if let Err(e) = res { 83 - error!("Err: {:?}", e); 84 break; 85 } 86 } ··· 101 run = self.run_inner() => { 102 // Halt the TX worker 103 self.closer.close(); 104 - error!("Receive Error: {:?}", run); 105 }, 106 _clf = close.wait() => {}, 107 } ··· 168 { 169 let port = tokio_serial_v5::new(serial_path, baud) 170 .open_native_async() 171 - .map_err(|e| Error::Serial(format!("Open Error: {:?}", e)))?; 172 let (rx, tx) = tokio::io::split(port); 173 let q: StdQueue = new_std_queue(outgoing_buffer_size); 174 let res = stack.stack().manage_profile(|im| {
··· 2 //! 3 //! This implementation can be used to connect to a number of direct edge serial devices. 4 5 use crate::{ 6 interface_manager::{ 7 InterfaceState, Profile, ··· 20 }; 21 use bbq2::{prod_cons::stream::StreamConsumer, traits::bbqhdl::BbqHandle}; 22 use cobs::max_encoding_overhead; 23 + use log::{debug, error, info, warn}; 24 use maitake_sync::WaitQueue; 25 use std::sync::Arc; 26 use tokio::{ ··· 80 let res = self.tx.write_all(&frame).await; 81 frame.release(len); 82 if let Err(e) = res { 83 + error!("Err: {e:?}"); 84 break; 85 } 86 } ··· 101 run = self.run_inner() => { 102 // Halt the TX worker 103 self.closer.close(); 104 + error!("Receive Error: {run:?}"); 105 }, 106 _clf = close.wait() => {}, 107 } ··· 168 { 169 let port = tokio_serial_v5::new(serial_path, baud) 170 .open_native_async() 171 + .map_err(|e| Error::Serial(format!("Open Error: {e:?}")))?; 172 let (rx, tx) = tokio::io::split(port); 173 let q: StdQueue = new_std_queue(outgoing_buffer_size); 174 let res = stack.stack().manage_profile(|im| {
+3 -3
crates/ergot/src/interface_manager/profiles/direct_router/tokio_tcp.rs
··· 2 //! 3 //! This implementation can be used to connect to a number of direct edge TCP devices. 4 5 - use crate::logging::{debug, error, info, warn}; 6 use bbq2::{prod_cons::stream::StreamConsumer, traits::bbqhdl::BbqHandle}; 7 use cobs::max_encoding_overhead; 8 use maitake_sync::WaitQueue; 9 use std::sync::Arc; 10 use tokio::{ ··· 83 let res = self.tx.write_all(&frame).await; 84 frame.release(len); 85 if let Err(e) = res { 86 - error!("Err: {:?}", e); 87 break; 88 } 89 } ··· 104 run = self.run_inner() => { 105 // Halt the TX worker 106 self.closer.close(); 107 - error!("Receive Error: {:?}", run); 108 }, 109 _clf = close.wait() => {}, 110 }
··· 2 //! 3 //! This implementation can be used to connect to a number of direct edge TCP devices. 4 5 use bbq2::{prod_cons::stream::StreamConsumer, traits::bbqhdl::BbqHandle}; 6 use cobs::max_encoding_overhead; 7 + use log::{debug, error, info, warn}; 8 use maitake_sync::WaitQueue; 9 use std::sync::Arc; 10 use tokio::{ ··· 83 let res = self.tx.write_all(&frame).await; 84 frame.release(len); 85 if let Err(e) = res { 86 + error!("Err: {e:?}"); 87 break; 88 } 89 } ··· 104 run = self.run_inner() => { 105 // Halt the TX worker 106 self.closer.close(); 107 + error!("Receive Error: {run:?}"); 108 }, 109 _clf = close.wait() => {}, 110 }
-190
crates/ergot/src/interface_manager/profiles/direct_router/tokio_udp.rs
··· 1 - //! A UDP based DirectRouter 2 - //! 3 - //! This implementation can be used to connect to a number of direct edge UDP devices. 4 - 5 - use crate::logging::{debug, error, info, trace, warn}; 6 - use bbq2::{prod_cons::framed::FramedConsumer, traits::bbqhdl::BbqHandle}; 7 - use maitake_sync::WaitQueue; 8 - use std::sync::Arc; 9 - use tokio::{net::UdpSocket, select}; 10 - 11 - use crate::{ 12 - interface_manager::{ 13 - InterfaceState, Profile, 14 - interface_impls::tokio_udp::TokioUdpInterface, 15 - profiles::direct_router::{DirectRouter, process_frame}, 16 - utils::{ 17 - framed_stream::Sink, 18 - std::{ReceiverError, StdQueue, new_std_queue}, 19 - }, 20 - }, 21 - net_stack::NetStackHandle, 22 - }; 23 - 24 - #[derive(Debug, PartialEq)] 25 - pub enum Error { 26 - OutOfNetIds, 27 - } 28 - 29 - struct TxWorker { 30 - net_id: u16, 31 - tx: Arc<UdpSocket>, 32 - rx: FramedConsumer<StdQueue>, 33 - closer: Arc<WaitQueue>, 34 - } 35 - 36 - struct RxWorker<N> 37 - where 38 - N: NetStackHandle<Profile = DirectRouter<TokioUdpInterface>>, 39 - N: Send + 'static, 40 - { 41 - interface_id: u64, 42 - net_id: u16, 43 - nsh: N, 44 - skt: Arc<UdpSocket>, 45 - closer: Arc<WaitQueue>, 46 - } 47 - 48 - impl TxWorker { 49 - async fn run(mut self) { 50 - self.run_inner().await; 51 - warn!("Closing interface {}", self.net_id); 52 - self.closer.close(); 53 - } 54 - 55 - async fn run_inner(&mut self) { 56 - info!("Started tx_worker for net_id {}", self.net_id); 57 - loop { 58 - let rxf = self.rx.wait_read(); 59 - let clf = self.closer.wait(); 60 - 61 - let frame = select! { 62 - r = rxf => r, 63 - _c = clf => { 64 - break; 65 - } 66 - }; 67 - 68 - let len = frame.len(); 69 - debug!("sending pkt len:{} on net_id {}", len, self.net_id); 70 - let res = self.tx.send(&frame).await; 71 - frame.release(); 72 - if let Err(e) = res { 73 - error!("Err: {e:?}"); 74 - break; 75 - } 76 - } 77 - } 78 - } 79 - 80 - impl<N> RxWorker<N> 81 - where 82 - N: NetStackHandle<Profile = DirectRouter<TokioUdpInterface>>, 83 - N: Send + 'static, 84 - { 85 - async fn run(mut self) { 86 - let close = self.closer.clone(); 87 - 88 - // Wait for the receiver to encounter an error, or wait for 89 - // the transmitter to signal that it observed an error 90 - select! { 91 - run = self.run_inner() => { 92 - // Halt the TX worker 93 - self.closer.close(); 94 - error!("Receive Error: {run:?}"); 95 - }, 96 - _clf = close.wait() => {}, 97 - } 98 - 99 - // Remove this interface from the list 100 - self.nsh.stack().manage_profile(|im| { 101 - _ = im.deregister_interface(self.interface_id); 102 - }); 103 - } 104 - 105 - pub async fn run_inner(&mut self) -> ReceiverError { 106 - let mut raw_buf = vec![0u8; 4096].into_boxed_slice(); 107 - 108 - loop { 109 - let rd = self.skt.recv_from(&mut raw_buf); 110 - let close = self.closer.wait(); 111 - 112 - let ct = select! { 113 - r = rd => { 114 - match r { 115 - Ok((0, _)) => { 116 - warn!("received nothing, retrying"); 117 - continue 118 - }, 119 - Err(e) => { 120 - warn!("receiver error, retrying. error: {}, kind: {}", e, e.kind()); 121 - continue 122 - }, 123 - Ok((ct, remote_address)) => { 124 - // TODO ensure the remote address is allowed to connect to this router 125 - // this implementation blindly accepts all connections 126 - trace!("received {} bytes from {}", ct, remote_address); 127 - ct 128 - }, 129 - } 130 - } 131 - _c = close => { 132 - return ReceiverError::SocketClosed; 133 - } 134 - }; 135 - 136 - let buf = &mut raw_buf[..ct]; 137 - process_frame(self.net_id, buf, &self.nsh, self.interface_id); 138 - } 139 - } 140 - } 141 - 142 - pub async fn register_interface<N>( 143 - stack: N, 144 - socket: UdpSocket, 145 - max_ergot_packet_size: u16, 146 - outgoing_buffer_size: usize, 147 - ) -> Result<u64, Error> 148 - where 149 - N: NetStackHandle<Profile = DirectRouter<TokioUdpInterface>>, 150 - N: Send + 'static, 151 - { 152 - let arc_socket = Arc::new(socket); 153 - let (rx, tx) = (arc_socket.clone(), arc_socket); 154 - 155 - let q: StdQueue = new_std_queue(outgoing_buffer_size); 156 - let res = stack.stack().manage_profile(|im| { 157 - let ident = 158 - im.register_interface(Sink::new_from_handle(q.clone(), max_ergot_packet_size))?; 159 - let state = im.interface_state(ident)?; 160 - match state { 161 - InterfaceState::Active { net_id, node_id: _ } => Some((ident, net_id)), 162 - _ => { 163 - _ = im.deregister_interface(ident); 164 - None 165 - } 166 - } 167 - }); 168 - let Some((ident, net_id)) = res else { 169 - return Err(Error::OutOfNetIds); 170 - }; 171 - let closer = Arc::new(WaitQueue::new()); 172 - let rx_worker = RxWorker { 173 - nsh: stack.clone(), 174 - skt: rx, 175 - closer: closer.clone(), 176 - interface_id: ident, 177 - net_id, 178 - }; 179 - let tx_worker = TxWorker { 180 - net_id, 181 - tx, 182 - rx: <StdQueue as BbqHandle>::framed_consumer(&q), 183 - closer, 184 - }; 185 - 186 - tokio::task::spawn(rx_worker.run()); 187 - tokio::task::spawn(tx_worker.run()); 188 - 189 - Ok(ident) 190 - }
···
+5 -6
crates/ergot/src/lib.rs
··· 20 // Compat hack, remove on next breaking change 21 pub use logging::fmtlog; 22 23 - use crate::logging::warn; 24 pub use address::Address; 25 use interface_manager::InterfaceSendError; 26 use nash::NameHash; 27 pub use net_stack::{NetStack, NetStackSendError}; 28 use serde::{Deserialize, Serialize}; 29 30 #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 31 - #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Eq)] 32 pub struct FrameKind(pub u8); 33 34 #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] ··· 56 pub ttl: u8, 57 } 58 59 - #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 60 #[derive(Debug, Clone)] 61 pub struct HeaderSeq { 62 pub src: Address, ··· 75 self.src, self.dst, self.kind.0, 76 )?; 77 if let Some(seq) = self.seq_no { 78 - write!(f, "{:04X}", seq)?; 79 } else { 80 f.write_str("----")?; 81 } ··· 179 #[inline] 180 pub fn decrement_ttl(&mut self) -> Result<(), InterfaceSendError> { 181 self.ttl = self.ttl.checked_sub(1).ok_or_else(|| { 182 - warn!("Header TTL expired: {:?}", self); 183 InterfaceSendError::TtlExpired 184 })?; 185 Ok(()) ··· 190 #[inline] 191 pub fn decrement_ttl(&mut self) -> Result<(), InterfaceSendError> { 192 self.ttl = self.ttl.checked_sub(1).ok_or_else(|| { 193 - warn!("Header TTL expired: {:?}", self); 194 InterfaceSendError::TtlExpired 195 })?; 196 Ok(())
··· 20 // Compat hack, remove on next breaking change 21 pub use logging::fmtlog; 22 23 pub use address::Address; 24 use interface_manager::InterfaceSendError; 25 + use log::warn; 26 use nash::NameHash; 27 pub use net_stack::{NetStack, NetStackSendError}; 28 use serde::{Deserialize, Serialize}; 29 30 #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 31 + #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] 32 pub struct FrameKind(pub u8); 33 34 #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] ··· 56 pub ttl: u8, 57 } 58 59 #[derive(Debug, Clone)] 60 pub struct HeaderSeq { 61 pub src: Address, ··· 74 self.src, self.dst, self.kind.0, 75 )?; 76 if let Some(seq) = self.seq_no { 77 + write!(f, "{seq:04X}")?; 78 } else { 79 f.write_str("----")?; 80 } ··· 178 #[inline] 179 pub fn decrement_ttl(&mut self) -> Result<(), InterfaceSendError> { 180 self.ttl = self.ttl.checked_sub(1).ok_or_else(|| { 181 + warn!("Header TTL expired: {self:?}"); 182 InterfaceSendError::TtlExpired 183 })?; 184 Ok(()) ··· 189 #[inline] 190 pub fn decrement_ttl(&mut self) -> Result<(), InterfaceSendError> { 191 self.ttl = self.ttl.checked_sub(1).ok_or_else(|| { 192 + warn!("Header TTL expired: {self:?}"); 193 InterfaceSendError::TtlExpired 194 })?; 195 Ok(())
+1 -1
crates/ergot/src/logging/fmtlog.rs
··· 84 let y = "world"; 85 let res = postcard::to_vec::<_, 128>(&ErgotFmtTx { 86 level: Level::Warn, 87 - inner: &format_args!("hello {}, {}", x, y), 88 }) 89 .unwrap(); 90
··· 84 let y = "world"; 85 let res = postcard::to_vec::<_, 128>(&ErgotFmtTx { 86 level: Level::Warn, 87 + inner: &format_args!("hello {x}, {}", y), 88 }) 89 .unwrap(); 90
-83
crates/ergot/src/logging/mod.rs
··· 1 - //! Here we make logging macros available. 2 - //! Based on features we either export defmt macros or log wrapper macros. 3 - 4 pub mod fmtlog; 5 pub mod log_v0_4; 6 - 7 - // conditional logging re-exports 8 - 9 - #[allow(unused_imports)] 10 - #[cfg(all(feature = "defmt-v1", not(feature = "std")))] 11 - pub(crate) use defmt::{debug, error, info, trace, warn}; 12 - 13 - /// Wrapper macro for log::debug that uses the internal ergot logger. 14 - #[clippy::format_args] 15 - #[cfg(not(all(feature = "defmt-v1", not(feature = "std"))))] 16 - macro_rules! debug { 17 - // debug!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log") 18 - // debug!(target: "my_target", "a {} event", "log") 19 - (target: $target:expr, $($arg:tt)+) => ({ 20 - log::debug!(logger: $crate::logging::log_v0_4::internal::geil(), target: $target, $($arg)+) 21 - }); 22 - 23 - // debug!("a {} event", "log") 24 - ($($arg:tt)+) => (log::debug!(logger: $crate::logging::log_v0_4::internal::geil(), $($arg)+)) 25 - } 26 - 27 - /// Wrapper macro for log::error that uses the internal ergot logger. 28 - #[clippy::format_args] 29 - #[cfg(not(all(feature = "defmt-v1", not(feature = "std"))))] 30 - macro_rules! error { 31 - // error!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log") 32 - // error!(target: "my_target", "a {} event", "log") 33 - (target: $target:expr, $($arg:tt)+) => ({ 34 - log::error!(logger: $crate::logging::log_v0_4::internal::geil(), target: $target, $($arg)+) 35 - }); 36 - 37 - // error!("a {} event", "log") 38 - ($($arg:tt)+) => (log::error!(logger: $crate::logging::log_v0_4::internal::geil(), $($arg)+)) 39 - } 40 - 41 - /// Wrapper macro for log::info that uses the internal ergot logger. 42 - #[clippy::format_args] 43 - #[cfg(not(all(feature = "defmt-v1", not(feature = "std"))))] 44 - macro_rules! info { 45 - // info!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log") 46 - // info!(target: "my_target", "a {} event", "log") 47 - (target: $target:expr, $($arg:tt)+) => ({ 48 - log::info!(logger: $crate::logging::log_v0_4::internal::geil(), target: $target, $($arg)+) 49 - }); 50 - 51 - // info!("a {} event", "log") 52 - ($($arg:tt)+) => (log::info!(logger: $crate::logging::log_v0_4::internal::geil(), $($arg)+)) 53 - } 54 - 55 - /// Wrapper macro for log::trace that uses the internal ergot logger. 56 - #[clippy::format_args] 57 - #[cfg(not(all(feature = "defmt-v1", not(feature = "std"))))] 58 - macro_rules! trace { 59 - // trace!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log") 60 - // trace!(target: "my_target", "a {} event", "log") 61 - (target: $target:expr, $($arg:tt)+) => ({ 62 - log::trace!(logger: $crate::logging::log_v0_4::internal::geil(), target: $target, $($arg)+) 63 - }); 64 - 65 - // trace!("a {} event", "log") 66 - ($($arg:tt)+) => (log::trace!(logger: $crate::logging::log_v0_4::internal::geil(), $($arg)+)) 67 - } 68 - 69 - /// Wrapper macro for log::warn that uses the internal ergot logger. 70 - #[clippy::format_args] 71 - #[cfg(not(all(feature = "defmt-v1", not(feature = "std"))))] 72 - macro_rules! warni { 73 - // warn!(target: "my_target", key1 = 42, key2 = true; "a {} event", "log") 74 - // warn!(target: "my_target", "a {} event", "log") 75 - (target: $target:expr, $($arg:tt)+) => ({ 76 - log::warn!(logger: $crate::logging::log_v0_4::internal::geil(), target: $target, $($arg)+) 77 - }); 78 - 79 - // warn!("a {} event", "log") 80 - ($($arg:tt)+) => (log::warn!(logger: $crate::logging::log_v0_4::internal::geil(), $($arg)+)) 81 - } 82 - 83 - #[allow(unused_imports)] 84 - #[cfg(not(all(feature = "defmt-v1", not(feature = "std"))))] 85 - pub(crate) use {debug, error, info, trace, warni as warn};
··· 1 pub mod fmtlog; 2 pub mod log_v0_4;
+36 -76
crates/ergot/src/net_stack/inner.rs
··· 1 use core::{any::TypeId, ptr::NonNull}; 2 3 use cordyceps::List; 4 use serde::Serialize; 5 - 6 - use crate::logging::{debug, error, trace}; 7 8 use crate::{ 9 FrameKind, Header, HeaderSeq, ProtocolError, ··· 66 smgr: SendProfile, 67 ) -> Result<(), NetStackSendError> 68 where 69 - SendSockets: FnMut(NonNull<SocketHeader>) -> Result<(), NetStackSendError>, 70 - SendProfile: FnOnce() -> Result<(), InterfaceSendError>, 71 { 72 - trace!("{}: Sending msg broadcast", hdr); 73 let res_lcl = { 74 let bcast_iter = Self::find_all_local(sockets, hdr)?; 75 let mut any_found = false; 76 for dst in bcast_iter { 77 let res = sskt(dst); 78 - match res { 79 - Ok(_) => { 80 - debug!("{}: delivered broadcast message locally", hdr); 81 - any_found |= true; 82 - } 83 - Err(NetStackSendError::InterfaceSend(InterfaceSendError::RoutingLoop)) => { 84 - debug!("{}: No local interest in msg broadcast", hdr); 85 - // no need to report /errors/ on routing loops 86 - continue; 87 - } 88 - Err(e) => { 89 - error!( 90 - "{}: failed to deliver broadcast message locally, error: {:?}", 91 - hdr, e 92 - ); 93 - } 94 } 95 } 96 any_found 97 }; 98 99 - let res_rmt = match smgr() { 100 - Ok(_) => { 101 - debug!("{}: delivered broadcast message remotely", hdr); 102 - true 103 - } 104 - Err(InterfaceSendError::RoutingLoop) => { 105 - // no need to report /errors/ on routing loops 106 - debug!("{}: No external interest in msg broadcast", hdr); 107 - true 108 - } 109 - Err(e) => { 110 - error!( 111 - "{}: failed to deliver broadcast message remotely, error: {:?}", 112 - hdr, e 113 - ); 114 - false 115 - } 116 - }; 117 118 if res_lcl || res_rmt { 119 Ok(()) ··· 136 SendSockets: FnOnce(NonNull<SocketHeader>) -> Result<(), NetStackSendError>, 137 SendProfile: FnOnce() -> Result<(), InterfaceSendError>, 138 { 139 - trace!("{}: Sending msg unicast", hdr); 140 // Can we assume the destination is local? 141 let local_bypass = hdr.src.net_node_any() && hdr.dst.net_node_any(); 142 143 let res = if !local_bypass { 144 // Not local: offer to the interface manager to send 145 - debug!("{}: Offering msg externally unicast", hdr); 146 smgr() 147 } else { 148 // just skip to local sending ··· 151 152 match res { 153 Ok(()) => { 154 - debug!("{}: Externally routed msg unicast", hdr); 155 return Ok(()); 156 } 157 // "Destination Local" and "Routing Loop" can both be returned when there is no 158 // interface interest, but are non-fatal. 159 Err(InterfaceSendError::DestinationLocal) | Err(InterfaceSendError::RoutingLoop) => { 160 - debug!("{}: No external interest in msg unicast", hdr); 161 } 162 Err(e) => return Err(NetStackSendError::InterfaceSend(e)), 163 } 164 165 // It was a destination local error, try to honor that 166 let socket = if hdr.dst.port_id == 0 { 167 - debug!("{}: Sending ANY unicast msg locally", hdr); 168 Self::find_any_local(sockets, hdr) 169 } else { 170 - debug!("{}: Sending ONE unicast msg locally", hdr); 171 Self::find_one_local(sockets, hdr) 172 }?; 173 ··· 188 SendSockets: FnOnce(NonNull<SocketHeader>) -> Result<(), NetStackSendError>, 189 SendProfile: FnOnce() -> Result<(), InterfaceSendError>, 190 { 191 - trace!("{}: Sending err unicast", hdr); 192 // Can we assume the destination is local? 193 let local_bypass = hdr.src.net_node_any() && hdr.dst.net_node_any(); 194 195 let res = if !local_bypass { 196 // Not local: offer to the interface manager to send 197 - debug!("{}: Offering err externally unicast", hdr); 198 smgr() 199 } else { 200 // just skip to local sending ··· 203 204 match res { 205 Ok(()) => { 206 - debug!("{}: Externally routed err unicast", hdr); 207 return Ok(()); 208 } 209 Err(InterfaceSendError::DestinationLocal) => { 210 - debug!("{}: No external interest in err unicast", hdr); 211 } 212 Err(e) => return Err(NetStackSendError::InterfaceSend(e)), 213 } ··· 231 profile: manager, 232 .. 233 } = self; 234 - trace!("{}: Sending msg raw from {:?}", hdr, source); 235 236 if hdr.kind == FrameKind::PROTOCOL_ERROR { 237 - todo!("{}: Don't do that", hdr); 238 } 239 240 let nshdr: Header = hdr.clone().into(); ··· 244 Self::broadcast( 245 sockets, 246 &nshdr, 247 - |skt| Self::send_raw_to_socket(skt, body, &nshdr, seq_no), 248 - || manager.send_raw(hdr, body, source), 249 ) 250 } else { 251 Self::unicast( ··· 255 || manager.send_raw(hdr, body, source), 256 ) 257 } 258 - .inspect_err(|e| { 259 - error!("{}: Error sending raw: {:?}", hdr, e); 260 - }) 261 } 262 263 /// Handle sending of a typed message ··· 272 profile: manager, 273 .. 274 } = self; 275 - trace!("{}: Sending msg ty", hdr); 276 277 if hdr.kind == FrameKind::PROTOCOL_ERROR { 278 - todo!("{}: Don't do that", hdr); 279 } 280 281 // Is this a broadcast message? ··· 283 Self::broadcast( 284 sockets, 285 hdr, 286 - |skt| Self::send_ty_to_socket(skt, t, hdr, seq_no), 287 - || manager.send(hdr, t), 288 ) 289 } else { 290 Self::unicast( ··· 294 || manager.send(hdr, t), 295 ) 296 } 297 - .inspect_err(|e| { 298 - error!("{}: Error sending ty: {:?}", hdr, e); 299 - }) 300 } 301 302 /// Handle sending a borrowed message ··· 311 profile: manager, 312 .. 313 } = self; 314 - trace!("{}: Sending msg bor", hdr); 315 316 if hdr.kind == FrameKind::PROTOCOL_ERROR { 317 - todo!("{}: Don't do that", hdr); 318 } 319 320 // Is this a broadcast message? ··· 322 Self::broadcast( 323 sockets, 324 hdr, 325 - |skt| Self::send_bor_to_socket(skt, t, hdr, seq_no), 326 - || manager.send(hdr, t), 327 ) 328 } else { 329 Self::unicast( ··· 333 || manager.send(hdr, t), 334 ) 335 } 336 - .inspect_err(|e| { 337 - error!("{}: Error sending bor: {:?}", hdr, e); 338 - }) 339 } 340 341 /// Handle sending of a typed message ··· 351 profile: manager, 352 .. 353 } = self; 354 - trace!("{}: Sending msg err", hdr); 355 356 if hdr.dst.port_id == 255 { 357 - todo!("{}: Don't do that", hdr); 358 } 359 360 Self::unicast_err( ··· 392 continue; 393 } 394 if skt_ref.attrs.kind != hdr.kind { 395 - return Err(NetStackSendError::WrongPortKind { 396 - expected: skt_ref.attrs.kind, 397 - actual: hdr.kind, 398 - }); 399 } 400 break skt; 401 };
··· 1 use core::{any::TypeId, ptr::NonNull}; 2 3 use cordyceps::List; 4 + use log::{debug, trace}; 5 use serde::Serialize; 6 7 use crate::{ 8 FrameKind, Header, HeaderSeq, ProtocolError, ··· 65 smgr: SendProfile, 66 ) -> Result<(), NetStackSendError> 67 where 68 + SendSockets: FnMut(NonNull<SocketHeader>) -> bool, 69 + SendProfile: FnOnce() -> bool, 70 { 71 + trace!("{hdr}: Sending msg broadcast"); 72 let res_lcl = { 73 let bcast_iter = Self::find_all_local(sockets, hdr)?; 74 let mut any_found = false; 75 for dst in bcast_iter { 76 let res = sskt(dst); 77 + if res { 78 + debug!("{hdr}: delivered broadcast message locally"); 79 } 80 + any_found |= res; 81 } 82 any_found 83 }; 84 85 + let res_rmt = smgr(); 86 + if res_rmt { 87 + debug!("{hdr}: delivered broadcast message remotely"); 88 + } 89 90 if res_lcl || res_rmt { 91 Ok(()) ··· 108 SendSockets: FnOnce(NonNull<SocketHeader>) -> Result<(), NetStackSendError>, 109 SendProfile: FnOnce() -> Result<(), InterfaceSendError>, 110 { 111 + trace!("{hdr}: Sending msg unicast"); 112 // Can we assume the destination is local? 113 let local_bypass = hdr.src.net_node_any() && hdr.dst.net_node_any(); 114 115 let res = if !local_bypass { 116 // Not local: offer to the interface manager to send 117 + debug!("{hdr}: Offering msg externally unicast"); 118 smgr() 119 } else { 120 // just skip to local sending ··· 123 124 match res { 125 Ok(()) => { 126 + debug!("{hdr}: Externally routed msg unicast"); 127 return Ok(()); 128 } 129 // "Destination Local" and "Routing Loop" can both be returned when there is no 130 // interface interest, but are non-fatal. 131 Err(InterfaceSendError::DestinationLocal) | Err(InterfaceSendError::RoutingLoop) => { 132 + debug!("{hdr}: No external interest in msg unicast"); 133 } 134 Err(e) => return Err(NetStackSendError::InterfaceSend(e)), 135 } 136 137 // It was a destination local error, try to honor that 138 let socket = if hdr.dst.port_id == 0 { 139 + debug!("{hdr}: Sending ANY unicast msg locally"); 140 Self::find_any_local(sockets, hdr) 141 } else { 142 + debug!("{hdr}: Sending ONE unicast msg locally"); 143 Self::find_one_local(sockets, hdr) 144 }?; 145 ··· 160 SendSockets: FnOnce(NonNull<SocketHeader>) -> Result<(), NetStackSendError>, 161 SendProfile: FnOnce() -> Result<(), InterfaceSendError>, 162 { 163 + trace!("{hdr}: Sending err unicast"); 164 // Can we assume the destination is local? 165 let local_bypass = hdr.src.net_node_any() && hdr.dst.net_node_any(); 166 167 let res = if !local_bypass { 168 // Not local: offer to the interface manager to send 169 + debug!("{hdr}: Offering err externally unicast"); 170 smgr() 171 } else { 172 // just skip to local sending ··· 175 176 match res { 177 Ok(()) => { 178 + debug!("{hdr}: Externally routed err unicast"); 179 return Ok(()); 180 } 181 Err(InterfaceSendError::DestinationLocal) => { 182 + debug!("{hdr}: No external interest in err unicast"); 183 } 184 Err(e) => return Err(NetStackSendError::InterfaceSend(e)), 185 } ··· 203 profile: manager, 204 .. 205 } = self; 206 + trace!("{hdr}: Sending msg raw from {source:?}"); 207 208 if hdr.kind == FrameKind::PROTOCOL_ERROR { 209 + todo!("{hdr}: Don't do that"); 210 } 211 212 let nshdr: Header = hdr.clone().into(); ··· 216 Self::broadcast( 217 sockets, 218 &nshdr, 219 + |skt| Self::send_raw_to_socket(skt, body, &nshdr, seq_no).is_ok(), 220 + || manager.send_raw(hdr, body, source).is_ok(), 221 ) 222 } else { 223 Self::unicast( ··· 227 || manager.send_raw(hdr, body, source), 228 ) 229 } 230 } 231 232 /// Handle sending of a typed message ··· 241 profile: manager, 242 .. 243 } = self; 244 + trace!("{hdr}: Sending msg ty"); 245 246 if hdr.kind == FrameKind::PROTOCOL_ERROR { 247 + todo!("{hdr}: Don't do that"); 248 } 249 250 // Is this a broadcast message? ··· 252 Self::broadcast( 253 sockets, 254 hdr, 255 + |skt| Self::send_ty_to_socket(skt, t, hdr, seq_no).is_ok(), 256 + || manager.send(hdr, t).is_ok(), 257 ) 258 } else { 259 Self::unicast( ··· 263 || manager.send(hdr, t), 264 ) 265 } 266 } 267 268 /// Handle sending a borrowed message ··· 277 profile: manager, 278 .. 279 } = self; 280 + trace!("{hdr}: Sending msg bor"); 281 282 if hdr.kind == FrameKind::PROTOCOL_ERROR { 283 + todo!("{hdr}: Don't do that"); 284 } 285 286 // Is this a broadcast message? ··· 288 Self::broadcast( 289 sockets, 290 hdr, 291 + |skt| Self::send_bor_to_socket(skt, t, hdr, seq_no).is_ok(), 292 + || manager.send(hdr, t).is_ok(), 293 ) 294 } else { 295 Self::unicast( ··· 299 || manager.send(hdr, t), 300 ) 301 } 302 } 303 304 /// Handle sending of a typed message ··· 314 profile: manager, 315 .. 316 } = self; 317 + trace!("{hdr}: Sending msg err"); 318 319 if hdr.dst.port_id == 255 { 320 + todo!("{hdr}: Don't do that"); 321 } 322 323 Self::unicast_err( ··· 355 continue; 356 } 357 if skt_ref.attrs.kind != hdr.kind { 358 + return Err(NetStackSendError::WrongPortKind); 359 } 360 break skt; 361 };
+3 -9
crates/ergot/src/net_stack/mod.rs
··· 27 use topics::Topics; 28 29 use crate::{ 30 - FrameKind, Header, HeaderSeq, ProtocolError, 31 fmtlog::{ErgotFmtTx, Level}, 32 interface_manager::{self, InterfaceSendError, Profile}, 33 socket::{SocketHeader, SocketSendError}, ··· 71 InterfaceSend(InterfaceSendError), 72 NoRoute, 73 AnyPortMissingKey, 74 - /// The message and the socket don't agree on the port kind 75 - /// This can happen if you send a message to the wrong port as a result of using hard-coded 76 - /// port numbers or as a result of a device restarting and having different port allocations. 77 - WrongPortKind { 78 - expected: FrameKind, 79 - actual: FrameKind, 80 - }, 81 AnyPortNotUnique, 82 AllPortMissingKey, 83 WouldDeadlock, ··· 424 } 425 NetStackSendError::NoRoute => ProtocolError::NSSE_NO_ROUTE, 426 NetStackSendError::AnyPortMissingKey => ProtocolError::NSSE_ANY_PORT_MISSING_KEY, 427 - NetStackSendError::WrongPortKind { .. } => ProtocolError::NSSE_WRONG_PORT_KIND, 428 NetStackSendError::AnyPortNotUnique => ProtocolError::NSSE_ANY_PORT_NOT_UNIQUE, 429 NetStackSendError::AllPortMissingKey => ProtocolError::NSSE_ALL_PORT_MISSING_KEY, 430 NetStackSendError::WouldDeadlock => ProtocolError::NSSE_WOULD_DEADLOCK,
··· 27 use topics::Topics; 28 29 use crate::{ 30 + Header, HeaderSeq, ProtocolError, 31 fmtlog::{ErgotFmtTx, Level}, 32 interface_manager::{self, InterfaceSendError, Profile}, 33 socket::{SocketHeader, SocketSendError}, ··· 71 InterfaceSend(InterfaceSendError), 72 NoRoute, 73 AnyPortMissingKey, 74 + WrongPortKind, 75 AnyPortNotUnique, 76 AllPortMissingKey, 77 WouldDeadlock, ··· 418 } 419 NetStackSendError::NoRoute => ProtocolError::NSSE_NO_ROUTE, 420 NetStackSendError::AnyPortMissingKey => ProtocolError::NSSE_ANY_PORT_MISSING_KEY, 421 + NetStackSendError::WrongPortKind => ProtocolError::NSSE_WRONG_PORT_KIND, 422 NetStackSendError::AnyPortNotUnique => ProtocolError::NSSE_ANY_PORT_NOT_UNIQUE, 423 NetStackSendError::AllPortMissingKey => ProtocolError::NSSE_ALL_PORT_MISSING_KEY, 424 NetStackSendError::WouldDeadlock => ProtocolError::NSSE_WOULD_DEADLOCK,
-49
crates/ergot/src/socket/endpoint.rs
··· 6 use pin_project::pin_project; 7 use serde::{Serialize, de::DeserializeOwned}; 8 9 - use crate::socket::HeaderMessage; 10 use crate::{self as base, socket::Response}; 11 12 macro_rules! endpoint_server { ··· 76 self.hdl.serve(f).await 77 } 78 79 - /// Wait for an incoming packet, and respond using the given async closure 80 - pub async fn serve_full<F: AsyncFnOnce(&HeaderMessage<E::Request>) -> E::Response>( 81 - &mut self, 82 - f: F, 83 - ) -> Result<(), base::net_stack::NetStackSendError> 84 - where 85 - E::Response: Serialize + Clone + DeserializeOwned + 'static, 86 - { 87 - self.hdl.serve_full(f).await 88 - } 89 - 90 /// Wait for an incoming packet, and respond using the given blocking closure 91 pub async fn serve_blocking<F: FnOnce(&E::Request) -> E::Response>( 92 &mut self, ··· 161 /// A raw Client/Server, generic over the [`Storage`](base::socket::raw_owned::Storage) impl. 162 pub mod raw { 163 use super::*; 164 - use crate::socket::HeaderMessage; 165 use crate::{ 166 FrameKind, 167 net_stack::NetStackHandle, ··· 276 }; 277 let base::socket::HeaderMessage { hdr, t } = msg; 278 let resp = f(&t).await; 279 - 280 - // NOTE: We swap src/dst, AND we go from req -> resp (both in kind and key) 281 - let hdr: base::Header = base::Header { 282 - src: { 283 - // modify the port to match our specific port, in case the dst was port 0 284 - let mut src = hdr.dst; 285 - src.port_id = self.port(); 286 - src 287 - }, 288 - dst: hdr.src, 289 - // TODO: we never reply to an any/all, so don't include that info 290 - any_all: None, 291 - seq_no: Some(hdr.seq_no), 292 - kind: base::FrameKind::ENDPOINT_RESP, 293 - ttl: base::DEFAULT_TTL, 294 - }; 295 - self.hdl.stack().send_ty::<E::Response>(&hdr, &resp) 296 - } 297 - 298 - pub async fn serve_full<F: AsyncFnOnce(&HeaderMessage<E::Request>) -> E::Response>( 299 - &mut self, 300 - f: F, 301 - ) -> Result<(), base::net_stack::NetStackSendError> 302 - where 303 - E::Response: Serialize + Clone + DeserializeOwned + 'static, 304 - { 305 - let msg = loop { 306 - let res = self.hdl.recv().await; 307 - match res { 308 - Ok(req) => break req, 309 - // TODO: Anything with errs? If not, change vtable 310 - Err(_) => continue, 311 - } 312 - }; 313 - let resp = f(&msg).await; 314 - let base::socket::HeaderMessage { hdr, .. } = msg; 315 316 // NOTE: We swap src/dst, AND we go from req -> resp (both in kind and key) 317 let hdr: base::Header = base::Header {
··· 6 use pin_project::pin_project; 7 use serde::{Serialize, de::DeserializeOwned}; 8 9 use crate::{self as base, socket::Response}; 10 11 macro_rules! endpoint_server { ··· 75 self.hdl.serve(f).await 76 } 77 78 /// Wait for an incoming packet, and respond using the given blocking closure 79 pub async fn serve_blocking<F: FnOnce(&E::Request) -> E::Response>( 80 &mut self, ··· 149 /// A raw Client/Server, generic over the [`Storage`](base::socket::raw_owned::Storage) impl. 150 pub mod raw { 151 use super::*; 152 use crate::{ 153 FrameKind, 154 net_stack::NetStackHandle, ··· 263 }; 264 let base::socket::HeaderMessage { hdr, t } = msg; 265 let resp = f(&t).await; 266 267 // NOTE: We swap src/dst, AND we go from req -> resp (both in kind and key) 268 let hdr: base::Header = base::Header {
-1
crates/ergot/src/socket/mod.rs
··· 111 } 112 113 #[derive(Debug)] 114 - #[cfg_attr(feature = "defmt-v1", derive(defmt::Format))] 115 pub struct HeaderMessage<T> { 116 pub hdr: HeaderSeq, 117 pub t: T,
··· 111 } 112 113 #[derive(Debug)] 114 pub struct HeaderMessage<T> { 115 pub hdr: HeaderSeq, 116 pub t: T,
+2 -3
crates/ergot/src/socket/raw_owned.rs
··· 20 use cordyceps::list::Links; 21 use serde::de::DeserializeOwned; 22 23 - use super::{Attributes, HeaderMessage, Response, SocketHeader, SocketSendError, SocketVTable}; 24 - use crate::logging::trace; 25 use crate::{HeaderSeq, Key, ProtocolError, nash::NameHash, net_stack::NetStackHandle}; 26 27 #[derive(Debug, PartialEq)] 28 pub struct StorageFull; ··· 302 let mutitem: &mut StoreBox<S, Response<T>> = unsafe { &mut *this.inner.get() }; 303 304 if mutitem.sto.is_full() { 305 - trace!("{}: recv_raw: StorageFull", hdr); 306 return Err(SocketSendError::NoSpace); 307 } 308
··· 20 use cordyceps::list::Links; 21 use serde::de::DeserializeOwned; 22 23 use crate::{HeaderSeq, Key, ProtocolError, nash::NameHash, net_stack::NetStackHandle}; 24 + 25 + use super::{Attributes, HeaderMessage, Response, SocketHeader, SocketSendError, SocketVTable}; 26 27 #[derive(Debug, PartialEq)] 28 pub struct StorageFull; ··· 302 let mutitem: &mut StoreBox<S, Response<T>> = unsafe { &mut *this.inner.get() }; 303 304 if mutitem.sto.is_full() { 305 return Err(SocketSendError::NoSpace); 306 } 307
-111
crates/ergot/src/toolkits/mod.rs
··· 98 } 99 } 100 101 - #[cfg(feature = "embassy-net-v0_7")] 102 - pub mod embassy_net_v0_7 { 103 - use crate::NetStack; 104 - use crate::interface_manager::InterfaceState; 105 - use crate::interface_manager::interface_impls::embassy_net_udp::EmbassyNetInterface; 106 - use crate::interface_manager::profiles::direct_edge::DirectEdge; 107 - use crate::interface_manager::utils::framed_stream::Sink; 108 - use bbq2::prod_cons::framed::FramedProducer; 109 - use bbq2::queue::BBQueue; 110 - use bbq2::traits::bbqhdl::BbqHandle; 111 - use bbq2::traits::notifier::maitake::MaiNotSpsc; 112 - use bbq2::traits::storage::Inline; 113 - use maitake_sync::blocking::{ConstInit, ScopedRawMutex}; 114 - 115 - pub type Queue<const N: usize, C> = BBQueue<Inline<N>, C, MaiNotSpsc>; 116 - 117 - pub type EdgeStack<Q, R> = NetStack<R, DirectEdge<EmbassyNetInterface<Q>>>; 118 - 119 - pub const fn new_target_stack<Q, R>(producer: FramedProducer<Q>, mtu: u16) -> EdgeStack<Q, R> 120 - where 121 - Q: BbqHandle, 122 - R: ScopedRawMutex + ConstInit + 'static, 123 - { 124 - NetStack::new_with_profile(DirectEdge::new_target(Sink::new(producer, mtu))) 125 - } 126 - 127 - pub const fn new_controller_stack<Q, R>( 128 - producer: FramedProducer<Q>, 129 - mtu: u16, 130 - ) -> EdgeStack<Q, R> 131 - where 132 - Q: BbqHandle, 133 - R: ScopedRawMutex + ConstInit + 'static, 134 - { 135 - NetStack::new_with_profile(DirectEdge::new_controller( 136 - Sink::new(producer, mtu), 137 - InterfaceState::Down, 138 - )) 139 - } 140 - } 141 - 142 #[cfg(feature = "tokio-std")] 143 pub mod tokio_tcp { 144 use crate::interface_manager::{ ··· 188 queue.clone(), 189 mtu, 190 ))) 191 - } 192 - } 193 - 194 - #[cfg(feature = "tokio-std")] 195 - pub mod tokio_udp { 196 - use crate::interface_manager::profiles::direct_edge::tokio_udp::InterfaceKind; 197 - use crate::interface_manager::profiles::direct_router; 198 - use crate::interface_manager::profiles::direct_router::DirectRouter; 199 - use crate::interface_manager::profiles::direct_router::tokio_udp::Error; 200 - use crate::interface_manager::utils::framed_stream; 201 - pub use crate::interface_manager::utils::std::new_std_queue; 202 - use crate::interface_manager::{ 203 - InterfaceState, 204 - interface_impls::tokio_udp::TokioUdpInterface, 205 - profiles::direct_edge::{self, DirectEdge, tokio_udp::SocketAlreadyActive}, 206 - utils::std::StdQueue, 207 - }; 208 - use mutex::raw_impls::cs::CriticalSectionRawMutex; 209 - use tokio::net::UdpSocket; 210 - 211 - use crate::net_stack::ArcNetStack; 212 - 213 - pub type RouterStack = ArcNetStack<CriticalSectionRawMutex, DirectRouter<TokioUdpInterface>>; 214 - pub type EdgeStack = ArcNetStack<CriticalSectionRawMutex, DirectEdge<TokioUdpInterface>>; 215 - 216 - pub async fn register_router_interface( 217 - stack: &RouterStack, 218 - socket: UdpSocket, 219 - max_ergot_packet_size: u16, 220 - outgoing_buffer_size: usize, 221 - ) -> Result<u64, Error> { 222 - direct_router::tokio_udp::register_interface( 223 - stack.clone(), 224 - socket, 225 - max_ergot_packet_size, 226 - outgoing_buffer_size, 227 - ) 228 - .await 229 - } 230 - 231 - pub async fn register_edge_interface( 232 - stack: &EdgeStack, 233 - socket: UdpSocket, 234 - queue: &StdQueue, 235 - interface_kind: InterfaceKind, 236 - ) -> Result<(), SocketAlreadyActive> { 237 - direct_edge::tokio_udp::register_interface( 238 - stack.clone(), 239 - socket, 240 - queue.clone(), 241 - interface_kind, 242 - (), 243 - ) 244 - .await 245 - } 246 - 247 - pub fn new_target_stack(queue: &StdQueue, mtu: u16) -> crate::toolkits::tokio_udp::EdgeStack { 248 - crate::toolkits::tokio_udp::EdgeStack::new_with_profile(DirectEdge::new_target( 249 - framed_stream::Sink::new_from_handle(queue.clone(), mtu), 250 - )) 251 - } 252 - 253 - pub fn new_controller_stack( 254 - queue: &StdQueue, 255 - mtu: u16, 256 - ) -> crate::toolkits::tokio_udp::EdgeStack { 257 - crate::toolkits::tokio_udp::EdgeStack::new_with_profile(DirectEdge::new_controller( 258 - framed_stream::Sink::new_from_handle(queue.clone(), mtu), 259 - InterfaceState::Down, 260 - )) 261 } 262 } 263
··· 98 } 99 } 100 101 #[cfg(feature = "tokio-std")] 102 pub mod tokio_tcp { 103 use crate::interface_manager::{ ··· 147 queue.clone(), 148 mtu, 149 ))) 150 } 151 } 152
+1 -1
crates/ergot/src/wire_frames.rs
··· 1 - use crate::logging::warn; 2 use postcard::{Serializer, ser_flavors}; 3 use serde::{Deserialize, Serialize}; 4
··· 1 + use log::warn; 2 use postcard::{Serializer, ser_flavors}; 3 use serde::{Deserialize, Serialize}; 4
+5 -5
crates/ergot/tests/log_fmt.rs
··· 30 let x = 10; 31 let msg = "world"; 32 33 - STACK.trace_fmt(fmt!("1 hello ({}), {}", x, msg)); 34 - STACK.debug_fmt(fmt!("2 hello ({}), {}", x, msg)); 35 - STACK.info_fmt(fmt!("3 hello ({}), {}", x, msg)); 36 - STACK.warn_fmt(fmt!("4 hello ({}), {}", x, msg)); 37 - STACK.error_fmt(fmt!("5 hello ({}), {}", x, msg)); 38 39 let levels = &[ 40 Level::Trace,
··· 30 let x = 10; 31 let msg = "world"; 32 33 + STACK.trace_fmt(fmt!("1 hello ({x}), {}", msg)); 34 + STACK.debug_fmt(fmt!("2 hello ({x}), {}", msg)); 35 + STACK.info_fmt(fmt!("3 hello ({x}), {}", msg)); 36 + STACK.warn_fmt(fmt!("4 hello ({x}), {}", msg)); 37 + STACK.error_fmt(fmt!("5 hello ({x}), {}", msg)); 38 39 let levels = &[ 40 Level::Trace,
+4 -4
crates/ergot/tests/smoke2.rs
··· 220 .await 221 .unwrap(); 222 223 - println!("RESP: {:?}", resp); 224 } 225 }); 226 ··· 234 }), 235 ) 236 .await; 237 - println!("SERV: {:?}", srv); 238 } 239 240 reqqr.await.unwrap(); ··· 273 .await 274 .unwrap(); 275 276 - println!("RESP: {:?}", resp); 277 } 278 }); 279 ··· 287 }), 288 ) 289 .await; 290 - println!("SERV: {:?}", srv); 291 } 292 293 reqqr.await.unwrap();
··· 220 .await 221 .unwrap(); 222 223 + println!("RESP: {resp:?}"); 224 } 225 }); 226 ··· 234 }), 235 ) 236 .await; 237 + println!("SERV: {srv:?}"); 238 } 239 240 reqqr.await.unwrap(); ··· 273 .await 274 .unwrap(); 275 276 + println!("RESP: {resp:?}"); 277 } 278 }); 279 ··· 287 }), 288 ) 289 .await; 290 + println!("SERV: {srv:?}"); 291 } 292 293 reqqr.await.unwrap();
+4 -5
demos/esp32c3/Cargo.lock
··· 404 405 [[package]] 406 name = "embassy-time-driver" 407 - version = "0.2.1" 408 source = "registry+https://github.com/rust-lang/crates.io-index" 409 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 410 dependencies = [ 411 "document-features", 412 ] ··· 522 523 [[package]] 524 name = "ergot" 525 - version = "0.12.0" 526 dependencies = [ 527 "bbq2", 528 "cobs 0.3.0", ··· 531 "cordyceps", 532 "critical-section", 533 "defmt 1.0.1", 534 - "embassy-futures", 535 "embedded-io-async", 536 "heapless 0.9.1", 537 "log", 538 "maitake-sync", 539 "mutex", 540 "pin-project", 541 - "portable-atomic", 542 "postcard", 543 "postcard-schema", 544 "serde",
··· 404 405 [[package]] 406 name = "embassy-time-driver" 407 + version = "0.2.0" 408 source = "registry+https://github.com/rust-lang/crates.io-index" 409 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 410 dependencies = [ 411 "document-features", 412 ] ··· 522 523 [[package]] 524 name = "ergot" 525 + version = "0.10.0" 526 dependencies = [ 527 "bbq2", 528 "cobs 0.3.0", ··· 531 "cordyceps", 532 "critical-section", 533 "defmt 1.0.1", 534 + "embassy-time", 535 "embedded-io-async", 536 "heapless 0.9.1", 537 "log", 538 "maitake-sync", 539 "mutex", 540 "pin-project", 541 "postcard", 542 "postcard-schema", 543 "serde",
+2 -2
demos/esp32c3/esp32c3-serial/src/main.rs
··· 52 53 // Create our USB-Serial interface, which implements the embedded-io-async traits 54 let (rx, tx) = UsbSerialJtag::new(p.USB_DEVICE).into_async().split(); 55 - let rx = RxWorker::new_target(&STACK, rx, ()); 56 57 // Spawn I/O worker tasks 58 spawner.must_spawn(run_rx(rx, RECV_BUF.take(), SCRATCH_BUF.take())); ··· 86 let mut ct = 0; 87 loop { 88 tckr.next().await; 89 - STACK.info_fmt(fmt!("log # {}", ct)); 90 ct += 1; 91 } 92 }
··· 52 53 // Create our USB-Serial interface, which implements the embedded-io-async traits 54 let (rx, tx) = UsbSerialJtag::new(p.USB_DEVICE).into_async().split(); 55 + let rx = RxWorker::new(&STACK, rx, ()); 56 57 // Spawn I/O worker tasks 58 spawner.must_spawn(run_rx(rx, RECV_BUF.take(), SCRATCH_BUF.take())); ··· 86 let mut ct = 0; 87 loop { 88 tckr.next().await; 89 + STACK.info_fmt(fmt!("log # {ct}")); 90 ct += 1; 91 } 92 }
+4 -3
demos/esp32c6/Cargo.lock
··· 403 404 [[package]] 405 name = "embassy-time-driver" 406 - version = "0.2.1" 407 source = "registry+https://github.com/rust-lang/crates.io-index" 408 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 409 dependencies = [ 410 "document-features", 411 ] ··· 521 522 [[package]] 523 name = "ergot" 524 - version = "0.12.0" 525 dependencies = [ 526 "bbq2", 527 "cobs 0.3.0", ··· 531 "critical-section", 532 "defmt 1.0.1", 533 "embassy-futures", 534 "embedded-io-async", 535 "heapless 0.9.1", 536 "log",
··· 403 404 [[package]] 405 name = "embassy-time-driver" 406 + version = "0.2.0" 407 source = "registry+https://github.com/rust-lang/crates.io-index" 408 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 409 dependencies = [ 410 "document-features", 411 ] ··· 521 522 [[package]] 523 name = "ergot" 524 + version = "0.11.0" 525 dependencies = [ 526 "bbq2", 527 "cobs 0.3.0", ··· 531 "critical-section", 532 "defmt 1.0.1", 533 "embassy-futures", 534 + "embassy-time", 535 "embedded-io-async", 536 "heapless 0.9.1", 537 "log",
+1 -1
demos/esp32c6/esp32c6-serial/src/main.rs
··· 88 let mut ct = 0; 89 loop { 90 tckr.next().await; 91 - log::info!("log # {}", ct); 92 ct += 1; 93 } 94 }
··· 88 let mut ct = 0; 89 loop { 90 tckr.next().await; 91 + log::info!("log # {ct}"); 92 ct += 1; 93 } 94 }
+98 -41
demos/microbit/Cargo.lock
··· 245 246 [[package]] 247 name = "defmt" 248 version = "1.0.1" 249 source = "registry+https://github.com/rust-lang/crates.io-index" 250 checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" ··· 282 checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" 283 dependencies = [ 284 "critical-section", 285 - "defmt", 286 ] 287 288 [[package]] ··· 296 297 [[package]] 298 name = "embassy-embedded-hal" 299 - version = "0.5.0" 300 source = "registry+https://github.com/rust-lang/crates.io-index" 301 - checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 302 dependencies = [ 303 - "defmt", 304 "embassy-futures", 305 - "embassy-hal-internal", 306 - "embassy-sync", 307 "embassy-time", 308 "embedded-hal 0.2.7", 309 "embedded-hal 1.0.0", ··· 314 ] 315 316 [[package]] 317 name = "embassy-executor" 318 - version = "0.9.1" 319 source = "registry+https://github.com/rust-lang/crates.io-index" 320 - checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 321 dependencies = [ 322 "cortex-m", 323 "critical-section", 324 - "defmt", 325 "document-features", 326 "embassy-executor-macros", 327 - "embassy-executor-timer-queue", 328 ] 329 330 [[package]] 331 name = "embassy-executor-macros" 332 - version = "0.7.0" 333 source = "registry+https://github.com/rust-lang/crates.io-index" 334 - checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" 335 dependencies = [ 336 "darling", 337 "proc-macro2", ··· 340 ] 341 342 [[package]] 343 - name = "embassy-executor-timer-queue" 344 - version = "0.1.0" 345 - source = "registry+https://github.com/rust-lang/crates.io-index" 346 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 347 - 348 - [[package]] 349 name = "embassy-futures" 350 version = "0.1.2" 351 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 359 dependencies = [ 360 "cortex-m", 361 "critical-section", 362 - "defmt", 363 "num-traits", 364 ] 365 ··· 377 dependencies = [ 378 "embassy-futures", 379 "embassy-net-driver", 380 - "embassy-sync", 381 ] 382 383 [[package]] 384 name = "embassy-nrf" 385 - version = "0.8.0" 386 source = "registry+https://github.com/rust-lang/crates.io-index" 387 - checksum = "a8d63429d74ab5786cde7c9dc9a0338ea162a4da95e204ac5345c5ae36831fdb" 388 dependencies = [ 389 "bitflags 2.9.4", 390 "cfg-if", 391 "cortex-m", 392 "cortex-m-rt", 393 "critical-section", 394 - "defmt", 395 "document-features", 396 - "embassy-embedded-hal", 397 "embassy-hal-internal", 398 - "embassy-sync", 399 "embassy-time", 400 "embassy-time-driver", 401 "embassy-time-queue-utils", ··· 415 416 [[package]] 417 name = "embassy-sync" 418 version = "0.7.2" 419 source = "registry+https://github.com/rust-lang/crates.io-index" 420 checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 421 dependencies = [ 422 "cfg-if", 423 "critical-section", 424 - "defmt", 425 "embedded-io-async", 426 "futures-core", 427 "futures-sink", ··· 430 431 [[package]] 432 name = "embassy-time" 433 - version = "0.5.0" 434 source = "registry+https://github.com/rust-lang/crates.io-index" 435 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 436 dependencies = [ 437 "cfg-if", 438 "critical-section", 439 - "defmt", 440 "document-features", 441 "embassy-time-driver", 442 "embedded-hal 0.2.7", 443 "embedded-hal 1.0.0", 444 "embedded-hal-async", 445 - "futures-core", 446 ] 447 448 [[package]] ··· 456 457 [[package]] 458 name = "embassy-time-queue-utils" 459 - version = "0.3.0" 460 source = "registry+https://github.com/rust-lang/crates.io-index" 461 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 462 dependencies = [ 463 - "embassy-executor-timer-queue", 464 "heapless 0.8.0", 465 ] 466 ··· 472 dependencies = [ 473 "embassy-futures", 474 "embassy-net-driver-channel", 475 - "embassy-sync", 476 "embassy-usb-driver", 477 "embedded-io-async", 478 "heapless 0.8.0", ··· 486 source = "registry+https://github.com/rust-lang/crates.io-index" 487 checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" 488 dependencies = [ 489 - "defmt", 490 "embedded-io-async", 491 ] 492 ··· 553 554 [[package]] 555 name = "ergot" 556 - version = "0.12.0" 557 dependencies = [ 558 "bbq2", 559 "cobs 0.3.0", ··· 561 "const-fnv1a-hash", 562 "cordyceps", 563 "critical-section", 564 - "defmt", 565 "embassy-futures", 566 "embassy-time", 567 "embassy-usb", ··· 614 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 615 616 [[package]] 617 name = "generator" 618 version = "0.8.7" 619 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 694 source = "registry+https://github.com/rust-lang/crates.io-index" 695 checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 696 dependencies = [ 697 - "defmt", 698 "hash32 0.3.1", 699 "serde", 700 "stable_deref_trait", ··· 790 "bbq2", 791 "cortex-m", 792 "cortex-m-rt", 793 - "defmt", 794 "defmt-rtt", 795 "embassy-executor", 796 "embassy-nrf", 797 - "embassy-sync", 798 "embassy-time", 799 "embassy-usb", 800 "ergot", ··· 881 checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" 882 dependencies = [ 883 "cortex-m", 884 - "defmt", 885 ] 886 887 [[package]] ··· 909 version = "0.2.16" 910 source = "registry+https://github.com/rust-lang/crates.io-index" 911 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 912 913 [[package]] 914 name = "portable-atomic"
··· 245 246 [[package]] 247 name = "defmt" 248 + version = "0.3.100" 249 + source = "registry+https://github.com/rust-lang/crates.io-index" 250 + checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" 251 + dependencies = [ 252 + "defmt 1.0.1", 253 + ] 254 + 255 + [[package]] 256 + name = "defmt" 257 version = "1.0.1" 258 source = "registry+https://github.com/rust-lang/crates.io-index" 259 checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" ··· 291 checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" 292 dependencies = [ 293 "critical-section", 294 + "defmt 1.0.1", 295 ] 296 297 [[package]] ··· 305 306 [[package]] 307 name = "embassy-embedded-hal" 308 + version = "0.3.2" 309 source = "registry+https://github.com/rust-lang/crates.io-index" 310 + checksum = "8c62a3bf127e03832fb97d8b01a058775e617653bc89e2a12c256485a7fb54c1" 311 dependencies = [ 312 + "defmt 0.3.100", 313 + "embassy-embedded-hal 0.4.0", 314 "embassy-futures", 315 + "embassy-sync 0.6.2", 316 "embassy-time", 317 "embedded-hal 0.2.7", 318 "embedded-hal 1.0.0", ··· 323 ] 324 325 [[package]] 326 + name = "embassy-embedded-hal" 327 + version = "0.4.0" 328 + source = "registry+https://github.com/rust-lang/crates.io-index" 329 + checksum = "d1611b7a7ab5d1fbed84c338df26d56fd9bded58006ebb029075112ed2c5e039" 330 + dependencies = [ 331 + "embassy-futures", 332 + "embassy-hal-internal", 333 + "embassy-sync 0.7.2", 334 + "embedded-hal 0.2.7", 335 + "embedded-hal 1.0.0", 336 + "embedded-hal-async", 337 + "embedded-storage", 338 + "embedded-storage-async", 339 + "nb 1.1.0", 340 + ] 341 + 342 + [[package]] 343 name = "embassy-executor" 344 + version = "0.7.0" 345 source = "registry+https://github.com/rust-lang/crates.io-index" 346 + checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" 347 dependencies = [ 348 "cortex-m", 349 "critical-section", 350 + "defmt 0.3.100", 351 "document-features", 352 "embassy-executor-macros", 353 ] 354 355 [[package]] 356 name = "embassy-executor-macros" 357 + version = "0.6.2" 358 source = "registry+https://github.com/rust-lang/crates.io-index" 359 + checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" 360 dependencies = [ 361 "darling", 362 "proc-macro2", ··· 365 ] 366 367 [[package]] 368 name = "embassy-futures" 369 version = "0.1.2" 370 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 378 dependencies = [ 379 "cortex-m", 380 "critical-section", 381 + "defmt 1.0.1", 382 "num-traits", 383 ] 384 ··· 396 dependencies = [ 397 "embassy-futures", 398 "embassy-net-driver", 399 + "embassy-sync 0.7.2", 400 ] 401 402 [[package]] 403 name = "embassy-nrf" 404 + version = "0.5.0" 405 source = "registry+https://github.com/rust-lang/crates.io-index" 406 + checksum = "6ae20388606f23184ab567537b9c7758eef5ac20cf5f94db3d936a641b9f4b9e" 407 dependencies = [ 408 "bitflags 2.9.4", 409 "cfg-if", 410 "cortex-m", 411 "cortex-m-rt", 412 "critical-section", 413 + "defmt 1.0.1", 414 "document-features", 415 + "embassy-embedded-hal 0.3.2", 416 "embassy-hal-internal", 417 + "embassy-sync 0.7.2", 418 "embassy-time", 419 "embassy-time-driver", 420 "embassy-time-queue-utils", ··· 434 435 [[package]] 436 name = "embassy-sync" 437 + version = "0.6.2" 438 + source = "registry+https://github.com/rust-lang/crates.io-index" 439 + checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" 440 + dependencies = [ 441 + "cfg-if", 442 + "critical-section", 443 + "embedded-io-async", 444 + "futures-sink", 445 + "futures-util", 446 + "heapless 0.8.0", 447 + ] 448 + 449 + [[package]] 450 + name = "embassy-sync" 451 version = "0.7.2" 452 source = "registry+https://github.com/rust-lang/crates.io-index" 453 checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 454 dependencies = [ 455 "cfg-if", 456 "critical-section", 457 + "defmt 1.0.1", 458 "embedded-io-async", 459 "futures-core", 460 "futures-sink", ··· 463 464 [[package]] 465 name = "embassy-time" 466 + version = "0.4.0" 467 source = "registry+https://github.com/rust-lang/crates.io-index" 468 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 469 dependencies = [ 470 "cfg-if", 471 "critical-section", 472 + "defmt 0.3.100", 473 "document-features", 474 "embassy-time-driver", 475 "embedded-hal 0.2.7", 476 "embedded-hal 1.0.0", 477 "embedded-hal-async", 478 + "futures-util", 479 ] 480 481 [[package]] ··· 489 490 [[package]] 491 name = "embassy-time-queue-utils" 492 + version = "0.1.0" 493 source = "registry+https://github.com/rust-lang/crates.io-index" 494 + checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" 495 dependencies = [ 496 + "embassy-executor", 497 "heapless 0.8.0", 498 ] 499 ··· 505 dependencies = [ 506 "embassy-futures", 507 "embassy-net-driver-channel", 508 + "embassy-sync 0.7.2", 509 "embassy-usb-driver", 510 "embedded-io-async", 511 "heapless 0.8.0", ··· 519 source = "registry+https://github.com/rust-lang/crates.io-index" 520 checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" 521 dependencies = [ 522 + "defmt 1.0.1", 523 "embedded-io-async", 524 ] 525 ··· 586 587 [[package]] 588 name = "ergot" 589 + version = "0.11.0" 590 dependencies = [ 591 "bbq2", 592 "cobs 0.3.0", ··· 594 "const-fnv1a-hash", 595 "cordyceps", 596 "critical-section", 597 + "defmt 1.0.1", 598 "embassy-futures", 599 "embassy-time", 600 "embassy-usb", ··· 647 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 648 649 [[package]] 650 + name = "futures-task" 651 + version = "0.3.31" 652 + source = "registry+https://github.com/rust-lang/crates.io-index" 653 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 654 + 655 + [[package]] 656 + name = "futures-util" 657 + version = "0.3.31" 658 + source = "registry+https://github.com/rust-lang/crates.io-index" 659 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 660 + dependencies = [ 661 + "futures-core", 662 + "futures-task", 663 + "pin-project-lite", 664 + "pin-utils", 665 + ] 666 + 667 + [[package]] 668 name = "generator" 669 version = "0.8.7" 670 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 745 source = "registry+https://github.com/rust-lang/crates.io-index" 746 checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 747 dependencies = [ 748 + "defmt 1.0.1", 749 "hash32 0.3.1", 750 "serde", 751 "stable_deref_trait", ··· 841 "bbq2", 842 "cortex-m", 843 "cortex-m-rt", 844 + "defmt 1.0.1", 845 "defmt-rtt", 846 "embassy-executor", 847 "embassy-nrf", 848 + "embassy-sync 0.7.2", 849 "embassy-time", 850 "embassy-usb", 851 "ergot", ··· 932 checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" 933 dependencies = [ 934 "cortex-m", 935 + "defmt 1.0.1", 936 ] 937 938 [[package]] ··· 960 version = "0.2.16" 961 source = "registry+https://github.com/rust-lang/crates.io-index" 962 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 963 + 964 + [[package]] 965 + name = "pin-utils" 966 + version = "0.1.0" 967 + source = "registry+https://github.com/rust-lang/crates.io-index" 968 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 969 970 [[package]] 971 name = "portable-atomic"
+3 -3
demos/microbit/Cargo.toml
··· 9 10 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 11 cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-single-core"] } 12 - embassy-executor = { version = "0.9.1", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 13 - embassy-nrf = { version = "0.8.0", features = ["defmt", "nrf52833", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 14 - embassy-time = { version = "0.5.0", features = ["defmt", "defmt-timestamp-uptime"] } 15 mutex = { version = "1.0.2", features = ["impl-unsafe-cortex-m-single-core"] } 16 panic-probe = { version = "1.0.0", features = ["print-defmt"] } 17
··· 9 10 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 11 cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-single-core"] } 12 + embassy-executor = { version = "0.7.0", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 13 + embassy-nrf = { version = "0.5.0", features = ["defmt", "nrf52833", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 14 + embassy-time = { version = "0.4.0", features = ["defmt", "defmt-timestamp-uptime"] } 15 mutex = { version = "1.0.2", features = ["impl-unsafe-cortex-m-single-core"] } 16 panic-probe = { version = "1.0.0", features = ["print-defmt"] } 17
+68 -42
demos/nrf52840/Cargo.lock
··· 244 245 [[package]] 246 name = "defmt" 247 version = "1.0.1" 248 source = "registry+https://github.com/rust-lang/crates.io-index" 249 checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" ··· 281 checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" 282 dependencies = [ 283 "critical-section", 284 - "defmt", 285 ] 286 287 [[package]] ··· 295 296 [[package]] 297 name = "embassy-embedded-hal" 298 - version = "0.5.0" 299 source = "registry+https://github.com/rust-lang/crates.io-index" 300 - checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 301 dependencies = [ 302 - "defmt", 303 "embassy-futures", 304 "embassy-hal-internal", 305 "embassy-sync", ··· 314 315 [[package]] 316 name = "embassy-executor" 317 - version = "0.9.1" 318 source = "registry+https://github.com/rust-lang/crates.io-index" 319 - checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 320 dependencies = [ 321 "cortex-m", 322 "critical-section", 323 - "defmt", 324 "document-features", 325 "embassy-executor-macros", 326 - "embassy-executor-timer-queue", 327 ] 328 329 [[package]] 330 name = "embassy-executor-macros" 331 - version = "0.7.0" 332 source = "registry+https://github.com/rust-lang/crates.io-index" 333 - checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" 334 dependencies = [ 335 "darling", 336 "proc-macro2", ··· 339 ] 340 341 [[package]] 342 - name = "embassy-executor-timer-queue" 343 - version = "0.1.0" 344 - source = "registry+https://github.com/rust-lang/crates.io-index" 345 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 346 - 347 - [[package]] 348 name = "embassy-futures" 349 - version = "0.1.2" 350 source = "registry+https://github.com/rust-lang/crates.io-index" 351 - checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 352 353 [[package]] 354 name = "embassy-hal-internal" ··· 358 dependencies = [ 359 "cortex-m", 360 "critical-section", 361 - "defmt", 362 "num-traits", 363 ] 364 ··· 381 382 [[package]] 383 name = "embassy-nrf" 384 - version = "0.8.0" 385 source = "registry+https://github.com/rust-lang/crates.io-index" 386 - checksum = "a8d63429d74ab5786cde7c9dc9a0338ea162a4da95e204ac5345c5ae36831fdb" 387 dependencies = [ 388 "bitflags 2.9.1", 389 "cfg-if", 390 "cortex-m", 391 "cortex-m-rt", 392 "critical-section", 393 - "defmt", 394 "document-features", 395 "embassy-embedded-hal", 396 "embassy-hal-internal", ··· 414 415 [[package]] 416 name = "embassy-sync" 417 - version = "0.7.2" 418 source = "registry+https://github.com/rust-lang/crates.io-index" 419 - checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 420 dependencies = [ 421 "cfg-if", 422 "critical-section", 423 - "defmt", 424 "embedded-io-async", 425 - "futures-core", 426 "futures-sink", 427 "heapless 0.8.0", 428 ] 429 430 [[package]] 431 name = "embassy-time" 432 - version = "0.5.0" 433 source = "registry+https://github.com/rust-lang/crates.io-index" 434 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 435 dependencies = [ 436 "cfg-if", 437 "critical-section", 438 - "defmt", 439 "document-features", 440 "embassy-time-driver", 441 "embedded-hal 0.2.7", 442 "embedded-hal 1.0.0", 443 "embedded-hal-async", 444 - "futures-core", 445 ] 446 447 [[package]] 448 name = "embassy-time-driver" 449 - version = "0.2.1" 450 source = "registry+https://github.com/rust-lang/crates.io-index" 451 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 452 dependencies = [ 453 "document-features", 454 ] 455 456 [[package]] 457 name = "embassy-time-queue-utils" 458 - version = "0.3.0" 459 source = "registry+https://github.com/rust-lang/crates.io-index" 460 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 461 dependencies = [ 462 - "embassy-executor-timer-queue", 463 "heapless 0.8.0", 464 ] 465 ··· 485 source = "registry+https://github.com/rust-lang/crates.io-index" 486 checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" 487 dependencies = [ 488 - "defmt", 489 "embedded-io-async", 490 ] 491 ··· 552 553 [[package]] 554 name = "ergot" 555 - version = "0.12.0" 556 dependencies = [ 557 "bbq2", 558 "cobs 0.3.0", ··· 560 "const-fnv1a-hash", 561 "cordyceps", 562 "critical-section", 563 - "defmt", 564 "embassy-futures", 565 "embassy-time", 566 "embassy-usb", ··· 607 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 608 609 [[package]] 610 name = "generator" 611 version = "0.8.5" 612 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 687 source = "registry+https://github.com/rust-lang/crates.io-index" 688 checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 689 dependencies = [ 690 - "defmt", 691 "hash32 0.3.1", 692 "serde", 693 "stable_deref_trait", ··· 830 "bbq2", 831 "cortex-m", 832 "cortex-m-rt", 833 - "defmt", 834 "defmt-rtt", 835 "embassy-executor", 836 "embassy-nrf", ··· 849 dependencies = [ 850 "cortex-m", 851 "cortex-m-rt", 852 - "defmt", 853 "defmt-rtt", 854 "embassy-executor", 855 "embassy-nrf", ··· 897 checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" 898 dependencies = [ 899 "cortex-m", 900 - "defmt", 901 ] 902 903 [[package]] ··· 925 version = "0.2.16" 926 source = "registry+https://github.com/rust-lang/crates.io-index" 927 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 928 929 [[package]] 930 name = "portable-atomic"
··· 244 245 [[package]] 246 name = "defmt" 247 + version = "0.3.100" 248 + source = "registry+https://github.com/rust-lang/crates.io-index" 249 + checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" 250 + dependencies = [ 251 + "defmt 1.0.1", 252 + ] 253 + 254 + [[package]] 255 + name = "defmt" 256 version = "1.0.1" 257 source = "registry+https://github.com/rust-lang/crates.io-index" 258 checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" ··· 290 checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" 291 dependencies = [ 292 "critical-section", 293 + "defmt 1.0.1", 294 ] 295 296 [[package]] ··· 304 305 [[package]] 306 name = "embassy-embedded-hal" 307 + version = "0.3.1" 308 source = "registry+https://github.com/rust-lang/crates.io-index" 309 + checksum = "8578db196d74db92efdd5ebc546736dac1685499ee245b22eff92fa5e4b57945" 310 dependencies = [ 311 + "defmt 1.0.1", 312 "embassy-futures", 313 "embassy-hal-internal", 314 "embassy-sync", ··· 323 324 [[package]] 325 name = "embassy-executor" 326 + version = "0.7.0" 327 source = "registry+https://github.com/rust-lang/crates.io-index" 328 + checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" 329 dependencies = [ 330 "cortex-m", 331 "critical-section", 332 + "defmt 0.3.100", 333 "document-features", 334 "embassy-executor-macros", 335 ] 336 337 [[package]] 338 name = "embassy-executor-macros" 339 + version = "0.6.2" 340 source = "registry+https://github.com/rust-lang/crates.io-index" 341 + checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" 342 dependencies = [ 343 "darling", 344 "proc-macro2", ··· 347 ] 348 349 [[package]] 350 name = "embassy-futures" 351 + version = "0.1.1" 352 source = "registry+https://github.com/rust-lang/crates.io-index" 353 + checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" 354 355 [[package]] 356 name = "embassy-hal-internal" ··· 360 dependencies = [ 361 "cortex-m", 362 "critical-section", 363 + "defmt 1.0.1", 364 "num-traits", 365 ] 366 ··· 383 384 [[package]] 385 name = "embassy-nrf" 386 + version = "0.5.0" 387 source = "registry+https://github.com/rust-lang/crates.io-index" 388 + checksum = "6ae20388606f23184ab567537b9c7758eef5ac20cf5f94db3d936a641b9f4b9e" 389 dependencies = [ 390 "bitflags 2.9.1", 391 "cfg-if", 392 "cortex-m", 393 "cortex-m-rt", 394 "critical-section", 395 + "defmt 1.0.1", 396 "document-features", 397 "embassy-embedded-hal", 398 "embassy-hal-internal", ··· 416 417 [[package]] 418 name = "embassy-sync" 419 + version = "0.7.0" 420 source = "registry+https://github.com/rust-lang/crates.io-index" 421 + checksum = "cef1a8a1ea892f9b656de0295532ac5d8067e9830d49ec75076291fd6066b136" 422 dependencies = [ 423 "cfg-if", 424 "critical-section", 425 + "defmt 1.0.1", 426 "embedded-io-async", 427 "futures-sink", 428 + "futures-util", 429 "heapless 0.8.0", 430 ] 431 432 [[package]] 433 name = "embassy-time" 434 + version = "0.4.0" 435 source = "registry+https://github.com/rust-lang/crates.io-index" 436 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 437 dependencies = [ 438 "cfg-if", 439 "critical-section", 440 + "defmt 0.3.100", 441 "document-features", 442 "embassy-time-driver", 443 "embedded-hal 0.2.7", 444 "embedded-hal 1.0.0", 445 "embedded-hal-async", 446 + "futures-util", 447 ] 448 449 [[package]] 450 name = "embassy-time-driver" 451 + version = "0.2.0" 452 source = "registry+https://github.com/rust-lang/crates.io-index" 453 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 454 dependencies = [ 455 "document-features", 456 ] 457 458 [[package]] 459 name = "embassy-time-queue-utils" 460 + version = "0.1.0" 461 source = "registry+https://github.com/rust-lang/crates.io-index" 462 + checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" 463 dependencies = [ 464 + "embassy-executor", 465 "heapless 0.8.0", 466 ] 467 ··· 487 source = "registry+https://github.com/rust-lang/crates.io-index" 488 checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" 489 dependencies = [ 490 + "defmt 1.0.1", 491 "embedded-io-async", 492 ] 493 ··· 554 555 [[package]] 556 name = "ergot" 557 + version = "0.11.0" 558 dependencies = [ 559 "bbq2", 560 "cobs 0.3.0", ··· 562 "const-fnv1a-hash", 563 "cordyceps", 564 "critical-section", 565 + "defmt 1.0.1", 566 "embassy-futures", 567 "embassy-time", 568 "embassy-usb", ··· 609 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 610 611 [[package]] 612 + name = "futures-task" 613 + version = "0.3.31" 614 + source = "registry+https://github.com/rust-lang/crates.io-index" 615 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 616 + 617 + [[package]] 618 + name = "futures-util" 619 + version = "0.3.31" 620 + source = "registry+https://github.com/rust-lang/crates.io-index" 621 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 622 + dependencies = [ 623 + "futures-core", 624 + "futures-task", 625 + "pin-project-lite", 626 + "pin-utils", 627 + ] 628 + 629 + [[package]] 630 name = "generator" 631 version = "0.8.5" 632 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 707 source = "registry+https://github.com/rust-lang/crates.io-index" 708 checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 709 dependencies = [ 710 + "defmt 1.0.1", 711 "hash32 0.3.1", 712 "serde", 713 "stable_deref_trait", ··· 850 "bbq2", 851 "cortex-m", 852 "cortex-m-rt", 853 + "defmt 1.0.1", 854 "defmt-rtt", 855 "embassy-executor", 856 "embassy-nrf", ··· 869 dependencies = [ 870 "cortex-m", 871 "cortex-m-rt", 872 + "defmt 1.0.1", 873 "defmt-rtt", 874 "embassy-executor", 875 "embassy-nrf", ··· 917 checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" 918 dependencies = [ 919 "cortex-m", 920 + "defmt 1.0.1", 921 ] 922 923 [[package]] ··· 945 version = "0.2.16" 946 source = "registry+https://github.com/rust-lang/crates.io-index" 947 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 948 + 949 + [[package]] 950 + name = "pin-utils" 951 + version = "0.1.0" 952 + source = "registry+https://github.com/rust-lang/crates.io-index" 953 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 954 955 [[package]] 956 name = "portable-atomic"
+3 -3
demos/nrf52840/Cargo.toml
··· 10 11 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 12 cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-single-core"] } 13 - embassy-executor = { version = "0.9.1", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 14 - embassy-nrf = { version = "0.8.0", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 15 - embassy-time = { version = "0.5.0", features = ["defmt", "defmt-timestamp-uptime"] } 16 mutex = { version = "1.0.2", features = ["impl-unsafe-cortex-m-single-core"] } 17 panic-probe = { version = "1.0.0", features = ["print-defmt"] } 18
··· 10 11 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 12 cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-single-core"] } 13 + embassy-executor = { version = "0.7.0", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 14 + embassy-nrf = { version = "0.5.0", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac", "time"] } 15 + embassy-time = { version = "0.4.0", features = ["defmt", "defmt-timestamp-uptime"] } 16 mutex = { version = "1.0.2", features = ["impl-unsafe-cortex-m-single-core"] } 17 panic-probe = { version = "1.0.0", features = ["print-defmt"] } 18
+1 -1
demos/nrf52840/nrf52840-eusb/src/main.rs
··· 32 const MAX_PACKET_SIZE: usize = 1024; 33 34 // Our nrf52840-specific USB driver 35 - type AppDriver = usb::Driver<'static, HardwareVbusDetect>; 36 // The type of our RX Worker 37 type RxWorker = kit::RxWorker<&'static Queue, ThreadModeRawMutex, AppDriver>; 38 // The type of our netstack
··· 32 const MAX_PACKET_SIZE: usize = 1024; 33 34 // Our nrf52840-specific USB driver 35 + type AppDriver = usb::Driver<'static, USBD, HardwareVbusDetect>; 36 // The type of our RX Worker 37 type RxWorker = kit::RxWorker<&'static Queue, ThreadModeRawMutex, AppDriver>; 38 // The type of our netstack
+49 -31
demos/rp2040/Cargo.lock
··· 402 403 [[package]] 404 name = "embassy-embedded-hal" 405 - version = "0.5.0" 406 source = "registry+https://github.com/rust-lang/crates.io-index" 407 - checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 408 dependencies = [ 409 "embassy-futures", 410 "embassy-hal-internal", 411 "embassy-sync", 412 "embedded-hal 0.2.7", 413 "embedded-hal 1.0.0", 414 "embedded-hal-async", ··· 419 420 [[package]] 421 name = "embassy-executor" 422 - version = "0.9.1" 423 source = "registry+https://github.com/rust-lang/crates.io-index" 424 - checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 425 dependencies = [ 426 "cortex-m", 427 "critical-section", 428 - "defmt 1.0.1", 429 "document-features", 430 "embassy-executor-macros", 431 - "embassy-executor-timer-queue", 432 ] 433 434 [[package]] 435 name = "embassy-executor-macros" 436 - version = "0.7.0" 437 source = "registry+https://github.com/rust-lang/crates.io-index" 438 - checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" 439 dependencies = [ 440 "darling", 441 "proc-macro2", ··· 444 ] 445 446 [[package]] 447 - name = "embassy-executor-timer-queue" 448 - version = "0.1.0" 449 - source = "registry+https://github.com/rust-lang/crates.io-index" 450 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 451 - 452 - [[package]] 453 name = "embassy-futures" 454 - version = "0.1.2" 455 source = "registry+https://github.com/rust-lang/crates.io-index" 456 - checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 457 458 [[package]] 459 name = "embassy-hal-internal" ··· 486 487 [[package]] 488 name = "embassy-rp" 489 - version = "0.8.0" 490 source = "registry+https://github.com/rust-lang/crates.io-index" 491 - checksum = "1a284935af0a869de3fa14af74b5f932389dd66d7048012f1083b06f38d05399" 492 dependencies = [ 493 "atomic-polyfill", 494 "cfg-if", ··· 526 527 [[package]] 528 name = "embassy-sync" 529 - version = "0.7.2" 530 source = "registry+https://github.com/rust-lang/crates.io-index" 531 - checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 532 dependencies = [ 533 "cfg-if", 534 "critical-section", 535 "embedded-io-async", 536 - "futures-core", 537 "futures-sink", 538 "heapless 0.8.0", 539 ] 540 541 [[package]] 542 name = "embassy-time" 543 - version = "0.5.0" 544 source = "registry+https://github.com/rust-lang/crates.io-index" 545 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 546 dependencies = [ 547 "cfg-if", 548 "critical-section", 549 - "defmt 1.0.1", 550 "document-features", 551 "embassy-time-driver", 552 "embedded-hal 0.2.7", 553 "embedded-hal 1.0.0", 554 "embedded-hal-async", 555 - "futures-core", 556 ] 557 558 [[package]] 559 name = "embassy-time-driver" 560 - version = "0.2.1" 561 source = "registry+https://github.com/rust-lang/crates.io-index" 562 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 563 dependencies = [ 564 "document-features", 565 ] 566 567 [[package]] 568 name = "embassy-time-queue-utils" 569 - version = "0.3.0" 570 source = "registry+https://github.com/rust-lang/crates.io-index" 571 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 572 dependencies = [ 573 - "embassy-executor-timer-queue", 574 "heapless 0.8.0", 575 ] 576 ··· 688 689 [[package]] 690 name = "ergot" 691 - version = "0.12.0" 692 dependencies = [ 693 "bbq2", 694 "cobs 0.3.0", ··· 747 version = "0.3.31" 748 source = "registry+https://github.com/rust-lang/crates.io-index" 749 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 750 751 [[package]] 752 name = "generator" ··· 1178 version = "0.2.16" 1179 source = "registry+https://github.com/rust-lang/crates.io-index" 1180 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 1181 1182 [[package]] 1183 name = "pio"
··· 402 403 [[package]] 404 name = "embassy-embedded-hal" 405 + version = "0.3.1" 406 source = "registry+https://github.com/rust-lang/crates.io-index" 407 + checksum = "8578db196d74db92efdd5ebc546736dac1685499ee245b22eff92fa5e4b57945" 408 dependencies = [ 409 "embassy-futures", 410 "embassy-hal-internal", 411 "embassy-sync", 412 + "embassy-time", 413 "embedded-hal 0.2.7", 414 "embedded-hal 1.0.0", 415 "embedded-hal-async", ··· 420 421 [[package]] 422 name = "embassy-executor" 423 + version = "0.7.0" 424 source = "registry+https://github.com/rust-lang/crates.io-index" 425 + checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" 426 dependencies = [ 427 "cortex-m", 428 "critical-section", 429 + "defmt 0.3.100", 430 "document-features", 431 "embassy-executor-macros", 432 ] 433 434 [[package]] 435 name = "embassy-executor-macros" 436 + version = "0.6.2" 437 source = "registry+https://github.com/rust-lang/crates.io-index" 438 + checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" 439 dependencies = [ 440 "darling", 441 "proc-macro2", ··· 444 ] 445 446 [[package]] 447 name = "embassy-futures" 448 + version = "0.1.1" 449 source = "registry+https://github.com/rust-lang/crates.io-index" 450 + checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" 451 452 [[package]] 453 name = "embassy-hal-internal" ··· 480 481 [[package]] 482 name = "embassy-rp" 483 + version = "0.6.0" 484 source = "registry+https://github.com/rust-lang/crates.io-index" 485 + checksum = "d298ea0ae8797fbbc835d7ef321b1762916879b9df49695826f54d31c487f5de" 486 dependencies = [ 487 "atomic-polyfill", 488 "cfg-if", ··· 520 521 [[package]] 522 name = "embassy-sync" 523 + version = "0.7.0" 524 source = "registry+https://github.com/rust-lang/crates.io-index" 525 + checksum = "cef1a8a1ea892f9b656de0295532ac5d8067e9830d49ec75076291fd6066b136" 526 dependencies = [ 527 "cfg-if", 528 "critical-section", 529 "embedded-io-async", 530 "futures-sink", 531 + "futures-util", 532 "heapless 0.8.0", 533 ] 534 535 [[package]] 536 name = "embassy-time" 537 + version = "0.4.0" 538 source = "registry+https://github.com/rust-lang/crates.io-index" 539 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 540 dependencies = [ 541 "cfg-if", 542 "critical-section", 543 + "defmt 0.3.100", 544 "document-features", 545 "embassy-time-driver", 546 "embedded-hal 0.2.7", 547 "embedded-hal 1.0.0", 548 "embedded-hal-async", 549 + "futures-util", 550 ] 551 552 [[package]] 553 name = "embassy-time-driver" 554 + version = "0.2.0" 555 source = "registry+https://github.com/rust-lang/crates.io-index" 556 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 557 dependencies = [ 558 "document-features", 559 ] 560 561 [[package]] 562 name = "embassy-time-queue-utils" 563 + version = "0.1.0" 564 source = "registry+https://github.com/rust-lang/crates.io-index" 565 + checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" 566 dependencies = [ 567 + "embassy-executor", 568 "heapless 0.8.0", 569 ] 570 ··· 682 683 [[package]] 684 name = "ergot" 685 + version = "0.11.0" 686 dependencies = [ 687 "bbq2", 688 "cobs 0.3.0", ··· 741 version = "0.3.31" 742 source = "registry+https://github.com/rust-lang/crates.io-index" 743 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 744 + 745 + [[package]] 746 + name = "futures-task" 747 + version = "0.3.31" 748 + source = "registry+https://github.com/rust-lang/crates.io-index" 749 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 750 + 751 + [[package]] 752 + name = "futures-util" 753 + version = "0.3.31" 754 + source = "registry+https://github.com/rust-lang/crates.io-index" 755 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 756 + dependencies = [ 757 + "futures-core", 758 + "futures-task", 759 + "pin-project-lite", 760 + "pin-utils", 761 + ] 762 763 [[package]] 764 name = "generator" ··· 1190 version = "0.2.16" 1191 source = "registry+https://github.com/rust-lang/crates.io-index" 1192 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 1193 + 1194 + [[package]] 1195 + name = "pin-utils" 1196 + version = "0.1.0" 1197 + source = "registry+https://github.com/rust-lang/crates.io-index" 1198 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1199 1200 [[package]] 1201 name = "pio"
+4 -4
demos/rp2040/Cargo.toml
··· 9 [workspace.dependencies] 10 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 11 cortex-m = { version = "0.7.6", features = ["inline-asm"] } 12 - embassy-executor = { version = "0.9.1", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 13 - embassy-rp = { version = "0.8.0", features = ["rp2040", "defmt", "unstable-pac", "time-driver", "critical-section-impl"] } 14 - embassy-time = { version = "0.5.0", features = ["defmt", "defmt-timestamp-uptime"] } 15 ergot = { path = "../../crates/ergot", features = ["embassy-usb-v0_5"] } 16 maitake-sync = { version = "0.2.2", default-features = false } 17 panic-probe = { version = "0.3", features = ["print-defmt"] } 18 portable-atomic = { version = "1.6.0", features = ["critical-section"] } 19 serde = { version = "1.0", default-features = false, features = ["derive"] } 20 - embassy-futures = "0.1.2" 21 cortex-m-rt = "0.7.5" 22 defmt = "1.0.1" 23 defmt-rtt = "1.0.0"
··· 9 [workspace.dependencies] 10 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 11 cortex-m = { version = "0.7.6", features = ["inline-asm"] } 12 + embassy-executor = { version = "0.7.0", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 13 + embassy-rp = { version = "0.6.0", features = ["rp2040", "defmt", "unstable-pac", "time-driver", "critical-section-impl"] } 14 + embassy-time = { version = "0.4.0", features = ["defmt", "defmt-timestamp-uptime"] } 15 ergot = { path = "../../crates/ergot", features = ["embassy-usb-v0_5"] } 16 maitake-sync = { version = "0.2.2", default-features = false } 17 panic-probe = { version = "0.3", features = ["print-defmt"] } 18 portable-atomic = { version = "1.6.0", features = ["critical-section"] } 19 serde = { version = "1.0", default-features = false, features = ["derive"] } 20 + embassy-futures = "0.1.1" 21 cortex-m-rt = "0.7.5" 22 defmt = "1.0.1" 23 defmt-rtt = "1.0.0"
+49 -31
demos/rp2350/Cargo.lock
··· 402 403 [[package]] 404 name = "embassy-embedded-hal" 405 - version = "0.5.0" 406 source = "registry+https://github.com/rust-lang/crates.io-index" 407 - checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 408 dependencies = [ 409 "embassy-futures", 410 "embassy-hal-internal", 411 "embassy-sync", 412 "embedded-hal 0.2.7", 413 "embedded-hal 1.0.0", 414 "embedded-hal-async", ··· 419 420 [[package]] 421 name = "embassy-executor" 422 - version = "0.9.1" 423 source = "registry+https://github.com/rust-lang/crates.io-index" 424 - checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 425 dependencies = [ 426 "cortex-m", 427 "critical-section", 428 - "defmt 1.0.1", 429 "document-features", 430 "embassy-executor-macros", 431 - "embassy-executor-timer-queue", 432 ] 433 434 [[package]] 435 name = "embassy-executor-macros" 436 - version = "0.7.0" 437 source = "registry+https://github.com/rust-lang/crates.io-index" 438 - checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" 439 dependencies = [ 440 "darling", 441 "proc-macro2", ··· 444 ] 445 446 [[package]] 447 - name = "embassy-executor-timer-queue" 448 - version = "0.1.0" 449 - source = "registry+https://github.com/rust-lang/crates.io-index" 450 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 451 - 452 - [[package]] 453 name = "embassy-futures" 454 - version = "0.1.2" 455 source = "registry+https://github.com/rust-lang/crates.io-index" 456 - checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 457 458 [[package]] 459 name = "embassy-hal-internal" ··· 486 487 [[package]] 488 name = "embassy-rp" 489 - version = "0.8.0" 490 source = "registry+https://github.com/rust-lang/crates.io-index" 491 - checksum = "1a284935af0a869de3fa14af74b5f932389dd66d7048012f1083b06f38d05399" 492 dependencies = [ 493 "atomic-polyfill", 494 "cfg-if", ··· 526 527 [[package]] 528 name = "embassy-sync" 529 - version = "0.7.2" 530 source = "registry+https://github.com/rust-lang/crates.io-index" 531 - checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 532 dependencies = [ 533 "cfg-if", 534 "critical-section", 535 "embedded-io-async", 536 - "futures-core", 537 "futures-sink", 538 "heapless 0.8.0", 539 ] 540 541 [[package]] 542 name = "embassy-time" 543 - version = "0.5.0" 544 source = "registry+https://github.com/rust-lang/crates.io-index" 545 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 546 dependencies = [ 547 "cfg-if", 548 "critical-section", 549 - "defmt 1.0.1", 550 "document-features", 551 "embassy-time-driver", 552 "embedded-hal 0.2.7", 553 "embedded-hal 1.0.0", 554 "embedded-hal-async", 555 - "futures-core", 556 ] 557 558 [[package]] 559 name = "embassy-time-driver" 560 - version = "0.2.1" 561 source = "registry+https://github.com/rust-lang/crates.io-index" 562 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 563 dependencies = [ 564 "document-features", 565 ] 566 567 [[package]] 568 name = "embassy-time-queue-utils" 569 - version = "0.3.0" 570 source = "registry+https://github.com/rust-lang/crates.io-index" 571 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 572 dependencies = [ 573 - "embassy-executor-timer-queue", 574 "heapless 0.8.0", 575 ] 576 ··· 699 700 [[package]] 701 name = "ergot" 702 - version = "0.12.0" 703 dependencies = [ 704 "bbq2", 705 "cobs 0.3.0", ··· 758 version = "0.3.31" 759 source = "registry+https://github.com/rust-lang/crates.io-index" 760 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 761 762 [[package]] 763 name = "generator" ··· 1189 version = "0.2.16" 1190 source = "registry+https://github.com/rust-lang/crates.io-index" 1191 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 1192 1193 [[package]] 1194 name = "pio"
··· 402 403 [[package]] 404 name = "embassy-embedded-hal" 405 + version = "0.3.1" 406 source = "registry+https://github.com/rust-lang/crates.io-index" 407 + checksum = "8578db196d74db92efdd5ebc546736dac1685499ee245b22eff92fa5e4b57945" 408 dependencies = [ 409 "embassy-futures", 410 "embassy-hal-internal", 411 "embassy-sync", 412 + "embassy-time", 413 "embedded-hal 0.2.7", 414 "embedded-hal 1.0.0", 415 "embedded-hal-async", ··· 420 421 [[package]] 422 name = "embassy-executor" 423 + version = "0.7.0" 424 source = "registry+https://github.com/rust-lang/crates.io-index" 425 + checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" 426 dependencies = [ 427 "cortex-m", 428 "critical-section", 429 + "defmt 0.3.100", 430 "document-features", 431 "embassy-executor-macros", 432 ] 433 434 [[package]] 435 name = "embassy-executor-macros" 436 + version = "0.6.2" 437 source = "registry+https://github.com/rust-lang/crates.io-index" 438 + checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" 439 dependencies = [ 440 "darling", 441 "proc-macro2", ··· 444 ] 445 446 [[package]] 447 name = "embassy-futures" 448 + version = "0.1.1" 449 source = "registry+https://github.com/rust-lang/crates.io-index" 450 + checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" 451 452 [[package]] 453 name = "embassy-hal-internal" ··· 480 481 [[package]] 482 name = "embassy-rp" 483 + version = "0.6.0" 484 source = "registry+https://github.com/rust-lang/crates.io-index" 485 + checksum = "d298ea0ae8797fbbc835d7ef321b1762916879b9df49695826f54d31c487f5de" 486 dependencies = [ 487 "atomic-polyfill", 488 "cfg-if", ··· 520 521 [[package]] 522 name = "embassy-sync" 523 + version = "0.7.0" 524 source = "registry+https://github.com/rust-lang/crates.io-index" 525 + checksum = "cef1a8a1ea892f9b656de0295532ac5d8067e9830d49ec75076291fd6066b136" 526 dependencies = [ 527 "cfg-if", 528 "critical-section", 529 "embedded-io-async", 530 "futures-sink", 531 + "futures-util", 532 "heapless 0.8.0", 533 ] 534 535 [[package]] 536 name = "embassy-time" 537 + version = "0.4.0" 538 source = "registry+https://github.com/rust-lang/crates.io-index" 539 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 540 dependencies = [ 541 "cfg-if", 542 "critical-section", 543 + "defmt 0.3.100", 544 "document-features", 545 "embassy-time-driver", 546 "embedded-hal 0.2.7", 547 "embedded-hal 1.0.0", 548 "embedded-hal-async", 549 + "futures-util", 550 ] 551 552 [[package]] 553 name = "embassy-time-driver" 554 + version = "0.2.0" 555 source = "registry+https://github.com/rust-lang/crates.io-index" 556 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 557 dependencies = [ 558 "document-features", 559 ] 560 561 [[package]] 562 name = "embassy-time-queue-utils" 563 + version = "0.1.0" 564 source = "registry+https://github.com/rust-lang/crates.io-index" 565 + checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" 566 dependencies = [ 567 + "embassy-executor", 568 "heapless 0.8.0", 569 ] 570 ··· 693 694 [[package]] 695 name = "ergot" 696 + version = "0.11.0" 697 dependencies = [ 698 "bbq2", 699 "cobs 0.3.0", ··· 752 version = "0.3.31" 753 source = "registry+https://github.com/rust-lang/crates.io-index" 754 checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 755 + 756 + [[package]] 757 + name = "futures-task" 758 + version = "0.3.31" 759 + source = "registry+https://github.com/rust-lang/crates.io-index" 760 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 761 + 762 + [[package]] 763 + name = "futures-util" 764 + version = "0.3.31" 765 + source = "registry+https://github.com/rust-lang/crates.io-index" 766 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 767 + dependencies = [ 768 + "futures-core", 769 + "futures-task", 770 + "pin-project-lite", 771 + "pin-utils", 772 + ] 773 774 [[package]] 775 name = "generator" ··· 1201 version = "0.2.16" 1202 source = "registry+https://github.com/rust-lang/crates.io-index" 1203 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 1204 + 1205 + [[package]] 1206 + name = "pin-utils" 1207 + version = "0.1.0" 1208 + source = "registry+https://github.com/rust-lang/crates.io-index" 1209 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1210 1211 [[package]] 1212 name = "pio"
+4 -4
demos/rp2350/Cargo.toml
··· 9 [workspace.dependencies] 10 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 11 cortex-m = { version = "0.7.6", features = ["inline-asm"] } 12 - embassy-executor = { version = "0.9.1", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 13 - embassy-rp = { version = "0.8.0", features = ["rp235xa", "defmt", "unstable-pac", "time-driver", "critical-section-impl"] } 14 - embassy-time = { version = "0.5.0", features = ["defmt", "defmt-timestamp-uptime"] } 15 ergot = { path = "../../crates/ergot", features = ["embassy-usb-v0_5"] } 16 maitake-sync = { version = "0.2.2", default-features = false } 17 panic-probe = { version = "0.3", features = ["print-defmt"] } ··· 20 embedded-hal-bus = { version = "0.3.0", features = ["async"] } 21 embedded-hal = "1.0.0" 22 embedded-hal-async = "1.0.0" 23 - embassy-futures = "0.1.2" 24 cortex-m-rt = "0.7.5" 25 defmt = "1.0.1" 26 defmt-rtt = "1.0.0"
··· 9 [workspace.dependencies] 10 bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 11 cortex-m = { version = "0.7.6", features = ["inline-asm"] } 12 + embassy-executor = { version = "0.7.0", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 13 + embassy-rp = { version = "0.6.0", features = ["rp235xa", "defmt", "unstable-pac", "time-driver", "critical-section-impl"] } 14 + embassy-time = { version = "0.4.0", features = ["defmt", "defmt-timestamp-uptime"] } 15 ergot = { path = "../../crates/ergot", features = ["embassy-usb-v0_5"] } 16 maitake-sync = { version = "0.2.2", default-features = false } 17 panic-probe = { version = "0.3", features = ["print-defmt"] } ··· 20 embedded-hal-bus = { version = "0.3.0", features = ["async"] } 21 embedded-hal = "1.0.0" 22 embedded-hal-async = "1.0.0" 23 + embassy-futures = "0.1.1" 24 cortex-m-rt = "0.7.5" 25 defmt = "1.0.1" 26 defmt-rtt = "1.0.0"
+2 -2
demos/rp2350/rp2350-tilt/src/lsm6ds3tr.rs
··· 176 let res = self.read8(regs::WHO_AM_I); 177 match res { 178 Ok(g) => { 179 - STACK.info_fmt(fmt!("Ok: {:02X}", g)); 180 break; 181 } 182 Err(_e) => { ··· 234 ]; 235 236 for (addr, val) in steps.iter().copied() { 237 - STACK.info_fmt(fmt!("Writing to addr {:02X}, value {:02X}", addr, val)); 238 self.write8(addr, val)?; 239 Timer::after_millis(10).await; 240 }
··· 176 let res = self.read8(regs::WHO_AM_I); 177 match res { 178 Ok(g) => { 179 + STACK.info_fmt(fmt!("Ok: {g:02X}")); 180 break; 181 } 182 Err(_e) => { ··· 234 ]; 235 236 for (addr, val) in steps.iter().copied() { 237 + STACK.info_fmt(fmt!("Writing to addr {addr:02X}, value {val:02X}")); 238 self.write8(addr, val)?; 239 Timer::after_millis(10).await; 240 }
+118 -1
demos/shared-icd/Cargo.lock
··· 111 checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 112 113 [[package]] 114 name = "embassy-futures" 115 version = "0.1.2" 116 source = "registry+https://github.com/rust-lang/crates.io-index" 117 checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 118 119 [[package]] 120 name = "ergot" 121 - version = "0.12.0" 122 dependencies = [ 123 "bbq2", 124 "cobs 0.3.0", ··· 127 "cordyceps", 128 "critical-section", 129 "embassy-futures", 130 "heapless 0.9.1", 131 "log", 132 "maitake-sync", ··· 136 "postcard", 137 "postcard-schema", 138 "serde", 139 ] 140 141 [[package]] ··· 208 checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" 209 210 [[package]] 211 name = "lock_api" 212 version = "0.4.13" 213 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 289 checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" 290 291 [[package]] 292 name = "nu-ansi-term" 293 version = "0.46.0" 294 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 335 version = "0.2.16" 336 source = "registry+https://github.com/rust-lang/crates.io-index" 337 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 338 339 [[package]] 340 name = "portable-atomic" ··· 647 version = "0.1.1" 648 source = "registry+https://github.com/rust-lang/crates.io-index" 649 checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" 650 651 [[package]] 652 name = "winapi"
··· 111 checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 112 113 [[package]] 114 + name = "document-features" 115 + version = "0.2.11" 116 + source = "registry+https://github.com/rust-lang/crates.io-index" 117 + checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" 118 + dependencies = [ 119 + "litrs", 120 + ] 121 + 122 + [[package]] 123 name = "embassy-futures" 124 version = "0.1.2" 125 source = "registry+https://github.com/rust-lang/crates.io-index" 126 checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 127 128 [[package]] 129 + name = "embassy-time" 130 + version = "0.4.0" 131 + source = "registry+https://github.com/rust-lang/crates.io-index" 132 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 133 + dependencies = [ 134 + "cfg-if", 135 + "critical-section", 136 + "document-features", 137 + "embassy-time-driver", 138 + "embedded-hal 0.2.7", 139 + "embedded-hal 1.0.0", 140 + "embedded-hal-async", 141 + "futures-util", 142 + ] 143 + 144 + [[package]] 145 + name = "embassy-time-driver" 146 + version = "0.2.0" 147 + source = "registry+https://github.com/rust-lang/crates.io-index" 148 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 149 + dependencies = [ 150 + "document-features", 151 + ] 152 + 153 + [[package]] 154 + name = "embedded-hal" 155 + version = "0.2.7" 156 + source = "registry+https://github.com/rust-lang/crates.io-index" 157 + checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 158 + dependencies = [ 159 + "nb 0.1.3", 160 + "void", 161 + ] 162 + 163 + [[package]] 164 + name = "embedded-hal" 165 + version = "1.0.0" 166 + source = "registry+https://github.com/rust-lang/crates.io-index" 167 + checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" 168 + 169 + [[package]] 170 + name = "embedded-hal-async" 171 + version = "1.0.0" 172 + source = "registry+https://github.com/rust-lang/crates.io-index" 173 + checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" 174 + dependencies = [ 175 + "embedded-hal 1.0.0", 176 + ] 177 + 178 + [[package]] 179 name = "ergot" 180 + version = "0.11.0" 181 dependencies = [ 182 "bbq2", 183 "cobs 0.3.0", ··· 186 "cordyceps", 187 "critical-section", 188 "embassy-futures", 189 + "embassy-time", 190 "heapless 0.9.1", 191 "log", 192 "maitake-sync", ··· 196 "postcard", 197 "postcard-schema", 198 "serde", 199 + ] 200 + 201 + [[package]] 202 + name = "futures-core" 203 + version = "0.3.31" 204 + source = "registry+https://github.com/rust-lang/crates.io-index" 205 + checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 206 + 207 + [[package]] 208 + name = "futures-task" 209 + version = "0.3.31" 210 + source = "registry+https://github.com/rust-lang/crates.io-index" 211 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 212 + 213 + [[package]] 214 + name = "futures-util" 215 + version = "0.3.31" 216 + source = "registry+https://github.com/rust-lang/crates.io-index" 217 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 218 + dependencies = [ 219 + "futures-core", 220 + "futures-task", 221 + "pin-project-lite", 222 + "pin-utils", 223 ] 224 225 [[package]] ··· 292 checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" 293 294 [[package]] 295 + name = "litrs" 296 + version = "0.4.2" 297 + source = "registry+https://github.com/rust-lang/crates.io-index" 298 + checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" 299 + 300 + [[package]] 301 name = "lock_api" 302 version = "0.4.13" 303 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 379 checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" 380 381 [[package]] 382 + name = "nb" 383 + version = "0.1.3" 384 + source = "registry+https://github.com/rust-lang/crates.io-index" 385 + checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 386 + dependencies = [ 387 + "nb 1.1.0", 388 + ] 389 + 390 + [[package]] 391 + name = "nb" 392 + version = "1.1.0" 393 + source = "registry+https://github.com/rust-lang/crates.io-index" 394 + checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 395 + 396 + [[package]] 397 name = "nu-ansi-term" 398 version = "0.46.0" 399 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 440 version = "0.2.16" 441 source = "registry+https://github.com/rust-lang/crates.io-index" 442 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 443 + 444 + [[package]] 445 + name = "pin-utils" 446 + version = "0.1.0" 447 + source = "registry+https://github.com/rust-lang/crates.io-index" 448 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 449 450 [[package]] 451 name = "portable-atomic" ··· 758 version = "0.1.1" 759 source = "registry+https://github.com/rust-lang/crates.io-index" 760 checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" 761 + 762 + [[package]] 763 + name = "void" 764 + version = "1.0.2" 765 + source = "registry+https://github.com/rust-lang/crates.io-index" 766 + checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 767 768 [[package]] 769 name = "winapi"
+87 -29
demos/std/Cargo.lock
··· 847 checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" 848 849 [[package]] 850 name = "dispatch" 851 version = "0.2.0" 852 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1046 ] 1047 1048 [[package]] 1049 - name = "embassy-executor-timer-queue" 1050 - version = "0.1.0" 1051 source = "registry+https://github.com/rust-lang/crates.io-index" 1052 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 1053 1054 [[package]] 1055 name = "embassy-futures" ··· 1059 1060 [[package]] 1061 name = "embassy-time" 1062 - version = "0.5.0" 1063 source = "registry+https://github.com/rust-lang/crates.io-index" 1064 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 1065 dependencies = [ 1066 "cfg-if", 1067 "critical-section", ··· 1071 "embedded-hal 0.2.7", 1072 "embedded-hal 1.0.0", 1073 "embedded-hal-async", 1074 - "futures-core", 1075 ] 1076 1077 [[package]] 1078 name = "embassy-time-driver" 1079 - version = "0.2.1" 1080 source = "registry+https://github.com/rust-lang/crates.io-index" 1081 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 1082 dependencies = [ 1083 "document-features", 1084 ] 1085 1086 [[package]] 1087 name = "embassy-time-queue-utils" 1088 - version = "0.3.0" 1089 source = "registry+https://github.com/rust-lang/crates.io-index" 1090 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 1091 dependencies = [ 1092 - "embassy-executor-timer-queue", 1093 "heapless 0.8.0", 1094 ] 1095 ··· 1212 1213 [[package]] 1214 name = "ergot" 1215 - version = "0.12.0" 1216 dependencies = [ 1217 "bbq2", 1218 "cobs 0.3.0", ··· 1238 ] 1239 1240 [[package]] 1241 - name = "ergot-bridge-client-tcp" 1242 version = "0.1.0" 1243 dependencies = [ 1244 "cordyceps", ··· 1250 ] 1251 1252 [[package]] 1253 - name = "ergot-bridge-pair-udp" 1254 - version = "0.1.0" 1255 - dependencies = [ 1256 - "cordyceps", 1257 - "env_logger", 1258 - "ergot", 1259 - "log", 1260 - "mutex", 1261 - "tokio", 1262 - ] 1263 - 1264 - [[package]] 1265 - name = "ergot-client-tcp" 1266 version = "0.1.0" 1267 dependencies = [ 1268 "cordyceps", ··· 1370 "crc32fast", 1371 "miniz_oxide", 1372 ] 1373 1374 [[package]] 1375 name = "foldhash" ··· 1881 ] 1882 1883 [[package]] 1884 name = "idna" 1885 version = "1.1.0" 1886 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2120 checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" 2121 2122 [[package]] 2123 - name = "log-client-tcp" 2124 version = "0.1.0" 2125 dependencies = [ 2126 "cordyceps", ··· 2132 ] 2133 2134 [[package]] 2135 - name = "log-router-serial" 2136 version = "0.1.0" 2137 dependencies = [ 2138 "cordyceps", ··· 2144 ] 2145 2146 [[package]] 2147 - name = "log-router-tcp" 2148 version = "0.1.0" 2149 dependencies = [ 2150 "cordyceps", ··· 3501 version = "0.1.1" 3502 source = "registry+https://github.com/rust-lang/crates.io-index" 3503 checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" 3504 3505 [[package]] 3506 name = "strum"
··· 847 checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" 848 849 [[package]] 850 + name = "darling" 851 + version = "0.20.11" 852 + source = "registry+https://github.com/rust-lang/crates.io-index" 853 + checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" 854 + dependencies = [ 855 + "darling_core", 856 + "darling_macro", 857 + ] 858 + 859 + [[package]] 860 + name = "darling_core" 861 + version = "0.20.11" 862 + source = "registry+https://github.com/rust-lang/crates.io-index" 863 + checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" 864 + dependencies = [ 865 + "fnv", 866 + "ident_case", 867 + "proc-macro2", 868 + "quote", 869 + "strsim", 870 + "syn", 871 + ] 872 + 873 + [[package]] 874 + name = "darling_macro" 875 + version = "0.20.11" 876 + source = "registry+https://github.com/rust-lang/crates.io-index" 877 + checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" 878 + dependencies = [ 879 + "darling_core", 880 + "quote", 881 + "syn", 882 + ] 883 + 884 + [[package]] 885 name = "dispatch" 886 version = "0.2.0" 887 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1081 ] 1082 1083 [[package]] 1084 + name = "embassy-executor" 1085 + version = "0.7.0" 1086 source = "registry+https://github.com/rust-lang/crates.io-index" 1087 + checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6" 1088 + dependencies = [ 1089 + "critical-section", 1090 + "document-features", 1091 + "embassy-executor-macros", 1092 + ] 1093 + 1094 + [[package]] 1095 + name = "embassy-executor-macros" 1096 + version = "0.6.2" 1097 + source = "registry+https://github.com/rust-lang/crates.io-index" 1098 + checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" 1099 + dependencies = [ 1100 + "darling", 1101 + "proc-macro2", 1102 + "quote", 1103 + "syn", 1104 + ] 1105 1106 [[package]] 1107 name = "embassy-futures" ··· 1111 1112 [[package]] 1113 name = "embassy-time" 1114 + version = "0.4.0" 1115 source = "registry+https://github.com/rust-lang/crates.io-index" 1116 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 1117 dependencies = [ 1118 "cfg-if", 1119 "critical-section", ··· 1123 "embedded-hal 0.2.7", 1124 "embedded-hal 1.0.0", 1125 "embedded-hal-async", 1126 + "futures-util", 1127 ] 1128 1129 [[package]] 1130 name = "embassy-time-driver" 1131 + version = "0.2.0" 1132 source = "registry+https://github.com/rust-lang/crates.io-index" 1133 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 1134 dependencies = [ 1135 "document-features", 1136 ] 1137 1138 [[package]] 1139 name = "embassy-time-queue-utils" 1140 + version = "0.1.0" 1141 source = "registry+https://github.com/rust-lang/crates.io-index" 1142 + checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83" 1143 dependencies = [ 1144 + "embassy-executor", 1145 "heapless 0.8.0", 1146 ] 1147 ··· 1264 1265 [[package]] 1266 name = "ergot" 1267 + version = "0.11.0" 1268 dependencies = [ 1269 "bbq2", 1270 "cobs 0.3.0", ··· 1290 ] 1291 1292 [[package]] 1293 + name = "ergot-bridge-client" 1294 version = "0.1.0" 1295 dependencies = [ 1296 "cordyceps", ··· 1302 ] 1303 1304 [[package]] 1305 + name = "ergot-client" 1306 version = "0.1.0" 1307 dependencies = [ 1308 "cordyceps", ··· 1410 "crc32fast", 1411 "miniz_oxide", 1412 ] 1413 + 1414 + [[package]] 1415 + name = "fnv" 1416 + version = "1.0.7" 1417 + source = "registry+https://github.com/rust-lang/crates.io-index" 1418 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 1419 1420 [[package]] 1421 name = "foldhash" ··· 1927 ] 1928 1929 [[package]] 1930 + name = "ident_case" 1931 + version = "1.0.1" 1932 + source = "registry+https://github.com/rust-lang/crates.io-index" 1933 + checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 1934 + 1935 + [[package]] 1936 name = "idna" 1937 version = "1.1.0" 1938 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2172 checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" 2173 2174 [[package]] 2175 + name = "log-client" 2176 version = "0.1.0" 2177 dependencies = [ 2178 "cordyceps", ··· 2184 ] 2185 2186 [[package]] 2187 + name = "log-router" 2188 version = "0.1.0" 2189 dependencies = [ 2190 "cordyceps", ··· 2196 ] 2197 2198 [[package]] 2199 + name = "log-router-serial" 2200 version = "0.1.0" 2201 dependencies = [ 2202 "cordyceps", ··· 3553 version = "0.1.1" 3554 source = "registry+https://github.com/rust-lang/crates.io-index" 3555 checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" 3556 + 3557 + [[package]] 3558 + name = "strsim" 3559 + version = "0.11.1" 3560 + source = "registry+https://github.com/rust-lang/crates.io-index" 3561 + checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 3562 3563 [[package]] 3564 name = "strum"
+5 -5
demos/std/Cargo.toml
··· 1 [workspace] 2 members = [ 3 - "ergot-client-tcp", 4 - "ergot-bridge-client-tcp", 5 "ergot-nusb-router", 6 "ergot-router", 7 "ergot-seed-router", 8 - "log-client-tcp", 9 - "log-router-tcp", 10 "log-router-serial", 11 "stream-plotting", 12 - "tilt-app", "ergot-bridge-pair-udp", 13 ] 14 resolver = "2" 15
··· 1 [workspace] 2 members = [ 3 + "ergot-client", 4 + "ergot-bridge-client", 5 "ergot-nusb-router", 6 "ergot-router", 7 "ergot-seed-router", 8 + "log-client", 9 + "log-router", 10 "log-router-serial", 11 "stream-plotting", 12 + "tilt-app", 13 ] 14 resolver = "2" 15
+12
demos/std/ergot-bridge-client/Cargo.toml
···
··· 1 + [package] 2 + name = "ergot-bridge-client" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + cordyceps = { workspace = true } 8 + env_logger = { workspace = true } 9 + log = { workspace = true } 10 + ergot = { workspace = true } 11 + mutex = { workspace = true } 12 + tokio = { workspace = true }
+106
demos/std/ergot-bridge-client/src/main.rs
···
··· 1 + use ergot::{ 2 + FrameKind, 3 + logging::log_v0_4::LogSink, 4 + toolkits::tokio_tcp::{EdgeStack, new_std_queue, new_target_stack, register_edge_interface}, 5 + topic, 6 + traits::Endpoint, 7 + well_known::{DeviceInfo, ErgotSeedRouterAssignmentEndpoint, NameRequirement, SocketQuery}, 8 + }; 9 + use log::{info, warn}; 10 + use tokio::{net::TcpStream, select, time::sleep}; 11 + 12 + use std::{io, pin::pin, time::Duration}; 13 + 14 + topic!(YeetTopic, u64, "topic/yeet"); 15 + 16 + #[tokio::main] 17 + async fn main() -> io::Result<()> { 18 + let queue = new_std_queue(4096); 19 + let stack: EdgeStack = new_target_stack(&queue, 1024); 20 + let socket = TcpStream::connect("127.0.0.1:2025").await.unwrap(); 21 + let port = socket.local_addr().unwrap().port(); 22 + // let logger = Box::new(LogSink::new(stack.clone())); 23 + // let logger = Box::leak(logger); 24 + // logger.register_static(log::LevelFilter::Info); 25 + env_logger::init(); 26 + 27 + tokio::task::spawn(basic_services(stack.clone(), port)); 28 + // tokio::task::spawn(yeeter(stack.clone())); 29 + // for i in 1..4 { 30 + // tokio::task::spawn(yeet_listener(stack.clone(), i)); 31 + // } 32 + 33 + register_edge_interface(&stack, socket, &queue) 34 + .await 35 + .unwrap(); 36 + loop { 37 + info!("Hello :)"); 38 + // tokio::time::sleep(Duration::from_secs(1)).await; 39 + let query = SocketQuery { 40 + key: ErgotSeedRouterAssignmentEndpoint::REQ_KEY.to_bytes(), 41 + nash_req: NameRequirement::Any, 42 + frame_kind: FrameKind::ENDPOINT_REQ, 43 + broadcast: false, 44 + }; 45 + log::error!("Do Disco!"); 46 + let res = stack 47 + .discovery() 48 + .discover_sockets(4, Duration::from_secs(1), &query) 49 + .await; 50 + if res.is_empty() { 51 + log::warn!("No Disco"); 52 + sleep(Duration::from_secs(1)).await; 53 + continue; 54 + } 55 + 56 + log::warn!("DISCO SAID: {res:?}"); 57 + let resp = stack 58 + .endpoints() 59 + .request::<ErgotSeedRouterAssignmentEndpoint>(res[0].address, &(), None) 60 + .await; 61 + log::warn!("GOT: {resp:?}"); 62 + break; 63 + } 64 + 65 + loop { 66 + info!("Done :)"); 67 + sleep(Duration::from_secs(1)).await; 68 + } 69 + } 70 + 71 + async fn basic_services(stack: EdgeStack, port: u16) { 72 + let info = DeviceInfo { 73 + name: Some("Ergot client".try_into().unwrap()), 74 + description: Some("An Ergot Client Device".try_into().unwrap()), 75 + unique_id: port.into(), 76 + }; 77 + let do_pings = stack.services().ping_handler::<4>(); 78 + let do_info = stack.services().device_info_handler::<4>(&info); 79 + 80 + select! { 81 + _ = do_pings => {} 82 + _ = do_info => {} 83 + } 84 + } 85 + 86 + async fn yeeter(stack: EdgeStack) { 87 + let mut ctr = 0; 88 + tokio::time::sleep(Duration::from_secs(3)).await; 89 + loop { 90 + tokio::time::sleep(Duration::from_secs(5)).await; 91 + warn!("Sending broadcast message"); 92 + stack.topics().broadcast::<YeetTopic>(&ctr, None).unwrap(); 93 + ctr += 1; 94 + } 95 + } 96 + 97 + async fn yeet_listener(stack: EdgeStack, id: u8) { 98 + let subber = stack.topics().heap_bounded_receiver::<YeetTopic>(64, None); 99 + let subber = pin!(subber); 100 + let mut hdl = subber.subscribe(); 101 + 102 + loop { 103 + let msg = hdl.recv().await; 104 + info!("{}: Listener id:{id} got {}", msg.hdr, msg.t); 105 + } 106 + }
-12
demos/std/ergot-bridge-client-tcp/Cargo.toml
··· 1 - [package] 2 - name = "ergot-bridge-client-tcp" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cordyceps = { workspace = true } 8 - env_logger = { workspace = true } 9 - log = { workspace = true } 10 - ergot = { workspace = true } 11 - mutex = { workspace = true } 12 - tokio = { workspace = true }
···
-106
demos/std/ergot-bridge-client-tcp/src/main.rs
··· 1 - use ergot::{ 2 - FrameKind, 3 - logging::log_v0_4::LogSink, 4 - toolkits::tokio_tcp::{EdgeStack, new_std_queue, new_target_stack, register_edge_interface}, 5 - topic, 6 - traits::Endpoint, 7 - well_known::{DeviceInfo, ErgotSeedRouterAssignmentEndpoint, NameRequirement, SocketQuery}, 8 - }; 9 - use log::{info, warn}; 10 - use tokio::{net::TcpStream, select, time::sleep}; 11 - 12 - use std::{io, pin::pin, time::Duration}; 13 - 14 - topic!(YeetTopic, u64, "topic/yeet"); 15 - 16 - #[tokio::main] 17 - async fn main() -> io::Result<()> { 18 - let queue = new_std_queue(4096); 19 - let stack: EdgeStack = new_target_stack(&queue, 1024); 20 - let socket = TcpStream::connect("127.0.0.1:2025").await.unwrap(); 21 - let port = socket.local_addr().unwrap().port(); 22 - // let logger = Box::new(LogSink::new(stack.clone())); 23 - // let logger = Box::leak(logger); 24 - // logger.register_static(log::LevelFilter::Info); 25 - env_logger::init(); 26 - 27 - tokio::task::spawn(basic_services(stack.clone(), port)); 28 - // tokio::task::spawn(yeeter(stack.clone())); 29 - // for i in 1..4 { 30 - // tokio::task::spawn(yeet_listener(stack.clone(), i)); 31 - // } 32 - 33 - register_edge_interface(&stack, socket, &queue) 34 - .await 35 - .unwrap(); 36 - loop { 37 - info!("Hello :)"); 38 - // tokio::time::sleep(Duration::from_secs(1)).await; 39 - let query = SocketQuery { 40 - key: ErgotSeedRouterAssignmentEndpoint::REQ_KEY.to_bytes(), 41 - nash_req: NameRequirement::Any, 42 - frame_kind: FrameKind::ENDPOINT_REQ, 43 - broadcast: false, 44 - }; 45 - log::error!("Do Disco!"); 46 - let res = stack 47 - .discovery() 48 - .discover_sockets(4, Duration::from_secs(1), &query) 49 - .await; 50 - if res.is_empty() { 51 - log::warn!("No Disco"); 52 - sleep(Duration::from_secs(1)).await; 53 - continue; 54 - } 55 - 56 - log::warn!("DISCO SAID: {:?}", res); 57 - let resp = stack 58 - .endpoints() 59 - .request::<ErgotSeedRouterAssignmentEndpoint>(res[0].address, &(), None) 60 - .await; 61 - log::warn!("GOT: {:?}", resp); 62 - break; 63 - } 64 - 65 - loop { 66 - info!("Done :)"); 67 - sleep(Duration::from_secs(1)).await; 68 - } 69 - } 70 - 71 - async fn basic_services(stack: EdgeStack, port: u16) { 72 - let info = DeviceInfo { 73 - name: Some("Ergot client".try_into().unwrap()), 74 - description: Some("An Ergot Client Device".try_into().unwrap()), 75 - unique_id: port.into(), 76 - }; 77 - let do_pings = stack.services().ping_handler::<4>(); 78 - let do_info = stack.services().device_info_handler::<4>(&info); 79 - 80 - select! { 81 - _ = do_pings => {} 82 - _ = do_info => {} 83 - } 84 - } 85 - 86 - async fn yeeter(stack: EdgeStack) { 87 - let mut ctr = 0; 88 - tokio::time::sleep(Duration::from_secs(3)).await; 89 - loop { 90 - tokio::time::sleep(Duration::from_secs(5)).await; 91 - warn!("Sending broadcast message"); 92 - stack.topics().broadcast::<YeetTopic>(&ctr, None).unwrap(); 93 - ctr += 1; 94 - } 95 - } 96 - 97 - async fn yeet_listener(stack: EdgeStack, id: u8) { 98 - let subber = stack.topics().heap_bounded_receiver::<YeetTopic>(64, None); 99 - let subber = pin!(subber); 100 - let mut hdl = subber.subscribe(); 101 - 102 - loop { 103 - let msg = hdl.recv().await; 104 - info!("{}: Listener id:{} got {}", msg.hdr, id, msg.t); 105 - } 106 - }
···
-18
demos/std/ergot-bridge-pair-udp/Cargo.toml
··· 1 - [package] 2 - name = "ergot-bridge-pair-udp" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cordyceps = { workspace = true } 8 - env_logger = { workspace = true } 9 - log = { workspace = true } 10 - ergot = { workspace = true } 11 - mutex = { workspace = true } 12 - tokio = { workspace = true } 13 - 14 - [[bin]] 15 - name = "controller" 16 - 17 - [[bin]] 18 - name = "target"
···
-125
demos/std/ergot-bridge-pair-udp/src/bin/controller.rs
··· 1 - use ergot::{ 2 - toolkits::tokio_udp::{ 3 - EdgeStack, new_controller_stack, new_std_queue, register_edge_interface, 4 - }, 5 - topic, 6 - well_known::DeviceInfo, 7 - }; 8 - use log::{debug, info, warn}; 9 - use tokio::{net::UdpSocket, select, time, time::sleep}; 10 - 11 - use ergot::interface_manager::profiles::direct_edge::tokio_udp::InterfaceKind; 12 - use std::collections::HashSet; 13 - use std::convert::TryInto; 14 - use std::{io, pin::pin, time::Duration}; 15 - use tokio::time::interval; 16 - 17 - topic!(YeetTopic, u64, "topic/yeet"); 18 - 19 - #[tokio::main] 20 - async fn main() -> io::Result<()> { 21 - let queue = new_std_queue(4096); 22 - let stack: EdgeStack = new_controller_stack(&queue, 1024); 23 - 24 - env_logger::init(); 25 - 26 - let udp_socket = UdpSocket::bind("127.0.0.1:8000").await.unwrap(); 27 - let remote_addr = "127.0.0.1:8001"; 28 - 29 - udp_socket.connect(remote_addr).await?; 30 - 31 - let port = udp_socket.local_addr().unwrap().port(); 32 - 33 - tokio::task::spawn(basic_services(stack.clone(), port)); 34 - tokio::task::spawn(yeeter(stack.clone())); 35 - tokio::task::spawn(yeet_listener(stack.clone(), 0)); 36 - 37 - register_edge_interface(&stack, udp_socket, &queue, InterfaceKind::Controller) 38 - .await 39 - .unwrap(); 40 - 41 - loop { 42 - println!("Waiting for messages..."); 43 - sleep(Duration::from_secs(1)).await; 44 - } 45 - } 46 - 47 - async fn basic_services(stack: EdgeStack, port: u16) { 48 - let info = DeviceInfo { 49 - name: Some("Ergot client".try_into().unwrap()), 50 - description: Some("An Ergot Client Device".try_into().unwrap()), 51 - unique_id: port.into(), 52 - }; 53 - let do_pings = stack.services().ping_handler::<4>(); 54 - let do_info = stack.services().device_info_handler::<4>(&info); 55 - // custom service for doing discovery on a set interval, in parallel 56 - let disco_req = tokio::spawn(do_discovery(stack.clone())); 57 - // forward log messages to the log crate output 58 - let log_handler = stack.services().log_handler(16); 59 - 60 - select! { 61 - _ = do_pings => {} 62 - _ = do_info => {} 63 - _ = disco_req => {}, 64 - _ = log_handler => {}, 65 - } 66 - } 67 - 68 - async fn do_discovery(stack: EdgeStack) { 69 - let mut max = 16; 70 - let mut seen = HashSet::new(); 71 - let mut ticker = interval(Duration::from_millis(5000)); 72 - loop { 73 - ticker.tick().await; 74 - let new_seen = stack 75 - .discovery() 76 - .discover(max, Duration::from_millis(2500)) 77 - .await; 78 - max = max.max(seen.len() * 2); 79 - let new_seen = HashSet::from_iter(new_seen); 80 - let added = new_seen.difference(&seen); 81 - for add in added { 82 - info!("Added: {:?}", add); 83 - } 84 - let removed = seen.difference(&new_seen); 85 - for rem in removed { 86 - info!("Removed: {:?}", rem); 87 - } 88 - seen = new_seen; 89 - 90 - ticker.tick().await; 91 - } 92 - } 93 - 94 - async fn yeeter(stack: EdgeStack) { 95 - let mut ctr = 0; 96 - tokio::time::sleep(Duration::from_secs(1)).await; 97 - loop { 98 - tokio::time::sleep(Duration::from_secs(5)).await; 99 - info!("Sending broadcast message from controller"); 100 - stack.topics().broadcast::<YeetTopic>(&ctr, None).unwrap(); 101 - ctr += 1; 102 - } 103 - } 104 - 105 - async fn yeet_listener(stack: EdgeStack, id: u8) { 106 - let subber = stack.topics().heap_bounded_receiver::<YeetTopic>(64, None); 107 - let subber = pin!(subber); 108 - let mut hdl = subber.subscribe(); 109 - 110 - let mut packets_this_interval = 0; 111 - let interval = Duration::from_secs(1); 112 - let mut ticker = time::interval(interval); 113 - loop { 114 - select! { 115 - _ = ticker.tick() => { 116 - info!("packet rate: {}/{:?}", packets_this_interval, interval); 117 - packets_this_interval = 0; 118 - } 119 - msg = hdl.recv() => { 120 - packets_this_interval += 1; 121 - debug!("{}: Listener id:{} got {}", msg.hdr, id, msg.t); 122 - } 123 - } 124 - } 125 - }
···
-94
demos/std/ergot-bridge-pair-udp/src/bin/target.rs
··· 1 - use ergot::{ 2 - toolkits::tokio_udp::{EdgeStack, new_std_queue, new_target_stack, register_edge_interface}, 3 - topic, 4 - well_known::DeviceInfo, 5 - }; 6 - use log::{debug, info}; 7 - use tokio::{net::UdpSocket, select, time, time::sleep}; 8 - 9 - use ergot::interface_manager::profiles::direct_edge::tokio_udp::InterfaceKind; 10 - use ergot::logging::log_v0_4::LogSink; 11 - use std::convert::TryInto; 12 - use std::{io, pin::pin, time::Duration}; 13 - 14 - topic!(YeetTopic, u64, "topic/yeet"); 15 - 16 - #[tokio::main] 17 - async fn main() -> io::Result<()> { 18 - //env_logger::init(); 19 - 20 - let queue = new_std_queue(4096); 21 - let stack: EdgeStack = new_target_stack(&queue, 1024); 22 - 23 - let logger = Box::new(LogSink::new(stack.clone())); 24 - let logger = Box::leak(logger); 25 - logger.register_static(log::LevelFilter::Info); 26 - 27 - let udp_socket = UdpSocket::bind("127.0.0.1:8001").await.unwrap(); 28 - let remote_addr = "127.0.0.1:8000"; 29 - 30 - udp_socket.connect(remote_addr).await?; 31 - 32 - let port = udp_socket.local_addr().unwrap().port(); 33 - 34 - tokio::task::spawn(basic_services(stack.clone(), port)); 35 - tokio::task::spawn(yeeter(stack.clone())); 36 - tokio::task::spawn(yeet_listener(stack.clone(), 0)); 37 - 38 - register_edge_interface(&stack, udp_socket, &queue, InterfaceKind::Target) 39 - .await 40 - .unwrap(); 41 - 42 - loop { 43 - println!("Waiting for messages..."); 44 - sleep(Duration::from_secs(1)).await; 45 - } 46 - } 47 - 48 - async fn basic_services(stack: EdgeStack, port: u16) { 49 - let info = DeviceInfo { 50 - name: Some("Ergot client".try_into().unwrap()), 51 - description: Some("An Ergot Client Device".try_into().unwrap()), 52 - unique_id: port.into(), 53 - }; 54 - let do_pings = stack.services().ping_handler::<4>(); 55 - let do_info = stack.services().device_info_handler::<4>(&info); 56 - 57 - select! { 58 - _ = do_pings => {} 59 - _ = do_info => {} 60 - } 61 - } 62 - 63 - async fn yeeter(stack: EdgeStack) { 64 - let mut ctr = 0; 65 - tokio::time::sleep(Duration::from_secs(1)).await; 66 - loop { 67 - tokio::time::sleep(Duration::from_secs(5)).await; 68 - info!("Sending broadcast message from target"); 69 - stack.topics().broadcast::<YeetTopic>(&ctr, None).unwrap(); 70 - ctr += 1; 71 - } 72 - } 73 - 74 - async fn yeet_listener(stack: EdgeStack, id: u8) { 75 - let subber = stack.topics().heap_bounded_receiver::<YeetTopic>(64, None); 76 - let subber = pin!(subber); 77 - let mut hdl = subber.subscribe(); 78 - 79 - let mut packets_this_interval = 0; 80 - let interval = Duration::from_secs(1); 81 - let mut ticker = time::interval(interval); 82 - loop { 83 - select! { 84 - _ = ticker.tick() => { 85 - info!("packet rate: {}/{:?}", packets_this_interval, interval); 86 - packets_this_interval = 0; 87 - } 88 - msg = hdl.recv() => { 89 - packets_this_interval += 1; 90 - debug!("{}: Listener id:{} got {}", msg.hdr, id, msg.t); 91 - } 92 - } 93 - } 94 - }
···
+12
demos/std/ergot-client/Cargo.toml
···
··· 1 + [package] 2 + name = "ergot-client" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + cordyceps = { workspace = true } 8 + env_logger = { workspace = true } 9 + log = { workspace = true } 10 + ergot = { workspace = true } 11 + mutex = { workspace = true } 12 + tokio = { workspace = true }
+74
demos/std/ergot-client/src/main.rs
···
··· 1 + use ergot::{ 2 + logging::log_v0_4::LogSink, 3 + toolkits::tokio_tcp::{EdgeStack, new_std_queue, new_target_stack, register_edge_interface}, 4 + topic, 5 + well_known::DeviceInfo, 6 + }; 7 + use log::{info, warn}; 8 + use tokio::{net::TcpStream, select}; 9 + 10 + use std::{io, pin::pin, time::Duration}; 11 + 12 + topic!(YeetTopic, u64, "topic/yeet"); 13 + 14 + #[tokio::main] 15 + async fn main() -> io::Result<()> { 16 + let queue = new_std_queue(4096); 17 + let stack: EdgeStack = new_target_stack(&queue, 1024); 18 + let socket = TcpStream::connect("127.0.0.1:2025").await.unwrap(); 19 + let port = socket.local_addr().unwrap().port(); 20 + let logger = Box::new(LogSink::new(stack.clone())); 21 + let logger = Box::leak(logger); 22 + logger.register_static(log::LevelFilter::Info); 23 + 24 + tokio::task::spawn(basic_services(stack.clone(), port)); 25 + tokio::task::spawn(yeeter(stack.clone())); 26 + for i in 1..4 { 27 + tokio::task::spawn(yeet_listener(stack.clone(), i)); 28 + } 29 + 30 + register_edge_interface(&stack, socket, &queue) 31 + .await 32 + .unwrap(); 33 + loop { 34 + info!("Hello :)"); 35 + tokio::time::sleep(Duration::from_secs(1)).await; 36 + } 37 + } 38 + 39 + async fn basic_services(stack: EdgeStack, port: u16) { 40 + let info = DeviceInfo { 41 + name: Some("Ergot client".try_into().unwrap()), 42 + description: Some("An Ergot Client Device".try_into().unwrap()), 43 + unique_id: port.into(), 44 + }; 45 + let do_pings = stack.services().ping_handler::<4>(); 46 + let do_info = stack.services().device_info_handler::<4>(&info); 47 + 48 + select! { 49 + _ = do_pings => {} 50 + _ = do_info => {} 51 + } 52 + } 53 + 54 + async fn yeeter(stack: EdgeStack) { 55 + let mut ctr = 0; 56 + tokio::time::sleep(Duration::from_secs(3)).await; 57 + loop { 58 + tokio::time::sleep(Duration::from_secs(5)).await; 59 + warn!("Sending broadcast message"); 60 + stack.topics().broadcast::<YeetTopic>(&ctr, None).unwrap(); 61 + ctr += 1; 62 + } 63 + } 64 + 65 + async fn yeet_listener(stack: EdgeStack, id: u8) { 66 + let subber = stack.topics().heap_bounded_receiver::<YeetTopic>(64, None); 67 + let subber = pin!(subber); 68 + let mut hdl = subber.subscribe(); 69 + 70 + loop { 71 + let msg = hdl.recv().await; 72 + info!("{}: Listener id:{id} got {}", msg.hdr, msg.t); 73 + } 74 + }
-12
demos/std/ergot-client-tcp/Cargo.toml
··· 1 - [package] 2 - name = "ergot-client-tcp" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cordyceps = { workspace = true } 8 - env_logger = { workspace = true } 9 - log = { workspace = true } 10 - ergot = { workspace = true } 11 - mutex = { workspace = true } 12 - tokio = { workspace = true }
···
-74
demos/std/ergot-client-tcp/src/main.rs
··· 1 - use ergot::{ 2 - logging::log_v0_4::LogSink, 3 - toolkits::tokio_tcp::{EdgeStack, new_std_queue, new_target_stack, register_edge_interface}, 4 - topic, 5 - well_known::DeviceInfo, 6 - }; 7 - use log::{info, warn}; 8 - use tokio::{net::TcpStream, select}; 9 - 10 - use std::{io, pin::pin, time::Duration}; 11 - 12 - topic!(YeetTopic, u64, "topic/yeet"); 13 - 14 - #[tokio::main] 15 - async fn main() -> io::Result<()> { 16 - let queue = new_std_queue(4096); 17 - let stack: EdgeStack = new_target_stack(&queue, 1024); 18 - let socket = TcpStream::connect("127.0.0.1:2025").await.unwrap(); 19 - let port = socket.local_addr().unwrap().port(); 20 - let logger = Box::new(LogSink::new(stack.clone())); 21 - let logger = Box::leak(logger); 22 - logger.register_static(log::LevelFilter::Info); 23 - 24 - tokio::task::spawn(basic_services(stack.clone(), port)); 25 - tokio::task::spawn(yeeter(stack.clone())); 26 - for i in 1..4 { 27 - tokio::task::spawn(yeet_listener(stack.clone(), i)); 28 - } 29 - 30 - register_edge_interface(&stack, socket, &queue) 31 - .await 32 - .unwrap(); 33 - loop { 34 - info!("Hello :)"); 35 - tokio::time::sleep(Duration::from_secs(1)).await; 36 - } 37 - } 38 - 39 - async fn basic_services(stack: EdgeStack, port: u16) { 40 - let info = DeviceInfo { 41 - name: Some("Ergot client".try_into().unwrap()), 42 - description: Some("An Ergot Client Device".try_into().unwrap()), 43 - unique_id: port.into(), 44 - }; 45 - let do_pings = stack.services().ping_handler::<4>(); 46 - let do_info = stack.services().device_info_handler::<4>(&info); 47 - 48 - select! { 49 - _ = do_pings => {} 50 - _ = do_info => {} 51 - } 52 - } 53 - 54 - async fn yeeter(stack: EdgeStack) { 55 - let mut ctr = 0; 56 - tokio::time::sleep(Duration::from_secs(3)).await; 57 - loop { 58 - tokio::time::sleep(Duration::from_secs(5)).await; 59 - warn!("Sending broadcast message"); 60 - stack.topics().broadcast::<YeetTopic>(&ctr, None).unwrap(); 61 - ctr += 1; 62 - } 63 - } 64 - 65 - async fn yeet_listener(stack: EdgeStack, id: u8) { 66 - let subber = stack.topics().heap_bounded_receiver::<YeetTopic>(64, None); 67 - let subber = pin!(subber); 68 - let mut hdl = subber.subscribe(); 69 - 70 - loop { 71 - let msg = hdl.recv().await; 72 - info!("{}: Listener id:{} got {}", msg.hdr, id, msg.t); 73 - } 74 - }
···
+4 -4
demos/std/ergot-nusb-router/src/main.rs
··· 39 40 for dev in devices { 41 let info = dev.info.clone(); 42 - info!("Found {:?}, registering", info); 43 let _hdl = register_router_interface(&stack, dev, MTU, OUT_BUFFER_SIZE) 44 .await 45 .unwrap(); ··· 59 loop { 60 ival.tick().await; 61 let nets = stack.manage_profile(|im| im.get_nets()); 62 - info!("Nets to ping: {:?}", nets); 63 for net in nets { 64 let pg = ctr; 65 ctr = ctr.wrapping_add(1); ··· 85 let fut = timeout(Duration::from_millis(100), rr); 86 let res = fut.await; 87 let elapsed = start.elapsed(); 88 - warn!("ping {}.2 w/ {}: {:?}, took: {:?}", net, pg, res, elapsed); 89 if let Ok(Ok(msg)) = res { 90 assert_eq!(msg.t, pg); 91 portmap.insert(net, msg.hdr.src.port_id); ··· 103 104 loop { 105 let msg = hdl.recv().await; 106 - info!("{}: Listener id:{} got {}", msg.hdr, id, msg.t); 107 } 108 }
··· 39 40 for dev in devices { 41 let info = dev.info.clone(); 42 + info!("Found {info:?}, registering"); 43 let _hdl = register_router_interface(&stack, dev, MTU, OUT_BUFFER_SIZE) 44 .await 45 .unwrap(); ··· 59 loop { 60 ival.tick().await; 61 let nets = stack.manage_profile(|im| im.get_nets()); 62 + info!("Nets to ping: {nets:?}"); 63 for net in nets { 64 let pg = ctr; 65 ctr = ctr.wrapping_add(1); ··· 85 let fut = timeout(Duration::from_millis(100), rr); 86 let res = fut.await; 87 let elapsed = start.elapsed(); 88 + warn!("ping {net}.2 w/ {pg}: {res:?}, took: {elapsed:?}"); 89 if let Ok(Ok(msg)) = res { 90 assert_eq!(msg.t, pg); 91 portmap.insert(net, msg.hdr.src.port_id); ··· 103 104 loop { 105 let msg = hdl.recv().await; 106 + info!("{}: Listener id:{id} got {}", msg.hdr, msg.t); 107 } 108 }
+8 -10
demos/std/ergot-router/src/main.rs
··· 29 // TODO: Should the library just do this for us? something like 30 loop { 31 let (socket, addr) = listener.accept().await?; 32 - info!("Connect {:?}", addr); 33 register_router_interface(&stack, socket, MAX_ERGOT_PACKET_SIZE, TX_BUFFER_SIZE) 34 .await 35 .unwrap(); ··· 46 let disco_answer = stack.services().device_info_handler::<4>(&info); 47 // handle incoming ping requests 48 let ping_answer = stack.services().ping_handler::<4>(); 49 - // custom service for doing discovery on a set interval, in parallel 50 - let disco_req = tokio::spawn(do_discovery(stack.clone())); 51 // forward log messages to the log crate output 52 let log_handler = stack.services().log_handler(16); 53 ··· 63 async fn do_discovery(stack: RouterStack) { 64 let mut max = 16; 65 let mut seen = HashSet::new(); 66 - let mut ticker = interval(Duration::from_millis(5000)); 67 loop { 68 ticker.tick().await; 69 let new_seen = stack 70 .discovery() 71 - .discover(max, Duration::from_millis(2500)) 72 .await; 73 max = max.max(seen.len() * 2); 74 let new_seen = HashSet::from_iter(new_seen); 75 let added = new_seen.difference(&seen); 76 for add in added { 77 - warn!("Added: {:?}", add); 78 } 79 let removed = seen.difference(&new_seen); 80 for rem in removed { 81 - warn!("Removed: {:?}", rem); 82 } 83 seen = new_seen; 84 - 85 - ticker.tick().await; 86 } 87 } 88 ··· 93 94 loop { 95 let msg = hdl.recv().await; 96 - info!("{}: Listener id:{} got {}", msg.hdr, id, msg.t); 97 } 98 }
··· 29 // TODO: Should the library just do this for us? something like 30 loop { 31 let (socket, addr) = listener.accept().await?; 32 + info!("Connect {addr:?}"); 33 register_router_interface(&stack, socket, MAX_ERGOT_PACKET_SIZE, TX_BUFFER_SIZE) 34 .await 35 .unwrap(); ··· 46 let disco_answer = stack.services().device_info_handler::<4>(&info); 47 // handle incoming ping requests 48 let ping_answer = stack.services().ping_handler::<4>(); 49 + // custom service for doing discovery regularly 50 + let disco_req = do_discovery(stack.clone()); 51 // forward log messages to the log crate output 52 let log_handler = stack.services().log_handler(16); 53 ··· 63 async fn do_discovery(stack: RouterStack) { 64 let mut max = 16; 65 let mut seen = HashSet::new(); 66 + let mut ticker = interval(Duration::from_millis(500)); 67 loop { 68 ticker.tick().await; 69 let new_seen = stack 70 .discovery() 71 + .discover(max, Duration::from_millis(250)) 72 .await; 73 max = max.max(seen.len() * 2); 74 let new_seen = HashSet::from_iter(new_seen); 75 let added = new_seen.difference(&seen); 76 for add in added { 77 + warn!("Added: {add:?}"); 78 } 79 let removed = seen.difference(&new_seen); 80 for rem in removed { 81 + warn!("Removed: {rem:?}"); 82 } 83 seen = new_seen; 84 } 85 } 86 ··· 91 92 loop { 93 let msg = hdl.recv().await; 94 + info!("{}: Listener id:{id} got {}", msg.hdr, msg.t); 95 } 96 }
+7 -8
demos/std/ergot-seed-router/src/main.rs
··· 29 // TODO: Should the library just do this for us? something like 30 loop { 31 let (socket, addr) = listener.accept().await?; 32 - info!("Connect {:?}", addr); 33 register_router_interface(&stack, socket, MAX_ERGOT_PACKET_SIZE, TX_BUFFER_SIZE) 34 .await 35 .unwrap(); ··· 46 let disco_answer = stack.services().device_info_handler::<4>(&info); 47 // handle incoming ping requests 48 let ping_answer = stack.services().ping_handler::<4>(); 49 - // custom service for doing discovery on a set interval, in parallel 50 - let disco_req = tokio::spawn(do_discovery(stack.clone())); 51 // forward log messages to the log crate output 52 let log_handler = stack.services().log_handler(16); 53 // Seed router ··· 71 let mut seen = HashSet::new(); 72 let mut ticker = interval(Duration::from_millis(5000)); 73 loop { 74 let new_seen = stack 75 .discovery() 76 .discover(max, Duration::from_millis(2500)) ··· 79 let new_seen = HashSet::from_iter(new_seen); 80 let added = new_seen.difference(&seen); 81 for add in added { 82 - warn!("Added: {:?}", add); 83 } 84 let removed = seen.difference(&new_seen); 85 for rem in removed { 86 - warn!("Removed: {:?}", rem); 87 } 88 seen = new_seen; 89 - 90 - ticker.tick().await; 91 } 92 } 93 ··· 98 99 loop { 100 let msg = hdl.recv().await; 101 - info!("Listener id:{} got {:?}", id, msg); 102 } 103 }
··· 29 // TODO: Should the library just do this for us? something like 30 loop { 31 let (socket, addr) = listener.accept().await?; 32 + info!("Connect {addr:?}"); 33 register_router_interface(&stack, socket, MAX_ERGOT_PACKET_SIZE, TX_BUFFER_SIZE) 34 .await 35 .unwrap(); ··· 46 let disco_answer = stack.services().device_info_handler::<4>(&info); 47 // handle incoming ping requests 48 let ping_answer = stack.services().ping_handler::<4>(); 49 + // custom service for doing discovery regularly 50 + let disco_req = do_discovery(stack.clone()); 51 // forward log messages to the log crate output 52 let log_handler = stack.services().log_handler(16); 53 // Seed router ··· 71 let mut seen = HashSet::new(); 72 let mut ticker = interval(Duration::from_millis(5000)); 73 loop { 74 + ticker.tick().await; 75 let new_seen = stack 76 .discovery() 77 .discover(max, Duration::from_millis(2500)) ··· 80 let new_seen = HashSet::from_iter(new_seen); 81 let added = new_seen.difference(&seen); 82 for add in added { 83 + warn!("Added: {add:?}"); 84 } 85 let removed = seen.difference(&new_seen); 86 for rem in removed { 87 + warn!("Removed: {rem:?}"); 88 } 89 seen = new_seen; 90 } 91 } 92 ··· 97 98 loop { 99 let msg = hdl.recv().await; 100 + info!("Listener id:{id} got {msg:?}"); 101 } 102 }
+12
demos/std/log-client/Cargo.toml
···
··· 1 + [package] 2 + name = "log-client" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + cordyceps = { workspace = true } 8 + env_logger = { workspace = true } 9 + log = { workspace = true } 10 + ergot = { workspace = true } 11 + mutex = { workspace = true } 12 + tokio = { workspace = true }
+29
demos/std/log-client/src/main.rs
···
··· 1 + use ergot::{ 2 + fmt, 3 + toolkits::tokio_tcp::{EdgeStack, new_std_queue, new_target_stack, register_edge_interface}, 4 + }; 5 + use tokio::net::TcpStream; 6 + 7 + use std::{io, time::Duration}; 8 + 9 + #[tokio::main] 10 + async fn main() -> io::Result<()> { 11 + let queue = new_std_queue(4096); 12 + let stack: EdgeStack = new_target_stack(&queue, 1024); 13 + 14 + env_logger::init(); 15 + let socket = TcpStream::connect("127.0.0.1:2025").await.unwrap(); 16 + 17 + register_edge_interface(&stack, socket, &queue) 18 + .await 19 + .unwrap(); 20 + 21 + let mut ctr = 0usize; 22 + let msg = "world"; 23 + 24 + loop { 25 + stack.info_fmt(fmt!("Hello, {msg} - {ctr}")); 26 + ctr += 1; 27 + tokio::time::sleep(Duration::from_secs(1)).await; 28 + } 29 + }
-12
demos/std/log-client-tcp/Cargo.toml
··· 1 - [package] 2 - name = "log-client-tcp" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cordyceps = { workspace = true } 8 - env_logger = { workspace = true } 9 - log = { workspace = true } 10 - ergot = { workspace = true } 11 - mutex = { workspace = true } 12 - tokio = { workspace = true }
···
-29
demos/std/log-client-tcp/src/main.rs
··· 1 - use ergot::{ 2 - fmt, 3 - toolkits::tokio_tcp::{EdgeStack, new_std_queue, new_target_stack, register_edge_interface}, 4 - }; 5 - use tokio::net::TcpStream; 6 - 7 - use std::{io, time::Duration}; 8 - 9 - #[tokio::main] 10 - async fn main() -> io::Result<()> { 11 - let queue = new_std_queue(4096); 12 - let stack: EdgeStack = new_target_stack(&queue, 1024); 13 - 14 - env_logger::init(); 15 - let socket = TcpStream::connect("127.0.0.1:2025").await.unwrap(); 16 - 17 - register_edge_interface(&stack, socket, &queue) 18 - .await 19 - .unwrap(); 20 - 21 - let mut ctr = 0usize; 22 - let msg = "world"; 23 - 24 - loop { 25 - stack.info_fmt(fmt!("Hello, {} - {}", msg, ctr)); 26 - ctr += 1; 27 - tokio::time::sleep(Duration::from_secs(1)).await; 28 - } 29 - }
···
+12
demos/std/log-router/Cargo.toml
···
··· 1 + [package] 2 + name = "log-router" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + cordyceps = { workspace = true } 8 + env_logger = { workspace = true } 9 + log = { workspace = true } 10 + ergot = { workspace = true } 11 + mutex = { workspace = true } 12 + tokio = { workspace = true }
+70
demos/std/log-router/src/main.rs
···
··· 1 + use ergot::{ 2 + Address, 3 + toolkits::tokio_tcp::{RouterStack, register_router_interface}, 4 + well_known::ErgotPingEndpoint, 5 + }; 6 + use log::info; 7 + use tokio::{ 8 + net::TcpListener, 9 + time::{interval, timeout}, 10 + }; 11 + 12 + use std::{io, time::Duration}; 13 + 14 + // Server 15 + const MAX_ERGOT_PACKET_SIZE: u16 = 1024; 16 + const TX_BUFFER_SIZE: usize = 4096; 17 + 18 + #[tokio::main] 19 + async fn main() -> io::Result<()> { 20 + env_logger::init(); 21 + let listener = TcpListener::bind("127.0.0.1:2025").await?; 22 + let stack: RouterStack = RouterStack::new(); 23 + 24 + // TODO: We still need pinging because edge router doesn't have any 25 + // other way to be assigned a net 26 + tokio::task::spawn(ping_all(stack.clone())); 27 + tokio::task::spawn(log_collect(stack.clone())); 28 + 29 + // TODO: Should the library just do this for us? something like 30 + loop { 31 + let (socket, addr) = listener.accept().await?; 32 + info!("Connect {addr:?}"); 33 + register_router_interface(&stack, socket, MAX_ERGOT_PACKET_SIZE, TX_BUFFER_SIZE) 34 + .await 35 + .unwrap(); 36 + } 37 + } 38 + 39 + async fn ping_all(stack: RouterStack) { 40 + let mut ival = interval(Duration::from_secs(3)); 41 + let mut ctr = 0u32; 42 + loop { 43 + ival.tick().await; 44 + let nets = stack.manage_profile(|im| im.get_nets()); 45 + info!("Nets to ping: {nets:?}"); 46 + for net in nets { 47 + let pg = ctr; 48 + ctr = ctr.wrapping_add(1); 49 + let rr = stack.endpoints().request::<ErgotPingEndpoint>( 50 + Address { 51 + network_id: net, 52 + node_id: 2, 53 + port_id: 0, 54 + }, 55 + &pg, 56 + None, 57 + ); 58 + let fut = timeout(Duration::from_millis(100), rr); 59 + let res = fut.await; 60 + info!("ping {net}.2 w/ {pg}: {res:?}"); 61 + if let Ok(Ok(msg)) = res { 62 + assert_eq!(msg, pg); 63 + } 64 + } 65 + } 66 + } 67 + 68 + async fn log_collect(stack: RouterStack) { 69 + stack.services().default_stdout_log_handler(64).await 70 + }
+2 -2
demos/std/log-router-serial/src/main.rs
··· 44 loop { 45 ival.tick().await; 46 let nets = stack.manage_profile(|im| im.get_nets()); 47 - info!("Nets to ping: {:?}", nets); 48 for net in nets { 49 let pg = ctr; 50 ctr = ctr.wrapping_add(1); ··· 59 ); 60 let fut = timeout(Duration::from_millis(100), rr); 61 let res = fut.await; 62 - info!("ping {}.2 w/ {}: {:?}", net, pg, res); 63 if let Ok(Ok(msg)) = res { 64 assert_eq!(msg, pg); 65 }
··· 44 loop { 45 ival.tick().await; 46 let nets = stack.manage_profile(|im| im.get_nets()); 47 + info!("Nets to ping: {nets:?}"); 48 for net in nets { 49 let pg = ctr; 50 ctr = ctr.wrapping_add(1); ··· 59 ); 60 let fut = timeout(Duration::from_millis(100), rr); 61 let res = fut.await; 62 + info!("ping {net}.2 w/ {pg}: {res:?}"); 63 if let Ok(Ok(msg)) = res { 64 assert_eq!(msg, pg); 65 }
-12
demos/std/log-router-tcp/Cargo.toml
··· 1 - [package] 2 - name = "log-router-tcp" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cordyceps = { workspace = true } 8 - env_logger = { workspace = true } 9 - log = { workspace = true } 10 - ergot = { workspace = true } 11 - mutex = { workspace = true } 12 - tokio = { workspace = true }
···
-70
demos/std/log-router-tcp/src/main.rs
··· 1 - use ergot::{ 2 - Address, 3 - toolkits::tokio_tcp::{RouterStack, register_router_interface}, 4 - well_known::ErgotPingEndpoint, 5 - }; 6 - use log::info; 7 - use tokio::{ 8 - net::TcpListener, 9 - time::{interval, timeout}, 10 - }; 11 - 12 - use std::{io, time::Duration}; 13 - 14 - // Server 15 - const MAX_ERGOT_PACKET_SIZE: u16 = 1024; 16 - const TX_BUFFER_SIZE: usize = 4096; 17 - 18 - #[tokio::main] 19 - async fn main() -> io::Result<()> { 20 - env_logger::init(); 21 - let listener = TcpListener::bind("127.0.0.1:2025").await?; 22 - let stack: RouterStack = RouterStack::new(); 23 - 24 - // TODO: We still need pinging because edge router doesn't have any 25 - // other way to be assigned a net 26 - tokio::task::spawn(ping_all(stack.clone())); 27 - tokio::task::spawn(log_collect(stack.clone())); 28 - 29 - // TODO: Should the library just do this for us? something like 30 - loop { 31 - let (socket, addr) = listener.accept().await?; 32 - info!("Connect {:?}", addr); 33 - register_router_interface(&stack, socket, MAX_ERGOT_PACKET_SIZE, TX_BUFFER_SIZE) 34 - .await 35 - .unwrap(); 36 - } 37 - } 38 - 39 - async fn ping_all(stack: RouterStack) { 40 - let mut ival = interval(Duration::from_secs(3)); 41 - let mut ctr = 0u32; 42 - loop { 43 - ival.tick().await; 44 - let nets = stack.manage_profile(|im| im.get_nets()); 45 - info!("Nets to ping: {:?}", nets); 46 - for net in nets { 47 - let pg = ctr; 48 - ctr = ctr.wrapping_add(1); 49 - let rr = stack.endpoints().request::<ErgotPingEndpoint>( 50 - Address { 51 - network_id: net, 52 - node_id: 2, 53 - port_id: 0, 54 - }, 55 - &pg, 56 - None, 57 - ); 58 - let fut = timeout(Duration::from_millis(100), rr); 59 - let res = fut.await; 60 - info!("ping {}.2 w/ {}: {:?}", net, pg, res); 61 - if let Ok(Ok(msg)) = res { 62 - assert_eq!(msg, pg); 63 - } 64 - } 65 - } 66 - } 67 - 68 - async fn log_collect(stack: RouterStack) { 69 - stack.services().default_stdout_log_handler(64).await 70 - }
···
+3 -3
demos/std/stream-plotting/src/main.rs
··· 43 44 for dev in devices { 45 let info = dev.info.clone(); 46 - info!("Found {:?}, registering", info); 47 let _hdl = register_router_interface(&stack, dev, MTU, OUT_BUFFER_SIZE) 48 .await 49 .unwrap(); ··· 63 loop { 64 ival.tick().await; 65 let nets = stack.manage_profile(|im| im.get_nets()); 66 - info!("Nets to ping: {:?}", nets); 67 for net in nets { 68 let pg = ctr; 69 ctr = ctr.wrapping_add(1); ··· 89 let fut = timeout(Duration::from_millis(100), rr); 90 let res = fut.await; 91 let elapsed = start.elapsed(); 92 - warn!("ping {}.2 w/ {}: {:?}, took: {:?}", net, pg, res, elapsed); 93 if let Ok(Ok(msg)) = res { 94 assert_eq!(msg.t, pg); 95 portmap.insert(net, msg.hdr.src.port_id);
··· 43 44 for dev in devices { 45 let info = dev.info.clone(); 46 + info!("Found {info:?}, registering"); 47 let _hdl = register_router_interface(&stack, dev, MTU, OUT_BUFFER_SIZE) 48 .await 49 .unwrap(); ··· 63 loop { 64 ival.tick().await; 65 let nets = stack.manage_profile(|im| im.get_nets()); 66 + info!("Nets to ping: {nets:?}"); 67 for net in nets { 68 let pg = ctr; 69 ctr = ctr.wrapping_add(1); ··· 89 let fut = timeout(Duration::from_millis(100), rr); 90 let res = fut.await; 91 let elapsed = start.elapsed(); 92 + warn!("ping {net}.2 w/ {pg}: {res:?}, took: {elapsed:?}"); 93 if let Ok(Ok(msg)) = res { 94 assert_eq!(msg.t, pg); 95 portmap.insert(net, msg.hdr.src.port_id);
+4 -4
demos/std/tilt-app/src/main.rs
··· 42 43 for dev in devices { 44 let info = dev.info.clone(); 45 - info!("Found {:?}, registering", info); 46 let _hdl = register_router_interface(&stack, dev, MTU, OUT_BUFFER_SIZE) 47 .await 48 .unwrap(); ··· 62 loop { 63 ival.tick().await; 64 let nets = stack.manage_profile(|im| im.get_nets()); 65 - info!("Nets to ping: {:?}", nets); 66 for net in nets { 67 let pg = ctr; 68 ctr = ctr.wrapping_add(1); ··· 88 let fut = timeout(Duration::from_millis(100), rr); 89 let res = fut.await; 90 let elapsed = start.elapsed(); 91 - warn!("ping {}.2 w/ {}: {:?}, took: {:?}", net, pg, res, elapsed); 92 if let Ok(Ok(msg)) = res { 93 assert_eq!(msg.t, pg); 94 portmap.insert(net, msg.hdr.src.port_id); ··· 218 219 loop { 220 let msg = hdl.recv().await; 221 - info!("Listener id:{} got {:?}", id, msg); 222 } 223 } 224
··· 42 43 for dev in devices { 44 let info = dev.info.clone(); 45 + info!("Found {info:?}, registering"); 46 let _hdl = register_router_interface(&stack, dev, MTU, OUT_BUFFER_SIZE) 47 .await 48 .unwrap(); ··· 62 loop { 63 ival.tick().await; 64 let nets = stack.manage_profile(|im| im.get_nets()); 65 + info!("Nets to ping: {nets:?}"); 66 for net in nets { 67 let pg = ctr; 68 ctr = ctr.wrapping_add(1); ··· 88 let fut = timeout(Duration::from_millis(100), rr); 89 let res = fut.await; 90 let elapsed = start.elapsed(); 91 + warn!("ping {net}.2 w/ {pg}: {res:?}, took: {elapsed:?}"); 92 if let Ok(Ok(msg)) = res { 93 assert_eq!(msg.t, pg); 94 portmap.insert(net, msg.hdr.src.port_id); ··· 218 219 loop { 220 let msg = hdl.recv().await; 221 + info!("Listener id:{id} got {msg:?}"); 222 } 223 } 224
+24 -31
demos/stm32f303vc/Cargo.lock
··· 318 319 [[package]] 320 name = "embassy-embedded-hal" 321 - version = "0.5.0" 322 source = "registry+https://github.com/rust-lang/crates.io-index" 323 - checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 324 dependencies = [ 325 "defmt 1.0.1", 326 "embassy-futures", ··· 337 338 [[package]] 339 name = "embassy-executor" 340 - version = "0.9.1" 341 source = "registry+https://github.com/rust-lang/crates.io-index" 342 - checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 343 dependencies = [ 344 "cortex-m", 345 "critical-section", 346 "defmt 1.0.1", 347 "document-features", 348 "embassy-executor-macros", 349 - "embassy-executor-timer-queue", 350 ] 351 352 [[package]] ··· 362 ] 363 364 [[package]] 365 - name = "embassy-executor-timer-queue" 366 - version = "0.1.0" 367 - source = "registry+https://github.com/rust-lang/crates.io-index" 368 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 369 - 370 - [[package]] 371 name = "embassy-futures" 372 - version = "0.1.2" 373 source = "registry+https://github.com/rust-lang/crates.io-index" 374 - checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 375 376 [[package]] 377 name = "embassy-hal-internal" ··· 407 408 [[package]] 409 name = "embassy-stm32" 410 - version = "0.4.0" 411 source = "registry+https://github.com/rust-lang/crates.io-index" 412 - checksum = "0d972eab325cc96afee98f80a91ca6b00249b6356dc0fdbff68b70c200df9fae" 413 dependencies = [ 414 "aligned", 415 "bit_field", ··· 456 457 [[package]] 458 name = "embassy-sync" 459 - version = "0.7.2" 460 source = "registry+https://github.com/rust-lang/crates.io-index" 461 - checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 462 dependencies = [ 463 "cfg-if", 464 "critical-section", ··· 471 472 [[package]] 473 name = "embassy-time" 474 - version = "0.5.0" 475 source = "registry+https://github.com/rust-lang/crates.io-index" 476 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 477 dependencies = [ 478 "cfg-if", 479 "critical-section", 480 - "defmt 1.0.1", 481 "document-features", 482 "embassy-time-driver", 483 "embedded-hal 0.2.7", 484 "embedded-hal 1.0.0", 485 "embedded-hal-async", 486 - "futures-core", 487 ] 488 489 [[package]] 490 name = "embassy-time-driver" 491 - version = "0.2.1" 492 source = "registry+https://github.com/rust-lang/crates.io-index" 493 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 494 dependencies = [ 495 "document-features", 496 ] 497 498 [[package]] 499 name = "embassy-time-queue-utils" 500 - version = "0.3.0" 501 source = "registry+https://github.com/rust-lang/crates.io-index" 502 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 503 dependencies = [ 504 - "embassy-executor-timer-queue", 505 "heapless 0.8.0", 506 ] 507 ··· 533 534 [[package]] 535 name = "embassy-usb-synopsys-otg" 536 - version = "0.3.1" 537 source = "registry+https://github.com/rust-lang/crates.io-index" 538 - checksum = "288751f8eaa44a5cf2613f13cee0ca8e06e6638cb96e897e6834702c79084b23" 539 dependencies = [ 540 "critical-section", 541 "defmt 1.0.1", ··· 629 630 [[package]] 631 name = "ergot" 632 - version = "0.12.0" 633 dependencies = [ 634 "bbq2", 635 "cobs 0.3.0", ··· 1249 1250 [[package]] 1251 name = "stm32-metapac" 1252 - version = "18.0.0" 1253 source = "registry+https://github.com/rust-lang/crates.io-index" 1254 - checksum = "6fd8ec3a292a0d9fc4798416a61b21da5ae50341b2e7b8d12e662bf305366097" 1255 dependencies = [ 1256 "cortex-m", 1257 "cortex-m-rt",
··· 318 319 [[package]] 320 name = "embassy-embedded-hal" 321 + version = "0.4.0" 322 source = "registry+https://github.com/rust-lang/crates.io-index" 323 + checksum = "d1611b7a7ab5d1fbed84c338df26d56fd9bded58006ebb029075112ed2c5e039" 324 dependencies = [ 325 "defmt 1.0.1", 326 "embassy-futures", ··· 337 338 [[package]] 339 name = "embassy-executor" 340 + version = "0.8.0" 341 source = "registry+https://github.com/rust-lang/crates.io-index" 342 + checksum = "f102d5e04befe3ea74b6f41a0e26218740124636eb2f59e1cc215b5839b96df2" 343 dependencies = [ 344 "cortex-m", 345 "critical-section", 346 "defmt 1.0.1", 347 "document-features", 348 "embassy-executor-macros", 349 ] 350 351 [[package]] ··· 361 ] 362 363 [[package]] 364 name = "embassy-futures" 365 + version = "0.1.1" 366 source = "registry+https://github.com/rust-lang/crates.io-index" 367 + checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" 368 369 [[package]] 370 name = "embassy-hal-internal" ··· 400 401 [[package]] 402 name = "embassy-stm32" 403 + version = "0.3.0" 404 source = "registry+https://github.com/rust-lang/crates.io-index" 405 + checksum = "e2eb597acf7ecf8f8f6427ee29ce863d1ab7430e3a76e605957b7ca19e5bf8ef" 406 dependencies = [ 407 "aligned", 408 "bit_field", ··· 449 450 [[package]] 451 name = "embassy-sync" 452 + version = "0.7.1" 453 source = "registry+https://github.com/rust-lang/crates.io-index" 454 + checksum = "03c372c90d3525a648684fa1c131decaf7d9ff181030db09c876fad6043443b9" 455 dependencies = [ 456 "cfg-if", 457 "critical-section", ··· 464 465 [[package]] 466 name = "embassy-time" 467 + version = "0.4.0" 468 source = "registry+https://github.com/rust-lang/crates.io-index" 469 + checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" 470 dependencies = [ 471 "cfg-if", 472 "critical-section", 473 + "defmt 0.3.100", 474 "document-features", 475 "embassy-time-driver", 476 "embedded-hal 0.2.7", 477 "embedded-hal 1.0.0", 478 "embedded-hal-async", 479 + "futures-util", 480 ] 481 482 [[package]] 483 name = "embassy-time-driver" 484 + version = "0.2.0" 485 source = "registry+https://github.com/rust-lang/crates.io-index" 486 + checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba" 487 dependencies = [ 488 "document-features", 489 ] 490 491 [[package]] 492 name = "embassy-time-queue-utils" 493 + version = "0.2.0" 494 source = "registry+https://github.com/rust-lang/crates.io-index" 495 + checksum = "59b742d6fec7afcfa77c91b476520627151da3735fca6373b287c4c94b69e171" 496 dependencies = [ 497 + "embassy-executor", 498 "heapless 0.8.0", 499 ] 500 ··· 526 527 [[package]] 528 name = "embassy-usb-synopsys-otg" 529 + version = "0.3.0" 530 source = "registry+https://github.com/rust-lang/crates.io-index" 531 + checksum = "79841982f857f113946b8cc0d46a69d124c523d5e4077282a608c8084ff655d9" 532 dependencies = [ 533 "critical-section", 534 "defmt 1.0.1", ··· 622 623 [[package]] 624 name = "ergot" 625 + version = "0.11.0" 626 dependencies = [ 627 "bbq2", 628 "cobs 0.3.0", ··· 1242 1243 [[package]] 1244 name = "stm32-metapac" 1245 + version = "17.0.0" 1246 source = "registry+https://github.com/rust-lang/crates.io-index" 1247 + checksum = "5b44329ff285800f88ccc1666218808c6ed0e6dc570383b5f661caadb8101133" 1248 dependencies = [ 1249 "cortex-m", 1250 "cortex-m-rt",
+3 -3
demos/stm32f303vc/Cargo.toml
··· 15 mutex = "1.0.2" 16 17 cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 18 - embassy-executor = { version = "0.9.1", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 19 - embassy-stm32 = { version = "0.4.0", features = [ "defmt", "stm32f303vc", "unstable-pac", "memory-x", "time-driver-tim2", "exti"] } 20 - embassy-time = { version = "0.5.0", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 21 heapless = { version = "0.9", default-features = false } 22 panic-probe = { version = "1.0.0", features = ["print-defmt"] } 23 postcard-schema = { version = "0.2.5", features = ["derive"] }
··· 15 mutex = "1.0.2" 16 17 cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 18 + embassy-executor = { version = "0.8.0", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] } 19 + embassy-stm32 = { version = "0.3.0", features = [ "defmt", "stm32f303vc", "unstable-pac", "memory-x", "time-driver-tim2", "exti"] } 20 + embassy-time = { version = "0.4.0", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 21 heapless = { version = "0.9", default-features = false } 22 panic-probe = { version = "1.0.0", features = ["print-defmt"] } 23 postcard-schema = { version = "0.2.5", features = ["derive"] }
-8
demos/stm32h723zg/.cargo/config.toml
··· 1 - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] 2 - runner = "probe-rs run --chip STM32H723ZG" 3 - 4 - [build] 5 - target = "thumbv7em-none-eabihf" 6 - 7 - [env] 8 - DEFMT_LOG = "trace"
···
-1638
demos/stm32h723zg/Cargo.lock
··· 1 - # This file is automatically @generated by Cargo. 2 - # It is not intended for manual editing. 3 - version = 4 4 - 5 - [[package]] 6 - name = "aho-corasick" 7 - version = "1.1.3" 8 - source = "registry+https://github.com/rust-lang/crates.io-index" 9 - checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 10 - dependencies = [ 11 - "memchr", 12 - ] 13 - 14 - [[package]] 15 - name = "aligned" 16 - version = "0.4.2" 17 - source = "registry+https://github.com/rust-lang/crates.io-index" 18 - checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" 19 - dependencies = [ 20 - "as-slice", 21 - ] 22 - 23 - [[package]] 24 - name = "as-slice" 25 - version = "0.2.1" 26 - source = "registry+https://github.com/rust-lang/crates.io-index" 27 - checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" 28 - dependencies = [ 29 - "stable_deref_trait", 30 - ] 31 - 32 - [[package]] 33 - name = "atomic-polyfill" 34 - version = "1.0.3" 35 - source = "registry+https://github.com/rust-lang/crates.io-index" 36 - checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" 37 - dependencies = [ 38 - "critical-section", 39 - ] 40 - 41 - [[package]] 42 - name = "autocfg" 43 - version = "1.5.0" 44 - source = "registry+https://github.com/rust-lang/crates.io-index" 45 - checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" 46 - 47 - [[package]] 48 - name = "bare-metal" 49 - version = "0.2.5" 50 - source = "registry+https://github.com/rust-lang/crates.io-index" 51 - checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 52 - dependencies = [ 53 - "rustc_version 0.2.3", 54 - ] 55 - 56 - [[package]] 57 - name = "base64" 58 - version = "0.13.1" 59 - source = "registry+https://github.com/rust-lang/crates.io-index" 60 - checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 61 - 62 - [[package]] 63 - name = "bbq2" 64 - version = "0.4.2" 65 - source = "registry+https://github.com/rust-lang/crates.io-index" 66 - checksum = "25d3e5fd78b60ce3a60e21e9a92b1d5e741328264de8e609193e2bf7616747bd" 67 - dependencies = [ 68 - "const-init", 69 - "critical-section", 70 - "maitake-sync", 71 - ] 72 - 73 - [[package]] 74 - name = "bit_field" 75 - version = "0.10.2" 76 - source = "registry+https://github.com/rust-lang/crates.io-index" 77 - checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" 78 - 79 - [[package]] 80 - name = "bitfield" 81 - version = "0.13.2" 82 - source = "registry+https://github.com/rust-lang/crates.io-index" 83 - checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 84 - 85 - [[package]] 86 - name = "bitflags" 87 - version = "1.3.2" 88 - source = "registry+https://github.com/rust-lang/crates.io-index" 89 - checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 90 - 91 - [[package]] 92 - name = "bitflags" 93 - version = "2.9.3" 94 - source = "registry+https://github.com/rust-lang/crates.io-index" 95 - checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" 96 - 97 - [[package]] 98 - name = "block-device-driver" 99 - version = "0.2.0" 100 - source = "registry+https://github.com/rust-lang/crates.io-index" 101 - checksum = "44c051592f59fe68053524b4c4935249b806f72c1f544cfb7abe4f57c3be258e" 102 - dependencies = [ 103 - "aligned", 104 - ] 105 - 106 - [[package]] 107 - name = "byteorder" 108 - version = "1.5.0" 109 - source = "registry+https://github.com/rust-lang/crates.io-index" 110 - checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 111 - 112 - [[package]] 113 - name = "cc" 114 - version = "1.2.34" 115 - source = "registry+https://github.com/rust-lang/crates.io-index" 116 - checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc" 117 - dependencies = [ 118 - "shlex", 119 - ] 120 - 121 - [[package]] 122 - name = "cfg-if" 123 - version = "1.0.3" 124 - source = "registry+https://github.com/rust-lang/crates.io-index" 125 - checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" 126 - 127 - [[package]] 128 - name = "cobs" 129 - version = "0.3.0" 130 - source = "registry+https://github.com/rust-lang/crates.io-index" 131 - checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" 132 - dependencies = [ 133 - "thiserror", 134 - ] 135 - 136 - [[package]] 137 - name = "cobs" 138 - version = "0.4.0" 139 - source = "registry+https://github.com/rust-lang/crates.io-index" 140 - checksum = "fea6d1b751c55bd9c0dda7d4ff752074e98f4765ae969664648bd193bb326d15" 141 - dependencies = [ 142 - "thiserror", 143 - ] 144 - 145 - [[package]] 146 - name = "cobs-acc" 147 - version = "0.1.0" 148 - dependencies = [ 149 - "cobs 0.4.0", 150 - ] 151 - 152 - [[package]] 153 - name = "const-default" 154 - version = "1.0.0" 155 - source = "registry+https://github.com/rust-lang/crates.io-index" 156 - checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" 157 - 158 - [[package]] 159 - name = "const-fnv1a-hash" 160 - version = "1.1.0" 161 - source = "registry+https://github.com/rust-lang/crates.io-index" 162 - checksum = "32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca" 163 - 164 - [[package]] 165 - name = "const-init" 166 - version = "1.0.0" 167 - source = "registry+https://github.com/rust-lang/crates.io-index" 168 - checksum = "4bd422bfb4f24a97243f60b6a4443e63d810c925d8da4bb2d8fde26a7c1d57ec" 169 - 170 - [[package]] 171 - name = "cordyceps" 172 - version = "0.3.4" 173 - source = "registry+https://github.com/rust-lang/crates.io-index" 174 - checksum = "688d7fbb8092b8de775ef2536f36c8c31f2bc4006ece2e8d8ad2d17d00ce0a2a" 175 - dependencies = [ 176 - "loom", 177 - "tracing", 178 - ] 179 - 180 - [[package]] 181 - name = "cortex-m" 182 - version = "0.7.7" 183 - source = "registry+https://github.com/rust-lang/crates.io-index" 184 - checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" 185 - dependencies = [ 186 - "bare-metal", 187 - "bitfield", 188 - "critical-section", 189 - "embedded-hal 0.2.7", 190 - "volatile-register", 191 - ] 192 - 193 - [[package]] 194 - name = "cortex-m-rt" 195 - version = "0.7.5" 196 - source = "registry+https://github.com/rust-lang/crates.io-index" 197 - checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" 198 - dependencies = [ 199 - "cortex-m-rt-macros", 200 - ] 201 - 202 - [[package]] 203 - name = "cortex-m-rt-macros" 204 - version = "0.7.5" 205 - source = "registry+https://github.com/rust-lang/crates.io-index" 206 - checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" 207 - dependencies = [ 208 - "proc-macro2", 209 - "quote", 210 - "syn 2.0.106", 211 - ] 212 - 213 - [[package]] 214 - name = "critical-section" 215 - version = "1.2.0" 216 - source = "registry+https://github.com/rust-lang/crates.io-index" 217 - checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 218 - 219 - [[package]] 220 - name = "darling" 221 - version = "0.20.11" 222 - source = "registry+https://github.com/rust-lang/crates.io-index" 223 - checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" 224 - dependencies = [ 225 - "darling_core", 226 - "darling_macro", 227 - ] 228 - 229 - [[package]] 230 - name = "darling_core" 231 - version = "0.20.11" 232 - source = "registry+https://github.com/rust-lang/crates.io-index" 233 - checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" 234 - dependencies = [ 235 - "fnv", 236 - "ident_case", 237 - "proc-macro2", 238 - "quote", 239 - "strsim", 240 - "syn 2.0.106", 241 - ] 242 - 243 - [[package]] 244 - name = "darling_macro" 245 - version = "0.20.11" 246 - source = "registry+https://github.com/rust-lang/crates.io-index" 247 - checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" 248 - dependencies = [ 249 - "darling_core", 250 - "quote", 251 - "syn 2.0.106", 252 - ] 253 - 254 - [[package]] 255 - name = "defmt" 256 - version = "0.3.100" 257 - source = "registry+https://github.com/rust-lang/crates.io-index" 258 - checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" 259 - dependencies = [ 260 - "defmt 1.0.1", 261 - ] 262 - 263 - [[package]] 264 - name = "defmt" 265 - version = "1.0.1" 266 - source = "registry+https://github.com/rust-lang/crates.io-index" 267 - checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" 268 - dependencies = [ 269 - "bitflags 1.3.2", 270 - "defmt-macros", 271 - ] 272 - 273 - [[package]] 274 - name = "defmt-macros" 275 - version = "1.0.1" 276 - source = "registry+https://github.com/rust-lang/crates.io-index" 277 - checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" 278 - dependencies = [ 279 - "defmt-parser", 280 - "proc-macro-error2", 281 - "proc-macro2", 282 - "quote", 283 - "syn 2.0.106", 284 - ] 285 - 286 - [[package]] 287 - name = "defmt-parser" 288 - version = "1.0.0" 289 - source = "registry+https://github.com/rust-lang/crates.io-index" 290 - checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" 291 - dependencies = [ 292 - "thiserror", 293 - ] 294 - 295 - [[package]] 296 - name = "defmt-rtt" 297 - version = "1.0.0" 298 - source = "registry+https://github.com/rust-lang/crates.io-index" 299 - checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" 300 - dependencies = [ 301 - "critical-section", 302 - "defmt 1.0.1", 303 - ] 304 - 305 - [[package]] 306 - name = "document-features" 307 - version = "0.2.11" 308 - source = "registry+https://github.com/rust-lang/crates.io-index" 309 - checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" 310 - dependencies = [ 311 - "litrs", 312 - ] 313 - 314 - [[package]] 315 - name = "embassy-embedded-hal" 316 - version = "0.5.0" 317 - source = "registry+https://github.com/rust-lang/crates.io-index" 318 - checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 319 - dependencies = [ 320 - "defmt 1.0.1", 321 - "embassy-futures", 322 - "embassy-hal-internal", 323 - "embassy-sync", 324 - "embassy-time", 325 - "embedded-hal 0.2.7", 326 - "embedded-hal 1.0.0", 327 - "embedded-hal-async", 328 - "embedded-storage", 329 - "embedded-storage-async", 330 - "nb 1.1.0", 331 - ] 332 - 333 - [[package]] 334 - name = "embassy-executor" 335 - version = "0.9.1" 336 - source = "registry+https://github.com/rust-lang/crates.io-index" 337 - checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 338 - dependencies = [ 339 - "cortex-m", 340 - "critical-section", 341 - "defmt 1.0.1", 342 - "document-features", 343 - "embassy-executor-macros", 344 - "embassy-executor-timer-queue", 345 - ] 346 - 347 - [[package]] 348 - name = "embassy-executor-macros" 349 - version = "0.7.0" 350 - source = "registry+https://github.com/rust-lang/crates.io-index" 351 - checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" 352 - dependencies = [ 353 - "darling", 354 - "proc-macro2", 355 - "quote", 356 - "syn 2.0.106", 357 - ] 358 - 359 - [[package]] 360 - name = "embassy-executor-timer-queue" 361 - version = "0.1.0" 362 - source = "registry+https://github.com/rust-lang/crates.io-index" 363 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 364 - 365 - [[package]] 366 - name = "embassy-futures" 367 - version = "0.1.2" 368 - source = "registry+https://github.com/rust-lang/crates.io-index" 369 - checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 370 - dependencies = [ 371 - "defmt 1.0.1", 372 - ] 373 - 374 - [[package]] 375 - name = "embassy-hal-internal" 376 - version = "0.3.0" 377 - source = "registry+https://github.com/rust-lang/crates.io-index" 378 - checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a" 379 - dependencies = [ 380 - "cortex-m", 381 - "critical-section", 382 - "defmt 1.0.1", 383 - "num-traits", 384 - ] 385 - 386 - [[package]] 387 - name = "embassy-net" 388 - version = "0.7.1" 389 - source = "registry+https://github.com/rust-lang/crates.io-index" 390 - checksum = "0558a231a47e7d4a06a28b5278c92e860f1200f24821d2f365a2f40fe3f3c7b2" 391 - dependencies = [ 392 - "defmt 1.0.1", 393 - "document-features", 394 - "embassy-net-driver", 395 - "embassy-sync", 396 - "embassy-time", 397 - "embedded-io-async", 398 - "embedded-nal-async", 399 - "heapless 0.8.0", 400 - "managed", 401 - "smoltcp", 402 - ] 403 - 404 - [[package]] 405 - name = "embassy-net-driver" 406 - version = "0.2.0" 407 - source = "registry+https://github.com/rust-lang/crates.io-index" 408 - checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" 409 - dependencies = [ 410 - "defmt 0.3.100", 411 - ] 412 - 413 - [[package]] 414 - name = "embassy-stm32" 415 - version = "0.4.0" 416 - source = "registry+https://github.com/rust-lang/crates.io-index" 417 - checksum = "0d972eab325cc96afee98f80a91ca6b00249b6356dc0fdbff68b70c200df9fae" 418 - dependencies = [ 419 - "aligned", 420 - "bit_field", 421 - "bitflags 2.9.3", 422 - "block-device-driver", 423 - "cfg-if", 424 - "cortex-m", 425 - "cortex-m-rt", 426 - "critical-section", 427 - "defmt 1.0.1", 428 - "document-features", 429 - "embassy-embedded-hal", 430 - "embassy-futures", 431 - "embassy-hal-internal", 432 - "embassy-net-driver", 433 - "embassy-sync", 434 - "embassy-time", 435 - "embassy-time-driver", 436 - "embassy-time-queue-utils", 437 - "embassy-usb-driver", 438 - "embassy-usb-synopsys-otg", 439 - "embedded-can", 440 - "embedded-hal 0.2.7", 441 - "embedded-hal 1.0.0", 442 - "embedded-hal-async", 443 - "embedded-hal-nb", 444 - "embedded-io", 445 - "embedded-io-async", 446 - "embedded-storage", 447 - "embedded-storage-async", 448 - "futures-util", 449 - "nb 1.1.0", 450 - "proc-macro2", 451 - "quote", 452 - "rand_core 0.6.4", 453 - "rand_core 0.9.3", 454 - "sdio-host", 455 - "static_assertions", 456 - "stm32-fmc", 457 - "stm32-metapac", 458 - "vcell", 459 - "volatile-register", 460 - ] 461 - 462 - [[package]] 463 - name = "embassy-sync" 464 - version = "0.7.2" 465 - source = "registry+https://github.com/rust-lang/crates.io-index" 466 - checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 467 - dependencies = [ 468 - "cfg-if", 469 - "critical-section", 470 - "defmt 1.0.1", 471 - "embedded-io-async", 472 - "futures-core", 473 - "futures-sink", 474 - "heapless 0.8.0", 475 - ] 476 - 477 - [[package]] 478 - name = "embassy-time" 479 - version = "0.5.0" 480 - source = "registry+https://github.com/rust-lang/crates.io-index" 481 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 482 - dependencies = [ 483 - "cfg-if", 484 - "critical-section", 485 - "defmt 1.0.1", 486 - "document-features", 487 - "embassy-time-driver", 488 - "embedded-hal 0.2.7", 489 - "embedded-hal 1.0.0", 490 - "embedded-hal-async", 491 - "futures-core", 492 - ] 493 - 494 - [[package]] 495 - name = "embassy-time-driver" 496 - version = "0.2.1" 497 - source = "registry+https://github.com/rust-lang/crates.io-index" 498 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 499 - dependencies = [ 500 - "document-features", 501 - ] 502 - 503 - [[package]] 504 - name = "embassy-time-queue-utils" 505 - version = "0.3.0" 506 - source = "registry+https://github.com/rust-lang/crates.io-index" 507 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 508 - dependencies = [ 509 - "embassy-executor-timer-queue", 510 - "heapless 0.8.0", 511 - ] 512 - 513 - [[package]] 514 - name = "embassy-usb-driver" 515 - version = "0.2.0" 516 - source = "registry+https://github.com/rust-lang/crates.io-index" 517 - checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" 518 - dependencies = [ 519 - "defmt 1.0.1", 520 - "embedded-io-async", 521 - ] 522 - 523 - [[package]] 524 - name = "embassy-usb-synopsys-otg" 525 - version = "0.3.1" 526 - source = "registry+https://github.com/rust-lang/crates.io-index" 527 - checksum = "288751f8eaa44a5cf2613f13cee0ca8e06e6638cb96e897e6834702c79084b23" 528 - dependencies = [ 529 - "critical-section", 530 - "defmt 1.0.1", 531 - "embassy-sync", 532 - "embassy-usb-driver", 533 - ] 534 - 535 - [[package]] 536 - name = "embedded-alloc" 537 - version = "0.6.0" 538 - source = "registry+https://github.com/rust-lang/crates.io-index" 539 - checksum = "8f2de9133f68db0d4627ad69db767726c99ff8585272716708227008d3f1bddd" 540 - dependencies = [ 541 - "const-default", 542 - "critical-section", 543 - "linked_list_allocator", 544 - "rlsf", 545 - ] 546 - 547 - [[package]] 548 - name = "embedded-can" 549 - version = "0.4.1" 550 - source = "registry+https://github.com/rust-lang/crates.io-index" 551 - checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" 552 - dependencies = [ 553 - "nb 1.1.0", 554 - ] 555 - 556 - [[package]] 557 - name = "embedded-hal" 558 - version = "0.2.7" 559 - source = "registry+https://github.com/rust-lang/crates.io-index" 560 - checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 561 - dependencies = [ 562 - "nb 0.1.3", 563 - "void", 564 - ] 565 - 566 - [[package]] 567 - name = "embedded-hal" 568 - version = "1.0.0" 569 - source = "registry+https://github.com/rust-lang/crates.io-index" 570 - checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" 571 - 572 - [[package]] 573 - name = "embedded-hal-async" 574 - version = "1.0.0" 575 - source = "registry+https://github.com/rust-lang/crates.io-index" 576 - checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" 577 - dependencies = [ 578 - "embedded-hal 1.0.0", 579 - ] 580 - 581 - [[package]] 582 - name = "embedded-hal-nb" 583 - version = "1.0.0" 584 - source = "registry+https://github.com/rust-lang/crates.io-index" 585 - checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" 586 - dependencies = [ 587 - "embedded-hal 1.0.0", 588 - "nb 1.1.0", 589 - ] 590 - 591 - [[package]] 592 - name = "embedded-io" 593 - version = "0.6.1" 594 - source = "registry+https://github.com/rust-lang/crates.io-index" 595 - checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" 596 - dependencies = [ 597 - "defmt 0.3.100", 598 - ] 599 - 600 - [[package]] 601 - name = "embedded-io-async" 602 - version = "0.6.1" 603 - source = "registry+https://github.com/rust-lang/crates.io-index" 604 - checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" 605 - dependencies = [ 606 - "defmt 0.3.100", 607 - "embedded-io", 608 - ] 609 - 610 - [[package]] 611 - name = "embedded-nal" 612 - version = "0.9.0" 613 - source = "registry+https://github.com/rust-lang/crates.io-index" 614 - checksum = "c56a28be191a992f28f178ec338a0bf02f63d7803244add736d026a471e6ed77" 615 - dependencies = [ 616 - "nb 1.1.0", 617 - ] 618 - 619 - [[package]] 620 - name = "embedded-nal-async" 621 - version = "0.8.0" 622 - source = "registry+https://github.com/rust-lang/crates.io-index" 623 - checksum = "76959917cd2b86f40a98c28dd5624eddd1fa69d746241c8257eac428d83cb211" 624 - dependencies = [ 625 - "embedded-io-async", 626 - "embedded-nal", 627 - ] 628 - 629 - [[package]] 630 - name = "embedded-storage" 631 - version = "0.3.1" 632 - source = "registry+https://github.com/rust-lang/crates.io-index" 633 - checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" 634 - 635 - [[package]] 636 - name = "embedded-storage-async" 637 - version = "0.4.1" 638 - source = "registry+https://github.com/rust-lang/crates.io-index" 639 - checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" 640 - dependencies = [ 641 - "embedded-storage", 642 - ] 643 - 644 - [[package]] 645 - name = "ergot" 646 - version = "0.11.0" 647 - dependencies = [ 648 - "bbq2", 649 - "cobs 0.3.0", 650 - "cobs-acc", 651 - "const-fnv1a-hash", 652 - "cordyceps", 653 - "critical-section", 654 - "defmt 1.0.1", 655 - "embassy-futures", 656 - "embassy-net", 657 - "heapless 0.9.1", 658 - "log", 659 - "maitake-sync", 660 - "mutex", 661 - "pin-project", 662 - "portable-atomic", 663 - "postcard", 664 - "postcard-schema", 665 - "serde", 666 - "static_cell", 667 - ] 668 - 669 - [[package]] 670 - name = "fnv" 671 - version = "1.0.7" 672 - source = "registry+https://github.com/rust-lang/crates.io-index" 673 - checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 674 - 675 - [[package]] 676 - name = "futures-core" 677 - version = "0.3.31" 678 - source = "registry+https://github.com/rust-lang/crates.io-index" 679 - checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 680 - 681 - [[package]] 682 - name = "futures-sink" 683 - version = "0.3.31" 684 - source = "registry+https://github.com/rust-lang/crates.io-index" 685 - checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 686 - 687 - [[package]] 688 - name = "futures-task" 689 - version = "0.3.31" 690 - source = "registry+https://github.com/rust-lang/crates.io-index" 691 - checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 692 - 693 - [[package]] 694 - name = "futures-util" 695 - version = "0.3.31" 696 - source = "registry+https://github.com/rust-lang/crates.io-index" 697 - checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 698 - dependencies = [ 699 - "futures-core", 700 - "futures-task", 701 - "pin-project-lite", 702 - "pin-utils", 703 - ] 704 - 705 - [[package]] 706 - name = "generator" 707 - version = "0.8.7" 708 - source = "registry+https://github.com/rust-lang/crates.io-index" 709 - checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" 710 - dependencies = [ 711 - "cc", 712 - "cfg-if", 713 - "libc", 714 - "log", 715 - "rustversion", 716 - "windows", 717 - ] 718 - 719 - [[package]] 720 - name = "hash32" 721 - version = "0.2.1" 722 - source = "registry+https://github.com/rust-lang/crates.io-index" 723 - checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 724 - dependencies = [ 725 - "byteorder", 726 - ] 727 - 728 - [[package]] 729 - name = "hash32" 730 - version = "0.3.1" 731 - source = "registry+https://github.com/rust-lang/crates.io-index" 732 - checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" 733 - dependencies = [ 734 - "byteorder", 735 - ] 736 - 737 - [[package]] 738 - name = "heapless" 739 - version = "0.7.17" 740 - source = "registry+https://github.com/rust-lang/crates.io-index" 741 - checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" 742 - dependencies = [ 743 - "atomic-polyfill", 744 - "hash32 0.2.1", 745 - "rustc_version 0.4.1", 746 - "serde", 747 - "spin", 748 - "stable_deref_trait", 749 - ] 750 - 751 - [[package]] 752 - name = "heapless" 753 - version = "0.8.0" 754 - source = "registry+https://github.com/rust-lang/crates.io-index" 755 - checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" 756 - dependencies = [ 757 - "defmt 0.3.100", 758 - "hash32 0.3.1", 759 - "stable_deref_trait", 760 - ] 761 - 762 - [[package]] 763 - name = "heapless" 764 - version = "0.9.1" 765 - source = "registry+https://github.com/rust-lang/crates.io-index" 766 - checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 767 - dependencies = [ 768 - "defmt 1.0.1", 769 - "hash32 0.3.1", 770 - "serde", 771 - "stable_deref_trait", 772 - ] 773 - 774 - [[package]] 775 - name = "ident_case" 776 - version = "1.0.1" 777 - source = "registry+https://github.com/rust-lang/crates.io-index" 778 - checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 779 - 780 - [[package]] 781 - name = "lazy_static" 782 - version = "1.5.0" 783 - source = "registry+https://github.com/rust-lang/crates.io-index" 784 - checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 785 - 786 - [[package]] 787 - name = "libc" 788 - version = "0.2.175" 789 - source = "registry+https://github.com/rust-lang/crates.io-index" 790 - checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" 791 - 792 - [[package]] 793 - name = "linked_list_allocator" 794 - version = "0.10.5" 795 - source = "registry+https://github.com/rust-lang/crates.io-index" 796 - checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" 797 - 798 - [[package]] 799 - name = "litrs" 800 - version = "0.4.2" 801 - source = "registry+https://github.com/rust-lang/crates.io-index" 802 - checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" 803 - 804 - [[package]] 805 - name = "lock_api" 806 - version = "0.4.14" 807 - source = "registry+https://github.com/rust-lang/crates.io-index" 808 - checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" 809 - dependencies = [ 810 - "scopeguard", 811 - ] 812 - 813 - [[package]] 814 - name = "log" 815 - version = "0.4.27" 816 - source = "registry+https://github.com/rust-lang/crates.io-index" 817 - checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" 818 - 819 - [[package]] 820 - name = "loom" 821 - version = "0.7.2" 822 - source = "registry+https://github.com/rust-lang/crates.io-index" 823 - checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" 824 - dependencies = [ 825 - "cfg-if", 826 - "generator", 827 - "scoped-tls", 828 - "tracing", 829 - "tracing-subscriber", 830 - ] 831 - 832 - [[package]] 833 - name = "maitake-sync" 834 - version = "0.2.2" 835 - source = "registry+https://github.com/rust-lang/crates.io-index" 836 - checksum = "748f86d9befd480b602c3bebc9ef30dbf2f3dfc8acc4a73d07b90f0117e6de3f" 837 - dependencies = [ 838 - "cordyceps", 839 - "loom", 840 - "mutex-traits", 841 - "mycelium-bitfield", 842 - "pin-project", 843 - "portable-atomic", 844 - "tracing", 845 - ] 846 - 847 - [[package]] 848 - name = "managed" 849 - version = "0.8.0" 850 - source = "registry+https://github.com/rust-lang/crates.io-index" 851 - checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" 852 - 853 - [[package]] 854 - name = "matchers" 855 - version = "0.1.0" 856 - source = "registry+https://github.com/rust-lang/crates.io-index" 857 - checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 858 - dependencies = [ 859 - "regex-automata 0.1.10", 860 - ] 861 - 862 - [[package]] 863 - name = "memchr" 864 - version = "2.7.5" 865 - source = "registry+https://github.com/rust-lang/crates.io-index" 866 - checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" 867 - 868 - [[package]] 869 - name = "mutex" 870 - version = "1.0.2" 871 - source = "registry+https://github.com/rust-lang/crates.io-index" 872 - checksum = "f23bf5944734b7a5d1bd0a9b594213dd04de471fd3d3a1bfce672913dd72d606" 873 - dependencies = [ 874 - "critical-section", 875 - "mutex-traits", 876 - ] 877 - 878 - [[package]] 879 - name = "mutex-traits" 880 - version = "1.0.1" 881 - source = "registry+https://github.com/rust-lang/crates.io-index" 882 - checksum = "3929f2b5633d29cf7b6624992e5f3c1e9334f1193423e12d17be4faf678cde3f" 883 - 884 - [[package]] 885 - name = "mycelium-bitfield" 886 - version = "0.1.5" 887 - source = "registry+https://github.com/rust-lang/crates.io-index" 888 - checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" 889 - 890 - [[package]] 891 - name = "nb" 892 - version = "0.1.3" 893 - source = "registry+https://github.com/rust-lang/crates.io-index" 894 - checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 895 - dependencies = [ 896 - "nb 1.1.0", 897 - ] 898 - 899 - [[package]] 900 - name = "nb" 901 - version = "1.1.0" 902 - source = "registry+https://github.com/rust-lang/crates.io-index" 903 - checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 904 - 905 - [[package]] 906 - name = "nu-ansi-term" 907 - version = "0.46.0" 908 - source = "registry+https://github.com/rust-lang/crates.io-index" 909 - checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 910 - dependencies = [ 911 - "overload", 912 - "winapi", 913 - ] 914 - 915 - [[package]] 916 - name = "nucleoh723zg-blinky" 917 - version = "0.1.0" 918 - dependencies = [ 919 - "cortex-m", 920 - "cortex-m-rt", 921 - "defmt 1.0.1", 922 - "defmt-rtt", 923 - "embassy-executor", 924 - "embassy-stm32", 925 - "embassy-time", 926 - "embedded-hal 1.0.0", 927 - "ergot", 928 - "heapless 0.9.1", 929 - "mutex", 930 - "panic-probe", 931 - ] 932 - 933 - [[package]] 934 - name = "nucleoh723zg-net-udp-pair" 935 - version = "0.1.0" 936 - dependencies = [ 937 - "bbq2", 938 - "cortex-m", 939 - "cortex-m-rt", 940 - "defmt 1.0.1", 941 - "defmt-rtt", 942 - "embassy-executor", 943 - "embassy-futures", 944 - "embassy-net", 945 - "embassy-stm32", 946 - "embassy-time", 947 - "embedded-alloc", 948 - "embedded-hal 1.0.0", 949 - "ergot", 950 - "heapless 0.9.1", 951 - "log", 952 - "mutex", 953 - "panic-probe", 954 - "postcard-schema", 955 - "serde", 956 - "static_cell", 957 - ] 958 - 959 - [[package]] 960 - name = "num-traits" 961 - version = "0.2.19" 962 - source = "registry+https://github.com/rust-lang/crates.io-index" 963 - checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 964 - dependencies = [ 965 - "autocfg", 966 - ] 967 - 968 - [[package]] 969 - name = "once_cell" 970 - version = "1.21.3" 971 - source = "registry+https://github.com/rust-lang/crates.io-index" 972 - checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 973 - 974 - [[package]] 975 - name = "overload" 976 - version = "0.1.1" 977 - source = "registry+https://github.com/rust-lang/crates.io-index" 978 - checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 979 - 980 - [[package]] 981 - name = "panic-probe" 982 - version = "1.0.0" 983 - source = "registry+https://github.com/rust-lang/crates.io-index" 984 - checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" 985 - dependencies = [ 986 - "cortex-m", 987 - "defmt 1.0.1", 988 - ] 989 - 990 - [[package]] 991 - name = "pin-project" 992 - version = "1.1.10" 993 - source = "registry+https://github.com/rust-lang/crates.io-index" 994 - checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" 995 - dependencies = [ 996 - "pin-project-internal", 997 - ] 998 - 999 - [[package]] 1000 - name = "pin-project-internal" 1001 - version = "1.1.10" 1002 - source = "registry+https://github.com/rust-lang/crates.io-index" 1003 - checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" 1004 - dependencies = [ 1005 - "proc-macro2", 1006 - "quote", 1007 - "syn 2.0.106", 1008 - ] 1009 - 1010 - [[package]] 1011 - name = "pin-project-lite" 1012 - version = "0.2.16" 1013 - source = "registry+https://github.com/rust-lang/crates.io-index" 1014 - checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 1015 - 1016 - [[package]] 1017 - name = "pin-utils" 1018 - version = "0.1.0" 1019 - source = "registry+https://github.com/rust-lang/crates.io-index" 1020 - checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1021 - 1022 - [[package]] 1023 - name = "portable-atomic" 1024 - version = "1.11.1" 1025 - source = "registry+https://github.com/rust-lang/crates.io-index" 1026 - checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" 1027 - 1028 - [[package]] 1029 - name = "postcard" 1030 - version = "1.1.3" 1031 - source = "registry+https://github.com/rust-lang/crates.io-index" 1032 - checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" 1033 - dependencies = [ 1034 - "cobs 0.3.0", 1035 - "heapless 0.7.17", 1036 - "serde", 1037 - ] 1038 - 1039 - [[package]] 1040 - name = "postcard-derive" 1041 - version = "0.2.2" 1042 - source = "registry+https://github.com/rust-lang/crates.io-index" 1043 - checksum = "e0232bd009a197ceec9cc881ba46f727fcd8060a2d8d6a9dde7a69030a6fe2bb" 1044 - dependencies = [ 1045 - "proc-macro2", 1046 - "quote", 1047 - "syn 2.0.106", 1048 - ] 1049 - 1050 - [[package]] 1051 - name = "postcard-schema" 1052 - version = "0.2.5" 1053 - source = "registry+https://github.com/rust-lang/crates.io-index" 1054 - checksum = "9475666d89f42231a0a57da32d5f6ca7f9b5cd4c335ea1fe8f3278215b7a21ff" 1055 - dependencies = [ 1056 - "heapless 0.9.1", 1057 - "postcard-derive", 1058 - "serde", 1059 - ] 1060 - 1061 - [[package]] 1062 - name = "proc-macro-error-attr2" 1063 - version = "2.0.0" 1064 - source = "registry+https://github.com/rust-lang/crates.io-index" 1065 - checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" 1066 - dependencies = [ 1067 - "proc-macro2", 1068 - "quote", 1069 - ] 1070 - 1071 - [[package]] 1072 - name = "proc-macro-error2" 1073 - version = "2.0.1" 1074 - source = "registry+https://github.com/rust-lang/crates.io-index" 1075 - checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" 1076 - dependencies = [ 1077 - "proc-macro-error-attr2", 1078 - "proc-macro2", 1079 - "quote", 1080 - "syn 2.0.106", 1081 - ] 1082 - 1083 - [[package]] 1084 - name = "proc-macro2" 1085 - version = "1.0.101" 1086 - source = "registry+https://github.com/rust-lang/crates.io-index" 1087 - checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" 1088 - dependencies = [ 1089 - "unicode-ident", 1090 - ] 1091 - 1092 - [[package]] 1093 - name = "quote" 1094 - version = "1.0.40" 1095 - source = "registry+https://github.com/rust-lang/crates.io-index" 1096 - checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" 1097 - dependencies = [ 1098 - "proc-macro2", 1099 - ] 1100 - 1101 - [[package]] 1102 - name = "rand_core" 1103 - version = "0.6.4" 1104 - source = "registry+https://github.com/rust-lang/crates.io-index" 1105 - checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1106 - 1107 - [[package]] 1108 - name = "rand_core" 1109 - version = "0.9.3" 1110 - source = "registry+https://github.com/rust-lang/crates.io-index" 1111 - checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 1112 - 1113 - [[package]] 1114 - name = "regex" 1115 - version = "1.11.2" 1116 - source = "registry+https://github.com/rust-lang/crates.io-index" 1117 - checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" 1118 - dependencies = [ 1119 - "aho-corasick", 1120 - "memchr", 1121 - "regex-automata 0.4.10", 1122 - "regex-syntax 0.8.6", 1123 - ] 1124 - 1125 - [[package]] 1126 - name = "regex-automata" 1127 - version = "0.1.10" 1128 - source = "registry+https://github.com/rust-lang/crates.io-index" 1129 - checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 1130 - dependencies = [ 1131 - "regex-syntax 0.6.29", 1132 - ] 1133 - 1134 - [[package]] 1135 - name = "regex-automata" 1136 - version = "0.4.10" 1137 - source = "registry+https://github.com/rust-lang/crates.io-index" 1138 - checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" 1139 - dependencies = [ 1140 - "aho-corasick", 1141 - "memchr", 1142 - "regex-syntax 0.8.6", 1143 - ] 1144 - 1145 - [[package]] 1146 - name = "regex-syntax" 1147 - version = "0.6.29" 1148 - source = "registry+https://github.com/rust-lang/crates.io-index" 1149 - checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 1150 - 1151 - [[package]] 1152 - name = "regex-syntax" 1153 - version = "0.8.6" 1154 - source = "registry+https://github.com/rust-lang/crates.io-index" 1155 - checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" 1156 - 1157 - [[package]] 1158 - name = "rlsf" 1159 - version = "0.2.1" 1160 - source = "registry+https://github.com/rust-lang/crates.io-index" 1161 - checksum = "222fb240c3286247ecdee6fa5341e7cdad0ffdf8e7e401d9937f2d58482a20bf" 1162 - dependencies = [ 1163 - "cfg-if", 1164 - "const-default", 1165 - "libc", 1166 - "svgbobdoc", 1167 - ] 1168 - 1169 - [[package]] 1170 - name = "rustc_version" 1171 - version = "0.2.3" 1172 - source = "registry+https://github.com/rust-lang/crates.io-index" 1173 - checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 1174 - dependencies = [ 1175 - "semver 0.9.0", 1176 - ] 1177 - 1178 - [[package]] 1179 - name = "rustc_version" 1180 - version = "0.4.1" 1181 - source = "registry+https://github.com/rust-lang/crates.io-index" 1182 - checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" 1183 - dependencies = [ 1184 - "semver 1.0.26", 1185 - ] 1186 - 1187 - [[package]] 1188 - name = "rustversion" 1189 - version = "1.0.22" 1190 - source = "registry+https://github.com/rust-lang/crates.io-index" 1191 - checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" 1192 - 1193 - [[package]] 1194 - name = "scoped-tls" 1195 - version = "1.0.1" 1196 - source = "registry+https://github.com/rust-lang/crates.io-index" 1197 - checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" 1198 - 1199 - [[package]] 1200 - name = "scopeguard" 1201 - version = "1.2.0" 1202 - source = "registry+https://github.com/rust-lang/crates.io-index" 1203 - checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1204 - 1205 - [[package]] 1206 - name = "sdio-host" 1207 - version = "0.9.0" 1208 - source = "registry+https://github.com/rust-lang/crates.io-index" 1209 - checksum = "b328e2cb950eeccd55b7f55c3a963691455dcd044cfb5354f0c5e68d2c2d6ee2" 1210 - 1211 - [[package]] 1212 - name = "semver" 1213 - version = "0.9.0" 1214 - source = "registry+https://github.com/rust-lang/crates.io-index" 1215 - checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 1216 - dependencies = [ 1217 - "semver-parser", 1218 - ] 1219 - 1220 - [[package]] 1221 - name = "semver" 1222 - version = "1.0.26" 1223 - source = "registry+https://github.com/rust-lang/crates.io-index" 1224 - checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" 1225 - 1226 - [[package]] 1227 - name = "semver-parser" 1228 - version = "0.7.0" 1229 - source = "registry+https://github.com/rust-lang/crates.io-index" 1230 - checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 1231 - 1232 - [[package]] 1233 - name = "serde" 1234 - version = "1.0.219" 1235 - source = "registry+https://github.com/rust-lang/crates.io-index" 1236 - checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" 1237 - dependencies = [ 1238 - "serde_derive", 1239 - ] 1240 - 1241 - [[package]] 1242 - name = "serde_derive" 1243 - version = "1.0.219" 1244 - source = "registry+https://github.com/rust-lang/crates.io-index" 1245 - checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" 1246 - dependencies = [ 1247 - "proc-macro2", 1248 - "quote", 1249 - "syn 2.0.106", 1250 - ] 1251 - 1252 - [[package]] 1253 - name = "sharded-slab" 1254 - version = "0.1.7" 1255 - source = "registry+https://github.com/rust-lang/crates.io-index" 1256 - checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" 1257 - dependencies = [ 1258 - "lazy_static", 1259 - ] 1260 - 1261 - [[package]] 1262 - name = "shlex" 1263 - version = "1.3.0" 1264 - source = "registry+https://github.com/rust-lang/crates.io-index" 1265 - checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1266 - 1267 - [[package]] 1268 - name = "smallvec" 1269 - version = "1.15.1" 1270 - source = "registry+https://github.com/rust-lang/crates.io-index" 1271 - checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" 1272 - 1273 - [[package]] 1274 - name = "smoltcp" 1275 - version = "0.12.0" 1276 - source = "registry+https://github.com/rust-lang/crates.io-index" 1277 - checksum = "dad095989c1533c1c266d9b1e8d70a1329dd3723c3edac6d03bbd67e7bf6f4bb" 1278 - dependencies = [ 1279 - "bitflags 1.3.2", 1280 - "byteorder", 1281 - "cfg-if", 1282 - "defmt 0.3.100", 1283 - "heapless 0.8.0", 1284 - "managed", 1285 - ] 1286 - 1287 - [[package]] 1288 - name = "spin" 1289 - version = "0.9.8" 1290 - source = "registry+https://github.com/rust-lang/crates.io-index" 1291 - checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 1292 - dependencies = [ 1293 - "lock_api", 1294 - ] 1295 - 1296 - [[package]] 1297 - name = "stable_deref_trait" 1298 - version = "1.2.0" 1299 - source = "registry+https://github.com/rust-lang/crates.io-index" 1300 - checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 1301 - 1302 - [[package]] 1303 - name = "static_assertions" 1304 - version = "1.1.0" 1305 - source = "registry+https://github.com/rust-lang/crates.io-index" 1306 - checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1307 - 1308 - [[package]] 1309 - name = "static_cell" 1310 - version = "2.1.1" 1311 - source = "registry+https://github.com/rust-lang/crates.io-index" 1312 - checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" 1313 - dependencies = [ 1314 - "portable-atomic", 1315 - ] 1316 - 1317 - [[package]] 1318 - name = "stm32-fmc" 1319 - version = "0.3.2" 1320 - source = "registry+https://github.com/rust-lang/crates.io-index" 1321 - checksum = "c7f0639399e2307c2446c54d91d4f1596343a1e1d5cab605b9cce11d0ab3858c" 1322 - dependencies = [ 1323 - "embedded-hal 0.2.7", 1324 - ] 1325 - 1326 - [[package]] 1327 - name = "stm32-metapac" 1328 - version = "18.0.0" 1329 - source = "registry+https://github.com/rust-lang/crates.io-index" 1330 - checksum = "6fd8ec3a292a0d9fc4798416a61b21da5ae50341b2e7b8d12e662bf305366097" 1331 - dependencies = [ 1332 - "cortex-m", 1333 - "cortex-m-rt", 1334 - "defmt 0.3.100", 1335 - ] 1336 - 1337 - [[package]] 1338 - name = "strsim" 1339 - version = "0.11.1" 1340 - source = "registry+https://github.com/rust-lang/crates.io-index" 1341 - checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1342 - 1343 - [[package]] 1344 - name = "svgbobdoc" 1345 - version = "0.3.0" 1346 - source = "registry+https://github.com/rust-lang/crates.io-index" 1347 - checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50" 1348 - dependencies = [ 1349 - "base64", 1350 - "proc-macro2", 1351 - "quote", 1352 - "syn 1.0.109", 1353 - "unicode-width", 1354 - ] 1355 - 1356 - [[package]] 1357 - name = "syn" 1358 - version = "1.0.109" 1359 - source = "registry+https://github.com/rust-lang/crates.io-index" 1360 - checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1361 - dependencies = [ 1362 - "proc-macro2", 1363 - "quote", 1364 - "unicode-ident", 1365 - ] 1366 - 1367 - [[package]] 1368 - name = "syn" 1369 - version = "2.0.106" 1370 - source = "registry+https://github.com/rust-lang/crates.io-index" 1371 - checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" 1372 - dependencies = [ 1373 - "proc-macro2", 1374 - "quote", 1375 - "unicode-ident", 1376 - ] 1377 - 1378 - [[package]] 1379 - name = "thiserror" 1380 - version = "2.0.16" 1381 - source = "registry+https://github.com/rust-lang/crates.io-index" 1382 - checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" 1383 - dependencies = [ 1384 - "thiserror-impl", 1385 - ] 1386 - 1387 - [[package]] 1388 - name = "thiserror-impl" 1389 - version = "2.0.16" 1390 - source = "registry+https://github.com/rust-lang/crates.io-index" 1391 - checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" 1392 - dependencies = [ 1393 - "proc-macro2", 1394 - "quote", 1395 - "syn 2.0.106", 1396 - ] 1397 - 1398 - [[package]] 1399 - name = "thread_local" 1400 - version = "1.1.9" 1401 - source = "registry+https://github.com/rust-lang/crates.io-index" 1402 - checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" 1403 - dependencies = [ 1404 - "cfg-if", 1405 - ] 1406 - 1407 - [[package]] 1408 - name = "tracing" 1409 - version = "0.1.41" 1410 - source = "registry+https://github.com/rust-lang/crates.io-index" 1411 - checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 1412 - dependencies = [ 1413 - "pin-project-lite", 1414 - "tracing-attributes", 1415 - "tracing-core", 1416 - ] 1417 - 1418 - [[package]] 1419 - name = "tracing-attributes" 1420 - version = "0.1.30" 1421 - source = "registry+https://github.com/rust-lang/crates.io-index" 1422 - checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" 1423 - dependencies = [ 1424 - "proc-macro2", 1425 - "quote", 1426 - "syn 2.0.106", 1427 - ] 1428 - 1429 - [[package]] 1430 - name = "tracing-core" 1431 - version = "0.1.34" 1432 - source = "registry+https://github.com/rust-lang/crates.io-index" 1433 - checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" 1434 - dependencies = [ 1435 - "once_cell", 1436 - "valuable", 1437 - ] 1438 - 1439 - [[package]] 1440 - name = "tracing-log" 1441 - version = "0.2.0" 1442 - source = "registry+https://github.com/rust-lang/crates.io-index" 1443 - checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" 1444 - dependencies = [ 1445 - "log", 1446 - "once_cell", 1447 - "tracing-core", 1448 - ] 1449 - 1450 - [[package]] 1451 - name = "tracing-subscriber" 1452 - version = "0.3.19" 1453 - source = "registry+https://github.com/rust-lang/crates.io-index" 1454 - checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" 1455 - dependencies = [ 1456 - "matchers", 1457 - "nu-ansi-term", 1458 - "once_cell", 1459 - "regex", 1460 - "sharded-slab", 1461 - "smallvec", 1462 - "thread_local", 1463 - "tracing", 1464 - "tracing-core", 1465 - "tracing-log", 1466 - ] 1467 - 1468 - [[package]] 1469 - name = "unicode-ident" 1470 - version = "1.0.18" 1471 - source = "registry+https://github.com/rust-lang/crates.io-index" 1472 - checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 1473 - 1474 - [[package]] 1475 - name = "unicode-width" 1476 - version = "0.1.14" 1477 - source = "registry+https://github.com/rust-lang/crates.io-index" 1478 - checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 1479 - 1480 - [[package]] 1481 - name = "valuable" 1482 - version = "0.1.1" 1483 - source = "registry+https://github.com/rust-lang/crates.io-index" 1484 - checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" 1485 - 1486 - [[package]] 1487 - name = "vcell" 1488 - version = "0.1.3" 1489 - source = "registry+https://github.com/rust-lang/crates.io-index" 1490 - checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 1491 - 1492 - [[package]] 1493 - name = "void" 1494 - version = "1.0.2" 1495 - source = "registry+https://github.com/rust-lang/crates.io-index" 1496 - checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 1497 - 1498 - [[package]] 1499 - name = "volatile-register" 1500 - version = "0.2.2" 1501 - source = "registry+https://github.com/rust-lang/crates.io-index" 1502 - checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" 1503 - dependencies = [ 1504 - "vcell", 1505 - ] 1506 - 1507 - [[package]] 1508 - name = "winapi" 1509 - version = "0.3.9" 1510 - source = "registry+https://github.com/rust-lang/crates.io-index" 1511 - checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1512 - dependencies = [ 1513 - "winapi-i686-pc-windows-gnu", 1514 - "winapi-x86_64-pc-windows-gnu", 1515 - ] 1516 - 1517 - [[package]] 1518 - name = "winapi-i686-pc-windows-gnu" 1519 - version = "0.4.0" 1520 - source = "registry+https://github.com/rust-lang/crates.io-index" 1521 - checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1522 - 1523 - [[package]] 1524 - name = "winapi-x86_64-pc-windows-gnu" 1525 - version = "0.4.0" 1526 - source = "registry+https://github.com/rust-lang/crates.io-index" 1527 - checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1528 - 1529 - [[package]] 1530 - name = "windows" 1531 - version = "0.61.3" 1532 - source = "registry+https://github.com/rust-lang/crates.io-index" 1533 - checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" 1534 - dependencies = [ 1535 - "windows-collections", 1536 - "windows-core", 1537 - "windows-future", 1538 - "windows-link", 1539 - "windows-numerics", 1540 - ] 1541 - 1542 - [[package]] 1543 - name = "windows-collections" 1544 - version = "0.2.0" 1545 - source = "registry+https://github.com/rust-lang/crates.io-index" 1546 - checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" 1547 - dependencies = [ 1548 - "windows-core", 1549 - ] 1550 - 1551 - [[package]] 1552 - name = "windows-core" 1553 - version = "0.61.2" 1554 - source = "registry+https://github.com/rust-lang/crates.io-index" 1555 - checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" 1556 - dependencies = [ 1557 - "windows-implement", 1558 - "windows-interface", 1559 - "windows-link", 1560 - "windows-result", 1561 - "windows-strings", 1562 - ] 1563 - 1564 - [[package]] 1565 - name = "windows-future" 1566 - version = "0.2.1" 1567 - source = "registry+https://github.com/rust-lang/crates.io-index" 1568 - checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" 1569 - dependencies = [ 1570 - "windows-core", 1571 - "windows-link", 1572 - "windows-threading", 1573 - ] 1574 - 1575 - [[package]] 1576 - name = "windows-implement" 1577 - version = "0.60.0" 1578 - source = "registry+https://github.com/rust-lang/crates.io-index" 1579 - checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" 1580 - dependencies = [ 1581 - "proc-macro2", 1582 - "quote", 1583 - "syn 2.0.106", 1584 - ] 1585 - 1586 - [[package]] 1587 - name = "windows-interface" 1588 - version = "0.59.1" 1589 - source = "registry+https://github.com/rust-lang/crates.io-index" 1590 - checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" 1591 - dependencies = [ 1592 - "proc-macro2", 1593 - "quote", 1594 - "syn 2.0.106", 1595 - ] 1596 - 1597 - [[package]] 1598 - name = "windows-link" 1599 - version = "0.1.3" 1600 - source = "registry+https://github.com/rust-lang/crates.io-index" 1601 - checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" 1602 - 1603 - [[package]] 1604 - name = "windows-numerics" 1605 - version = "0.2.0" 1606 - source = "registry+https://github.com/rust-lang/crates.io-index" 1607 - checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" 1608 - dependencies = [ 1609 - "windows-core", 1610 - "windows-link", 1611 - ] 1612 - 1613 - [[package]] 1614 - name = "windows-result" 1615 - version = "0.3.4" 1616 - source = "registry+https://github.com/rust-lang/crates.io-index" 1617 - checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" 1618 - dependencies = [ 1619 - "windows-link", 1620 - ] 1621 - 1622 - [[package]] 1623 - name = "windows-strings" 1624 - version = "0.4.2" 1625 - source = "registry+https://github.com/rust-lang/crates.io-index" 1626 - checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" 1627 - dependencies = [ 1628 - "windows-link", 1629 - ] 1630 - 1631 - [[package]] 1632 - name = "windows-threading" 1633 - version = "0.1.0" 1634 - source = "registry+https://github.com/rust-lang/crates.io-index" 1635 - checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" 1636 - dependencies = [ 1637 - "windows-link", 1638 - ]
···
-50
demos/stm32h723zg/Cargo.toml
··· 1 - [workspace] 2 - members = [ 3 - "nucleoh723zg-blinky", 4 - "nucleoh723zg-net-udp-pair", 5 - ] 6 - resolver = "2" 7 - 8 - [workspace.dependencies] 9 - ergot = { path = "../../crates/ergot", features = ["embassy-net-v0_7"] } 10 - 11 - cortex-m-rt = "0.7.0" 12 - defmt = "1.0.1" 13 - defmt-rtt = "1.0.0" 14 - embedded-hal = "1.0.0" 15 - mutex = "1.0.2" 16 - static_cell = "2.1.1" 17 - embedded-alloc = "0.6.0" 18 - 19 - bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 20 - 21 - cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 22 - embassy-executor = { version = "0.9.1", features = ["defmt", "arch-cortex-m", "executor-thread", "executor-interrupt"] } 23 - embassy-stm32 = { version = "0.4.0", features = ["defmt", "stm32h723zg", "unstable-pac", "memory-x", "time-driver-tim2", "exti", "memory-x"] } 24 - embassy-time = { version = "0.5.0", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 25 - embassy-net = { version = "0.7.1", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet", "dns", "proto-ipv4", "proto-ipv6"] } 26 - embassy-futures = { version = "0.1.2", features = ["defmt"] } 27 - heapless = { version = "0.9", default-features = false } 28 - panic-probe = { version = "1.0.0", features = ["print-defmt"] } 29 - postcard-schema = { version = "0.2.5", features = ["derive"] } 30 - serde = { version = "1.0.219", default-features = false, features = ["derive"] } 31 - 32 - [profile.release] 33 - debug = 2 34 - lto = true 35 - opt-level = 0 36 - codegen-units = 1 37 - incremental = false 38 - panic = "abort" 39 - 40 - [profile.ci] 41 - inherits = "dev" 42 - debug = false 43 - strip = true 44 - debug-assertions = true 45 - overflow-checks = true 46 - lto = false 47 - panic = 'unwind' 48 - incremental = false 49 - codegen-units = 256 50 - rpath = false
···
-106
demos/stm32h723zg/memory.x
··· 1 - MEMORY 2 - { 3 - /* This file is intended for parts in the STM32H723 family. (RM0468) */ 4 - /* - FLASH and RAM are mandatory memory sections. */ 5 - /* - The sum of all non-FLASH sections must add to 564k total device RAM. */ 6 - /* - The FLASH section size must match your device, see table below. */ 7 - 8 - /* FLASH */ 9 - /* Select the appropriate FLASH size for your device. */ 10 - /* - STM32H730xB 128K */ 11 - /* - STM32H723xE/725xE 512K */ 12 - /* - STM32H723xG/725xG/733xG/735xG 1M */ 13 - FLASH1 : ORIGIN = 0x08000000, LENGTH = 1M 14 - 15 - /* Data TCM */ 16 - /* - Two contiguous 64KB RAMs. */ 17 - /* - Used for interrupt handlers, stacks and general RAM. */ 18 - /* - Zero wait-states. */ 19 - /* - The DTCM is taken as the origin of the base ram. (See below.) */ 20 - /* This is also where the interrupt table and such will live, */ 21 - /* which is required for deterministic performance. */ 22 - DTCM : ORIGIN = 0x20000000, LENGTH = 128K 23 - 24 - /* Instruction TCM */ 25 - /* - More memory can be assigned to ITCM. See AXI SRAM notes, below. */ 26 - /* - Used for latency-critical interrupt handlers etc. */ 27 - /* - Zero wait-states. */ 28 - ITCM : ORIGIN = 0x00000000, LENGTH = 64K + 0K 29 - 30 - /* AXI SRAM */ 31 - /* - AXISRAM is in D1 and accessible by all system masters except BDMA. */ 32 - /* - Suitable for application data not stored in DTCM. */ 33 - /* - Zero wait-states. */ 34 - /* - The 192k of extra shared RAM is fully allotted to the AXI SRAM by default. */ 35 - /* As a result: 64k (64k + 0k) for ITCM and 320k (128k + 192k) for AXI SRAM. */ 36 - /* This can be re-configured via the TCM_AXI_SHARED[1,0] register when more */ 37 - /* ITCM is required. */ 38 - AXISRAM : ORIGIN = 0x24000000, LENGTH = 128K + 192K 39 - 40 - /* AHB SRAM */ 41 - /* - SRAM1-2 are in D2 and accessible by all system masters except BDMA, LTDC */ 42 - /* and SDMMC1. Suitable for use as DMA buffers. */ 43 - /* - SRAM4 is in D3 and additionally accessible by the BDMA. Used for BDMA */ 44 - /* buffers, for storing application data in lower-power modes. */ 45 - /* - Zero wait-states. */ 46 - SRAM1 : ORIGIN = 0x30000000, LENGTH = 16K 47 - SRAM2 : ORIGIN = 0x30040000, LENGTH = 16K 48 - SRAM4 : ORIGIN = 0x38000000, LENGTH = 16K 49 - 50 - /* Backup SRAM */ 51 - /* Used to store data during low-power sleeps. */ 52 - BSRAM : ORIGIN = 0x38800000, LENGTH = 4K 53 - } 54 - 55 - /* 56 - /* Assign the memory regions defined above for use. */ 57 - /* 58 - 59 - /* Provide the mandatory FLASH and RAM definitions for cortex-m-rt's linker script. */ 60 - REGION_ALIAS(FLASH, FLASH1); 61 - REGION_ALIAS(RAM, AXISRAM); 62 - 63 - /* The location of the stack can be overridden using the `_stack_start` symbol. */ 64 - /* - Set the stack location at the end of RAM, using all remaining space. */ 65 - _stack_start = ORIGIN(RAM) + LENGTH(RAM); 66 - 67 - /* The location of the .text section can be overridden using the */ 68 - /* `_stext` symbol. By default it will place after .vector_table. */ 69 - /* _stext = ORIGIN(FLASH) + 0x40c; */ 70 - 71 - /* Define sections for placing symbols into the extra memory regions above. */ 72 - /* This makes them accessible from code. */ 73 - /* - ITCM, DTCM and AXISRAM connect to a 64-bit wide bus -> align to 8 bytes. */ 74 - /* - All other memories connect to a 32-bit wide bus -> align to 4 bytes. */ 75 - SECTIONS { 76 - .itcm (NOLOAD) : ALIGN(8) { 77 - *(.itcm .itcm.*); 78 - . = ALIGN(8); 79 - } > ITCM 80 - 81 - .axisram (NOLOAD) : ALIGN(8) { 82 - *(.axisram .axisram.*); 83 - . = ALIGN(8); 84 - } > AXISRAM 85 - 86 - .sram1 (NOLOAD) : ALIGN(4) { 87 - *(.sram1 .sram1.*); 88 - . = ALIGN(4); 89 - } > SRAM1 90 - 91 - .sram2 (NOLOAD) : ALIGN(4) { 92 - *(.sram2 .sram2.*); 93 - . = ALIGN(4); 94 - } > SRAM2 95 - 96 - .sram4 (NOLOAD) : ALIGN(4) { 97 - *(.sram4 .sram4.*); 98 - . = ALIGN(4); 99 - } > SRAM4 100 - 101 - .bsram (NOLOAD) : ALIGN(4) { 102 - *(.bsram .bsram.*); 103 - . = ALIGN(4); 104 - } > BSRAM 105 - 106 - };
···
-18
demos/stm32h723zg/nucleoh723zg-blinky/Cargo.toml
··· 1 - [package] 2 - name = "nucleoh723zg-blinky" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cortex-m-rt.workspace = true 8 - cortex-m.workspace = true 9 - defmt-rtt.workspace = true 10 - defmt.workspace = true 11 - embassy-executor.workspace = true 12 - embassy-stm32.workspace = true 13 - embassy-time.workspace = true 14 - embedded-hal.workspace = true 15 - ergot.workspace = true 16 - heapless.workspace = true 17 - mutex.workspace = true 18 - panic-probe.workspace = true
···
-25
demos/stm32h723zg/nucleoh723zg-blinky/build.rs
··· 1 - use std::env; 2 - use std::fs::File; 3 - use std::io::Write; 4 - use std::path::PathBuf; 5 - 6 - fn main() { 7 - // Put `memory.x` in our output directory and ensure it's 8 - // on the linker search path. 9 - let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); 10 - File::create(out.join("memory.x")) 11 - .unwrap() 12 - .write_all(include_bytes!("../memory.x")) 13 - .unwrap(); 14 - println!("cargo:rustc-link-search={}", out.display()); 15 - 16 - // By default, Cargo will re-run a build script whenever 17 - // any file in the project changes. By specifying `memory.x` 18 - // here, we ensure the build script is only re-run when 19 - // `memory.x` is changed. 20 - println!("cargo:rerun-if-changed=memory.x"); 21 - 22 - println!("cargo:rustc-link-arg-bins=--nmagic"); 23 - println!("cargo:rustc-link-arg-bins=-Tlink.x"); 24 - println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); 25 - }
···
-56
demos/stm32h723zg/nucleoh723zg-blinky/src/main.rs
··· 1 - #![no_std] 2 - #![no_main] 3 - 4 - use core::pin::pin; 5 - 6 - use embassy_executor::{Spawner, task}; 7 - use embassy_stm32::gpio::{Level, Output, Speed}; 8 - use embassy_time::{Duration, Ticker}; 9 - use ergot::{Address, NetStack, endpoint, interface_manager::profiles::null::Null}; 10 - use mutex::raw_impls::cs::CriticalSectionRawMutex; 11 - use {defmt_rtt as _, panic_probe as _}; 12 - 13 - pub static STACK: NetStack<CriticalSectionRawMutex, Null> = NetStack::new(); 14 - 15 - // Define some endpoints 16 - endpoint!(LedEndpoint, bool, (), "led/set"); 17 - 18 - #[embassy_executor::main] 19 - async fn main(spawner: Spawner) { 20 - let p = embassy_stm32::init(Default::default()); 21 - 22 - spawner.must_spawn(led_server(Output::new(p.PB14, Level::High, Speed::Low))); 23 - 24 - let mut ticker = Ticker::every(Duration::from_millis(500)); 25 - let client = STACK 26 - .endpoints() 27 - .client::<LedEndpoint>(Address::unknown(), Some("led")); 28 - loop { 29 - ticker.next().await; 30 - let _ = client.request(&true).await; 31 - ticker.next().await; 32 - let _ = client.request(&false).await; 33 - } 34 - } 35 - 36 - #[task] 37 - async fn led_server(mut led: Output<'static>) { 38 - let socket = STACK 39 - .endpoints() 40 - .bounded_server::<LedEndpoint, 2>(Some("led")); 41 - let socket = pin!(socket); 42 - let mut hdl = socket.attach(); 43 - 44 - loop { 45 - let _ = hdl 46 - .serve(async |on| { 47 - defmt::info!("LED set {=bool}", *on); 48 - if *on { 49 - led.set_low(); 50 - } else { 51 - led.set_high(); 52 - } 53 - }) 54 - .await; 55 - } 56 - }
···
-26
demos/stm32h723zg/nucleoh723zg-net-udp-pair/Cargo.toml
··· 1 - [package] 2 - name = "nucleoh723zg-net-udp-pair" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cortex-m-rt.workspace = true 8 - cortex-m.workspace = true 9 - defmt-rtt.workspace = true 10 - defmt.workspace = true 11 - embassy-executor.workspace = true 12 - embassy-stm32.workspace = true 13 - embassy-time.workspace = true 14 - embassy-net.workspace = true 15 - embassy-futures.workspace = true 16 - embedded-hal.workspace = true 17 - ergot.workspace = true 18 - heapless.workspace = true 19 - mutex.workspace = true 20 - panic-probe.workspace = true 21 - postcard-schema.workspace = true 22 - serde.workspace = true 23 - static_cell.workspace = true 24 - bbq2.workspace = true 25 - log = "0.4.27" 26 - embedded-alloc.workspace = true
···
-25
demos/stm32h723zg/nucleoh723zg-net-udp-pair/build.rs
··· 1 - use std::env; 2 - use std::fs::File; 3 - use std::io::Write; 4 - use std::path::PathBuf; 5 - 6 - fn main() { 7 - // Put `memory.x` in our output directory and ensure it's 8 - // on the linker search path. 9 - let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); 10 - File::create(out.join("memory.x")) 11 - .unwrap() 12 - .write_all(include_bytes!("../memory.x")) 13 - .unwrap(); 14 - println!("cargo:rustc-link-search={}", out.display()); 15 - 16 - // By default, Cargo will re-run a build script whenever 17 - // any file in the project changes. By specifying `memory.x` 18 - // here, we ensure the build script is only re-run when 19 - // `memory.x` is changed. 20 - println!("cargo:rerun-if-changed=memory.x"); 21 - 22 - println!("cargo:rustc-link-arg-bins=--nmagic"); 23 - println!("cargo:rustc-link-arg-bins=-Tlink.x"); 24 - println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); 25 - }
···
-360
demos/stm32h723zg/nucleoh723zg-net-udp-pair/src/bin/controller.rs
··· 1 - #![no_std] 2 - #![no_main] 3 - extern crate alloc; 4 - 5 - use alloc::boxed::Box; 6 - use core::pin::pin; 7 - 8 - use defmt::*; 9 - use embassy_executor::Spawner; 10 - use embassy_net::StackResources; 11 - use embassy_net::udp::{PacketMetadata, UdpSocket}; 12 - use embassy_net::{IpEndpoint, Ipv4Address}; 13 - use embassy_stm32::eth::PacketQueue; 14 - use embassy_stm32::eth::{Ethernet, GenericPhy}; 15 - use embassy_stm32::pac::rcc::vals::{Pllm, Plln, Pllsrc}; 16 - use embassy_stm32::peripherals::ETH; 17 - use embassy_stm32::rcc::mux::{ 18 - Fdcansel, I2c4sel, I2c1235sel, Saisel, Sdmmcsel, Spi6sel, Spi45sel, Usart16910sel, Usart234578sel, Usbsel, 19 - }; 20 - use embassy_stm32::rcc::{AHBPrescaler, APBPrescaler, LsConfig, PllDiv, Sysclk}; 21 - use embassy_stm32::rng::Rng; 22 - use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rcc, rng}; 23 - use embassy_time::{Duration, Ticker, Timer, WithTimeout}; 24 - use embedded_alloc::LlffHeap as Heap; 25 - use ergot::exports::bbq2::traits::coordination::cas::AtomicCoord; 26 - use ergot::interface_manager::profiles::direct_edge::embassy_net_udp_0_7::{RxTxWorker, UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX, UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX}; 27 - use ergot::logging::log_v0_4::LogSink; 28 - use ergot::toolkits::embassy_net_v0_7 as kit; 29 - use ergot::well_known::ErgotPingEndpoint; 30 - use ergot::{Address, topic}; 31 - use mutex::raw_impls::cs::CriticalSectionRawMutex; 32 - use static_cell::{ConstStaticCell, StaticCell}; 33 - use {defmt_rtt as _, panic_probe as _}; 34 - 35 - const OUT_QUEUE_SIZE: usize = 4096; 36 - 37 - type Stack = kit::EdgeStack<&'static Queue, CriticalSectionRawMutex>; 38 - type Queue = kit::Queue<OUT_QUEUE_SIZE, AtomicCoord>; 39 - 40 - /// Statically store our netstack 41 - static STACK: Stack = kit::new_controller_stack(OUTQ.framed_producer(), UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX as u16); 42 - /// Statically store our outgoing packet buffer 43 - static OUTQ: Queue = kit::Queue::new(); 44 - /// Statically store receive buffers 45 - static SCRATCH_BUF: ConstStaticCell<[u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]> = ConstStaticCell::new([0u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]); 46 - 47 - static LOGSINK: LogSink<&'static Stack> = LogSink::new(&STACK); 48 - 49 - #[global_allocator] 50 - static HEAP: Heap = Heap::empty(); 51 - 52 - bind_interrupts!(struct Irqs { 53 - ETH => eth::InterruptHandler; 54 - RNG => rng::InterruptHandler<peripherals::RNG>; 55 - }); 56 - 57 - #[embassy_executor::main] 58 - async fn main(spawner: Spawner) -> ! { 59 - let mut config = Config::default(); 60 - config.rcc.hse = Some(rcc::Hse { 61 - freq: embassy_stm32::time::Hertz(8_000_000), 62 - mode: rcc::HseMode::Oscillator, 63 - }); 64 - config.rcc.ls = LsConfig::off(); 65 - config.rcc.hsi48 = Some(Default::default()); // needed for RNG 66 - config.rcc.sys = Sysclk::PLL1_P; 67 - config.rcc.d1c_pre = AHBPrescaler::DIV1; 68 - config.rcc.ahb_pre = AHBPrescaler::DIV2; 69 - config.rcc.apb1_pre = APBPrescaler::DIV2; 70 - config.rcc.apb2_pre = APBPrescaler::DIV2; 71 - config.rcc.apb3_pre = APBPrescaler::DIV2; 72 - config.rcc.apb4_pre = APBPrescaler::DIV2; 73 - config.rcc.timer_prescaler = rcc::TimerPrescaler::DefaultX2; 74 - 75 - config.rcc.voltage_scale = rcc::VoltageScale::Scale0; 76 - config.rcc.pll1 = Some(rcc::Pll { 77 - source: Pllsrc::HSE, 78 - prediv: Pllm::DIV4, 79 - mul: Plln::MUL260, 80 - // 520Mhz 81 - divp: Some(PllDiv::DIV1), 82 - // 130Mhz 83 - divq: Some(PllDiv::DIV4), 84 - divr: None, 85 - }); 86 - config.rcc.pll2 = Some(rcc::Pll { 87 - source: Pllsrc::HSE, 88 - 89 - prediv: Pllm::DIV4, 90 - mul: Plln::MUL200, 91 - // 200Mhz 92 - divp: Some(PllDiv::DIV2), 93 - // 100Mhz 94 - divq: Some(PllDiv::DIV4), 95 - // 200Mhz 96 - divr: Some(PllDiv::DIV2), 97 - }); 98 - config.rcc.pll3 = Some(rcc::Pll { 99 - source: Pllsrc::HSE, 100 - prediv: Pllm::DIV4, 101 - mul: Plln::MUL192, 102 - // 192Mhz 103 - divp: Some(PllDiv::DIV2), 104 - // 48Mhz 105 - divq: Some(PllDiv::DIV8), 106 - // 92Mhz 107 - divr: Some(PllDiv::DIV4), 108 - }); 109 - 110 - // 200mhz 111 - //config.rcc.mux.octospisel = Octospisel::PLL2_R; // no support in embassy-stm32 it seems. 112 - 113 - // 200mhz 114 - config.rcc.mux.sdmmcsel = Sdmmcsel::PLL2_R; 115 - // 100mhz 116 - config.rcc.mux.fdcansel = Fdcansel::PLL2_Q; 117 - // 48mhz from crystal (not RC48) 118 - config.rcc.mux.usbsel = Usbsel::PLL3_Q; 119 - // 100mhz 120 - config.rcc.mux.usart234578sel = Usart234578sel::PLL2_Q; 121 - // 100mhz 122 - config.rcc.mux.usart16910sel = Usart16910sel::PLL2_Q; 123 - // 130mhz 124 - config.rcc.mux.i2c1235sel = I2c1235sel::PCLK1; 125 - // 130mhz 126 - config.rcc.mux.i2c4sel = I2c4sel::PCLK4; 127 - // 200mhz 128 - config.rcc.mux.spi123sel = Saisel::PLL2_P; 129 - // 100mhz 130 - config.rcc.mux.spi45sel = Spi45sel::PLL2_Q; 131 - // 100mhz 132 - config.rcc.mux.spi6sel = Spi6sel::PLL2_Q; 133 - 134 - let p = embassy_stm32::init(config); 135 - 136 - init_heap(); 137 - 138 - // Generate random seed. 139 - info!("Initializing RNG"); 140 - let mut rng = Rng::new(p.RNG, Irqs); 141 - let mut seed = [0; 8]; 142 - rng.fill_bytes(&mut seed); 143 - let seed = u64::from_le_bytes(seed); 144 - 145 - info!("Initializing ETH"); 146 - // TODO generate mac address from CPU ID 147 - // potentially using this algorythm (C): https://github.com/zephyrproject-rtos/zephyr/issues/59993#issuecomment-1644030438 148 - let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; 149 - 150 - static PACKETS: StaticCell<PacketQueue<8, 8>> = StaticCell::new(); 151 - // warning: Not all STM32H7 devices have the exact same pins here 152 - // for STM32H747XIH, replace p.PB13 for PG12 153 - let device = Ethernet::new( 154 - PACKETS.init(PacketQueue::<8, 8>::new()), 155 - p.ETH, 156 - Irqs, 157 - p.PA1, // ref_clk 158 - p.PA2, // mdio 159 - p.PC1, // eth_mdc 160 - p.PA7, // CRS_DV: Carrier Sense 161 - p.PC4, // RX_D0: Received Bit 0 162 - p.PC5, // RX_D1: Received Bit 1 163 - p.PG13, // TX_D0: Transmit Bit 0 164 - p.PB13, // TX_D1: Transmit Bit 1 165 - p.PG11, // TX_EN: Transmit Enable 166 - GenericPhy::new_auto(), 167 - mac_addr, 168 - ); 169 - 170 - let config = embassy_net::Config::dhcpv4(Default::default()); 171 - //let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { 172 - // address: Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), 173 - // dns_servers: Vec::new(), 174 - // gateway: Some(Ipv4Address::new(10, 42, 0, 1)), 175 - //}); 176 - 177 - // Init network stack 178 - static RESOURCES: StaticCell<StackResources<5>> = StaticCell::new(); 179 - let (embassy_net_stack, runner) = embassy_net::new(device, config, RESOURCES.init(StackResources::new()), seed); 180 - 181 - // Launch network task 182 - spawner.must_spawn(embassy_net_task(runner)); 183 - 184 - // Ensure DHCP configuration is up before trying connect 185 - let mut attempts: u32 = 0; 186 - let config = loop { 187 - if let Some(config) = embassy_net_stack.config_v4() { 188 - break config; 189 - } 190 - 191 - if attempts % 10 == 0 { 192 - info!("Waiting for DHCP address allocation..."); 193 - } 194 - 195 - attempts = attempts.wrapping_add(1); 196 - Timer::after(Duration::from_millis(100)).await; 197 - }; 198 - 199 - info!( 200 - "IP address: {}, gateway: {}, dns: {}", 201 - config.address, config.dns_servers, config.gateway 202 - ); 203 - 204 - let rx_meta = [PacketMetadata::EMPTY; 1]; 205 - let rx_buffer = [0; 4096]; 206 - let tx_meta = [PacketMetadata::EMPTY; 1]; 207 - let tx_buffer = [0; 4096]; 208 - 209 - // move the buffers into the heap, so they don't get dropped 210 - let rx_meta = Box::new(rx_meta); 211 - let rx_meta = Box::leak(rx_meta); 212 - let tx_meta = Box::new(tx_meta); 213 - let tx_meta = Box::leak(tx_meta); 214 - let rx_buffer = Box::new(rx_buffer); 215 - let rx_buffer = Box::leak(rx_buffer); 216 - let tx_buffer = Box::new(tx_buffer); 217 - let tx_buffer = Box::leak(tx_buffer); 218 - // You need to start a server on the host machine, for example: `nc -lu 8000` 219 - 220 - let mut socket = UdpSocket::new(embassy_net_stack, rx_meta, rx_buffer, tx_meta, tx_buffer); 221 - 222 - let port = 8000_u16; 223 - let remote_endpoint = IpEndpoint::new(Ipv4Address::new(192, 168, 18, 65).into(), port); 224 - let local_endpoint = IpEndpoint::new(config.address.address().into(), port); 225 - socket 226 - .bind(local_endpoint) 227 - .expect("bound"); 228 - 229 - info!( 230 - "capacity, receive: {}, send: {}", 231 - socket.packet_recv_capacity(), 232 - socket.packet_send_capacity() 233 - ); 234 - 235 - // Spawn I/O worker tasks 236 - spawner.must_spawn(run_socket(socket, SCRATCH_BUF.take(), remote_endpoint)); 237 - 238 - // Spawn socket using tasks 239 - spawner.must_spawn(pingserver()); 240 - spawner.must_spawn(pinger()); 241 - 242 - spawner.must_spawn(yeeter()); 243 - spawner.must_spawn(yeet_listener(0)); 244 - 245 - LOGSINK.register_static(log::LevelFilter::Info); 246 - 247 - let mut tckr = Ticker::every(Duration::from_secs(2)); 248 - let mut ct = 0; 249 - loop { 250 - tckr.next().await; 251 - log::info!("log # {ct}"); 252 - ct += 1; 253 - } 254 - } 255 - 256 - type Device = Ethernet<'static, ETH, GenericPhy>; 257 - 258 - #[embassy_executor::task] 259 - async fn embassy_net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { 260 - runner.run().await 261 - } 262 - 263 - #[embassy_executor::task] 264 - async fn run_socket( 265 - socket: UdpSocket<'static>, 266 - scratch_buf: &'static mut [u8], 267 - endpoint: IpEndpoint, 268 - ) { 269 - let consumer = OUTQ.framed_consumer(); 270 - let mut rxtx = RxTxWorker::new_controller(&STACK, socket, (), consumer, endpoint); 271 - 272 - loop { 273 - _ = rxtx.run(scratch_buf).await; 274 - } 275 - } 276 - 277 - #[embassy_executor::task] 278 - async fn pinger() { 279 - let mut ticker = Ticker::every(Duration::from_secs(1)); 280 - let mut ctr = 0u32; 281 - let client = STACK 282 - .endpoints() 283 - .client::<ErgotPingEndpoint>( 284 - Address { 285 - network_id: 1, 286 - node_id: 2, 287 - port_id: 0, 288 - }, 289 - None, 290 - ); 291 - loop { 292 - ticker.next().await; 293 - let res = client 294 - .request(&ctr) 295 - .with_timeout(Duration::from_millis(100)) 296 - .await; 297 - match res { 298 - Ok(Ok(n)) => { 299 - defmt::info!("Got ping {=u32} -> {=u32}", ctr, n); 300 - ctr = ctr.wrapping_add(1); 301 - } 302 - Ok(Err(_e)) => { 303 - defmt::warn!("Net stack ping error"); 304 - } 305 - Err(_) => { 306 - defmt::warn!("Ping timeout"); 307 - } 308 - } 309 - } 310 - } 311 - 312 - /// Respond to any incoming pings 313 - #[embassy_executor::task] 314 - async fn pingserver() { 315 - STACK 316 - .services() 317 - .ping_handler::<4>() 318 - .await; 319 - } 320 - 321 - topic!(YeetTopic, u64, "topic/yeet"); 322 - 323 - #[embassy_executor::task] 324 - async fn yeeter() { 325 - let mut ctr = 0; 326 - info!("Yeeter started"); 327 - Timer::after(Duration::from_secs(3)).await; 328 - loop { 329 - Timer::after(Duration::from_secs(5)).await; 330 - warn!("Sending broadcast message. ctr: {}", ctr); 331 - STACK 332 - .topics() 333 - .broadcast::<YeetTopic>(&ctr, None) 334 - .unwrap(); 335 - ctr += 1; 336 - } 337 - } 338 - 339 - #[embassy_executor::task] 340 - async fn yeet_listener(id: u8) { 341 - let subber = STACK 342 - .topics() 343 - .bounded_receiver::<YeetTopic, 4>(None); 344 - let subber = pin!(subber); 345 - let mut hdl = subber.subscribe(); 346 - 347 - info!("Yeet listener started"); 348 - loop { 349 - let msg = hdl.recv().await; 350 - info!("{:?}: Listener id:{} got {}", msg.hdr, id, msg.t); 351 - } 352 - } 353 - 354 - #[allow(static_mut_refs)] 355 - fn init_heap() { 356 - use core::mem::MaybeUninit; 357 - const HEAP_SIZE: usize = 65536; 358 - static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; 359 - unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) } 360 - }
···
-360
demos/stm32h723zg/nucleoh723zg-net-udp-pair/src/bin/target.rs
··· 1 - #![no_std] 2 - #![no_main] 3 - extern crate alloc; 4 - 5 - use alloc::boxed::Box; 6 - use core::pin::pin; 7 - 8 - use defmt::*; 9 - use embassy_executor::Spawner; 10 - use embassy_net::StackResources; 11 - use embassy_net::udp::{PacketMetadata, UdpSocket}; 12 - use embassy_net::{IpEndpoint, Ipv4Address}; 13 - use embassy_stm32::eth::PacketQueue; 14 - use embassy_stm32::eth::{Ethernet, GenericPhy}; 15 - use embassy_stm32::pac::rcc::vals::{Pllm, Plln, Pllsrc}; 16 - use embassy_stm32::peripherals::ETH; 17 - use embassy_stm32::rcc::mux::{ 18 - Fdcansel, I2c4sel, I2c1235sel, Saisel, Sdmmcsel, Spi6sel, Spi45sel, Usart16910sel, Usart234578sel, Usbsel, 19 - }; 20 - use embassy_stm32::rcc::{AHBPrescaler, APBPrescaler, LsConfig, PllDiv, Sysclk}; 21 - use embassy_stm32::rng::Rng; 22 - use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rcc, rng}; 23 - use embassy_time::{Duration, Ticker, Timer, WithTimeout}; 24 - use embedded_alloc::LlffHeap as Heap; 25 - use ergot::exports::bbq2::traits::coordination::cas::AtomicCoord; 26 - use ergot::interface_manager::profiles::direct_edge::embassy_net_udp_0_7::{RxTxWorker, UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX, UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX}; 27 - use ergot::logging::log_v0_4::LogSink; 28 - use ergot::toolkits::embassy_net_v0_7 as kit; 29 - use ergot::well_known::ErgotPingEndpoint; 30 - use ergot::{Address, topic}; 31 - use mutex::raw_impls::cs::CriticalSectionRawMutex; 32 - use static_cell::{ConstStaticCell, StaticCell}; 33 - use {defmt_rtt as _, panic_probe as _}; 34 - 35 - const OUT_QUEUE_SIZE: usize = 4096; 36 - 37 - type Stack = kit::EdgeStack<&'static Queue, CriticalSectionRawMutex>; 38 - type Queue = kit::Queue<OUT_QUEUE_SIZE, AtomicCoord>; 39 - 40 - /// Statically store our netstack 41 - static STACK: Stack = kit::new_target_stack(OUTQ.framed_producer(), UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX as u16); 42 - /// Statically store our outgoing packet buffer 43 - static OUTQ: Queue = kit::Queue::new(); 44 - /// Statically store receive buffers 45 - static SCRATCH_BUF: ConstStaticCell<[u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]> = ConstStaticCell::new([0u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]); 46 - 47 - static LOGSINK: LogSink<&'static Stack> = LogSink::new(&STACK); 48 - 49 - #[global_allocator] 50 - static HEAP: Heap = Heap::empty(); 51 - 52 - bind_interrupts!(struct Irqs { 53 - ETH => eth::InterruptHandler; 54 - RNG => rng::InterruptHandler<peripherals::RNG>; 55 - }); 56 - 57 - #[embassy_executor::main] 58 - async fn main(spawner: Spawner) -> ! { 59 - let mut config = Config::default(); 60 - config.rcc.hse = Some(rcc::Hse { 61 - freq: embassy_stm32::time::Hertz(8_000_000), 62 - mode: rcc::HseMode::Oscillator, 63 - }); 64 - config.rcc.ls = LsConfig::off(); 65 - config.rcc.hsi48 = Some(Default::default()); // needed for RNG 66 - config.rcc.sys = Sysclk::PLL1_P; 67 - config.rcc.d1c_pre = AHBPrescaler::DIV1; 68 - config.rcc.ahb_pre = AHBPrescaler::DIV2; 69 - config.rcc.apb1_pre = APBPrescaler::DIV2; 70 - config.rcc.apb2_pre = APBPrescaler::DIV2; 71 - config.rcc.apb3_pre = APBPrescaler::DIV2; 72 - config.rcc.apb4_pre = APBPrescaler::DIV2; 73 - config.rcc.timer_prescaler = rcc::TimerPrescaler::DefaultX2; 74 - 75 - config.rcc.voltage_scale = rcc::VoltageScale::Scale0; 76 - config.rcc.pll1 = Some(rcc::Pll { 77 - source: Pllsrc::HSE, 78 - prediv: Pllm::DIV4, 79 - mul: Plln::MUL260, 80 - // 520Mhz 81 - divp: Some(PllDiv::DIV1), 82 - // 130Mhz 83 - divq: Some(PllDiv::DIV4), 84 - divr: None, 85 - }); 86 - config.rcc.pll2 = Some(rcc::Pll { 87 - source: Pllsrc::HSE, 88 - 89 - prediv: Pllm::DIV4, 90 - mul: Plln::MUL200, 91 - // 200Mhz 92 - divp: Some(PllDiv::DIV2), 93 - // 100Mhz 94 - divq: Some(PllDiv::DIV4), 95 - // 200Mhz 96 - divr: Some(PllDiv::DIV2), 97 - }); 98 - config.rcc.pll3 = Some(rcc::Pll { 99 - source: Pllsrc::HSE, 100 - prediv: Pllm::DIV4, 101 - mul: Plln::MUL192, 102 - // 192Mhz 103 - divp: Some(PllDiv::DIV2), 104 - // 48Mhz 105 - divq: Some(PllDiv::DIV8), 106 - // 92Mhz 107 - divr: Some(PllDiv::DIV4), 108 - }); 109 - 110 - // 200mhz 111 - //config.rcc.mux.octospisel = Octospisel::PLL2_R; // no support in embassy-stm32 it seems. 112 - 113 - // 200mhz 114 - config.rcc.mux.sdmmcsel = Sdmmcsel::PLL2_R; 115 - // 100mhz 116 - config.rcc.mux.fdcansel = Fdcansel::PLL2_Q; 117 - // 48mhz from crystal (not RC48) 118 - config.rcc.mux.usbsel = Usbsel::PLL3_Q; 119 - // 100mhz 120 - config.rcc.mux.usart234578sel = Usart234578sel::PLL2_Q; 121 - // 100mhz 122 - config.rcc.mux.usart16910sel = Usart16910sel::PLL2_Q; 123 - // 130mhz 124 - config.rcc.mux.i2c1235sel = I2c1235sel::PCLK1; 125 - // 130mhz 126 - config.rcc.mux.i2c4sel = I2c4sel::PCLK4; 127 - // 200mhz 128 - config.rcc.mux.spi123sel = Saisel::PLL2_P; 129 - // 100mhz 130 - config.rcc.mux.spi45sel = Spi45sel::PLL2_Q; 131 - // 100mhz 132 - config.rcc.mux.spi6sel = Spi6sel::PLL2_Q; 133 - 134 - let p = embassy_stm32::init(config); 135 - 136 - init_heap(); 137 - 138 - // Generate random seed. 139 - info!("Initializing RNG"); 140 - let mut rng = Rng::new(p.RNG, Irqs); 141 - let mut seed = [0; 8]; 142 - rng.fill_bytes(&mut seed); 143 - let seed = u64::from_le_bytes(seed); 144 - 145 - info!("Initializing ETH"); 146 - // TODO generate mac address from CPU ID 147 - // potentially using this algorythm (C): https://github.com/zephyrproject-rtos/zephyr/issues/59993#issuecomment-1644030438 148 - let mac_addr = [0x00, 0x00, 0xFE, 0xED, 0xF0, 0x0D]; 149 - 150 - static PACKETS: StaticCell<PacketQueue<8, 8>> = StaticCell::new(); 151 - // warning: Not all STM32H7 devices have the exact same pins here 152 - // for STM32H747XIH, replace p.PB13 for PG12 153 - let device = Ethernet::new( 154 - PACKETS.init(PacketQueue::<8, 8>::new()), 155 - p.ETH, 156 - Irqs, 157 - p.PA1, // ref_clk 158 - p.PA2, // mdio 159 - p.PC1, // eth_mdc 160 - p.PA7, // CRS_DV: Carrier Sense 161 - p.PC4, // RX_D0: Received Bit 0 162 - p.PC5, // RX_D1: Received Bit 1 163 - p.PG13, // TX_D0: Transmit Bit 0 164 - p.PB13, // TX_D1: Transmit Bit 1 165 - p.PG11, // TX_EN: Transmit Enable 166 - GenericPhy::new_auto(), 167 - mac_addr, 168 - ); 169 - 170 - let config = embassy_net::Config::dhcpv4(Default::default()); 171 - //let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { 172 - // address: Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), 173 - // dns_servers: Vec::new(), 174 - // gateway: Some(Ipv4Address::new(10, 42, 0, 1)), 175 - //}); 176 - 177 - // Init network stack 178 - static RESOURCES: StaticCell<StackResources<5>> = StaticCell::new(); 179 - let (embassy_net_stack, runner) = embassy_net::new(device, config, RESOURCES.init(StackResources::new()), seed); 180 - 181 - // Launch network task 182 - spawner.must_spawn(embassy_net_task(runner)); 183 - 184 - // Ensure DHCP configuration is up before trying connect 185 - let mut attempts: u32 = 0; 186 - let config = loop { 187 - if let Some(config) = embassy_net_stack.config_v4() { 188 - break config; 189 - } 190 - 191 - if attempts % 10 == 0 { 192 - info!("Waiting for DHCP address allocation..."); 193 - } 194 - 195 - attempts = attempts.wrapping_add(1); 196 - Timer::after(Duration::from_millis(100)).await; 197 - }; 198 - 199 - info!( 200 - "IP address: {}, gateway: {}, dns: {}", 201 - config.address, config.dns_servers, config.gateway 202 - ); 203 - 204 - let rx_meta = [PacketMetadata::EMPTY; 1]; 205 - let rx_buffer = [0; 4096]; 206 - let tx_meta = [PacketMetadata::EMPTY; 1]; 207 - let tx_buffer = [0; 4096]; 208 - 209 - // move the buffers into the heap, so they don't get dropped 210 - let rx_meta = Box::new(rx_meta); 211 - let rx_meta = Box::leak(rx_meta); 212 - let tx_meta = Box::new(tx_meta); 213 - let tx_meta = Box::leak(tx_meta); 214 - let rx_buffer = Box::new(rx_buffer); 215 - let rx_buffer = Box::leak(rx_buffer); 216 - let tx_buffer = Box::new(tx_buffer); 217 - let tx_buffer = Box::leak(tx_buffer); 218 - // You need to start a server on the host machine, for example: `nc -lu 8000` 219 - 220 - let mut socket = UdpSocket::new(embassy_net_stack, rx_meta, rx_buffer, tx_meta, tx_buffer); 221 - 222 - let port = 8000_u16; 223 - let remote_endpoint = IpEndpoint::new(Ipv4Address::new(192, 168, 18, 64).into(), port); 224 - let local_endpoint = IpEndpoint::new(config.address.address().into(), port); 225 - socket 226 - .bind(local_endpoint) 227 - .expect("bound"); 228 - 229 - info!( 230 - "capacity, receive: {}, send: {}", 231 - socket.packet_recv_capacity(), 232 - socket.packet_send_capacity() 233 - ); 234 - 235 - // Spawn I/O worker tasks 236 - spawner.must_spawn(run_socket(socket, SCRATCH_BUF.take(), remote_endpoint)); 237 - 238 - // Spawn socket using tasks 239 - spawner.must_spawn(pingserver()); 240 - spawner.must_spawn(pinger()); 241 - 242 - spawner.must_spawn(yeeter()); 243 - spawner.must_spawn(yeet_listener(0)); 244 - 245 - LOGSINK.register_static(log::LevelFilter::Info); 246 - 247 - let mut tckr = Ticker::every(Duration::from_secs(2)); 248 - let mut ct = 0; 249 - loop { 250 - tckr.next().await; 251 - log::info!("log # {ct}"); 252 - ct += 1; 253 - } 254 - } 255 - 256 - type Device = Ethernet<'static, ETH, GenericPhy>; 257 - 258 - #[embassy_executor::task] 259 - async fn embassy_net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { 260 - runner.run().await 261 - } 262 - 263 - #[embassy_executor::task] 264 - async fn run_socket( 265 - socket: UdpSocket<'static>, 266 - scratch_buf: &'static mut [u8], 267 - endpoint: IpEndpoint, 268 - ) { 269 - let consumer = OUTQ.framed_consumer(); 270 - let mut rxtx = RxTxWorker::new_target(&STACK, socket, (), consumer, endpoint); 271 - 272 - loop { 273 - _ = rxtx.run(scratch_buf).await; 274 - } 275 - } 276 - 277 - #[embassy_executor::task] 278 - async fn pinger() { 279 - let mut ticker = Ticker::every(Duration::from_secs(1)); 280 - let mut ctr = 0u32; 281 - let client = STACK 282 - .endpoints() 283 - .client::<ErgotPingEndpoint>( 284 - Address { 285 - network_id: 1, 286 - node_id: 1, 287 - port_id: 0, 288 - }, 289 - None, 290 - ); 291 - loop { 292 - ticker.next().await; 293 - let res = client 294 - .request(&ctr) 295 - .with_timeout(Duration::from_millis(100)) 296 - .await; 297 - match res { 298 - Ok(Ok(n)) => { 299 - defmt::info!("Got ping {=u32} -> {=u32}", ctr, n); 300 - ctr = ctr.wrapping_add(1); 301 - } 302 - Ok(Err(_e)) => { 303 - defmt::warn!("Net stack ping error"); 304 - } 305 - Err(_) => { 306 - defmt::warn!("Ping timeout"); 307 - } 308 - } 309 - } 310 - } 311 - 312 - /// Respond to any incoming pings 313 - #[embassy_executor::task] 314 - async fn pingserver() { 315 - STACK 316 - .services() 317 - .ping_handler::<4>() 318 - .await; 319 - } 320 - 321 - topic!(YeetTopic, u64, "topic/yeet"); 322 - 323 - #[embassy_executor::task] 324 - async fn yeeter() { 325 - let mut ctr = 0; 326 - info!("Yeeter started"); 327 - Timer::after(Duration::from_secs(3)).await; 328 - loop { 329 - Timer::after(Duration::from_secs(5)).await; 330 - warn!("Sending broadcast message. ctr: {}", ctr); 331 - STACK 332 - .topics() 333 - .broadcast::<YeetTopic>(&ctr, None) 334 - .unwrap(); 335 - ctr += 1; 336 - } 337 - } 338 - 339 - #[embassy_executor::task] 340 - async fn yeet_listener(id: u8) { 341 - let subber = STACK 342 - .topics() 343 - .bounded_receiver::<YeetTopic, 4>(None); 344 - let subber = pin!(subber); 345 - let mut hdl = subber.subscribe(); 346 - 347 - info!("Yeet listener started"); 348 - loop { 349 - let msg = hdl.recv().await; 350 - info!("{:?}: Listener id:{} got {}", msg.hdr, id, msg.t); 351 - } 352 - } 353 - 354 - #[allow(static_mut_refs)] 355 - fn init_heap() { 356 - use core::mem::MaybeUninit; 357 - const HEAP_SIZE: usize = 65536; 358 - static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; 359 - unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) } 360 - }
···
-8
demos/stm32h743zi/.cargo/config.toml
··· 1 - [target.'cfg(all(target_arch = "arm", target_os = "none"))'] 2 - runner = "probe-rs run --chip STM32H743ZI" 3 - 4 - [build] 5 - target = "thumbv7em-none-eabihf" 6 - 7 - [env] 8 - DEFMT_LOG = "trace"
···
-1638
demos/stm32h743zi/Cargo.lock
··· 1 - # This file is automatically @generated by Cargo. 2 - # It is not intended for manual editing. 3 - version = 4 4 - 5 - [[package]] 6 - name = "aho-corasick" 7 - version = "1.1.3" 8 - source = "registry+https://github.com/rust-lang/crates.io-index" 9 - checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" 10 - dependencies = [ 11 - "memchr", 12 - ] 13 - 14 - [[package]] 15 - name = "aligned" 16 - version = "0.4.2" 17 - source = "registry+https://github.com/rust-lang/crates.io-index" 18 - checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923" 19 - dependencies = [ 20 - "as-slice", 21 - ] 22 - 23 - [[package]] 24 - name = "as-slice" 25 - version = "0.2.1" 26 - source = "registry+https://github.com/rust-lang/crates.io-index" 27 - checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516" 28 - dependencies = [ 29 - "stable_deref_trait", 30 - ] 31 - 32 - [[package]] 33 - name = "atomic-polyfill" 34 - version = "1.0.3" 35 - source = "registry+https://github.com/rust-lang/crates.io-index" 36 - checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" 37 - dependencies = [ 38 - "critical-section", 39 - ] 40 - 41 - [[package]] 42 - name = "autocfg" 43 - version = "1.5.0" 44 - source = "registry+https://github.com/rust-lang/crates.io-index" 45 - checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" 46 - 47 - [[package]] 48 - name = "bare-metal" 49 - version = "0.2.5" 50 - source = "registry+https://github.com/rust-lang/crates.io-index" 51 - checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 52 - dependencies = [ 53 - "rustc_version 0.2.3", 54 - ] 55 - 56 - [[package]] 57 - name = "base64" 58 - version = "0.13.1" 59 - source = "registry+https://github.com/rust-lang/crates.io-index" 60 - checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 61 - 62 - [[package]] 63 - name = "bbq2" 64 - version = "0.4.2" 65 - source = "registry+https://github.com/rust-lang/crates.io-index" 66 - checksum = "25d3e5fd78b60ce3a60e21e9a92b1d5e741328264de8e609193e2bf7616747bd" 67 - dependencies = [ 68 - "const-init", 69 - "critical-section", 70 - "maitake-sync", 71 - ] 72 - 73 - [[package]] 74 - name = "bit_field" 75 - version = "0.10.2" 76 - source = "registry+https://github.com/rust-lang/crates.io-index" 77 - checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" 78 - 79 - [[package]] 80 - name = "bitfield" 81 - version = "0.13.2" 82 - source = "registry+https://github.com/rust-lang/crates.io-index" 83 - checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 84 - 85 - [[package]] 86 - name = "bitflags" 87 - version = "1.3.2" 88 - source = "registry+https://github.com/rust-lang/crates.io-index" 89 - checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 90 - 91 - [[package]] 92 - name = "bitflags" 93 - version = "2.9.3" 94 - source = "registry+https://github.com/rust-lang/crates.io-index" 95 - checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d" 96 - 97 - [[package]] 98 - name = "block-device-driver" 99 - version = "0.2.0" 100 - source = "registry+https://github.com/rust-lang/crates.io-index" 101 - checksum = "44c051592f59fe68053524b4c4935249b806f72c1f544cfb7abe4f57c3be258e" 102 - dependencies = [ 103 - "aligned", 104 - ] 105 - 106 - [[package]] 107 - name = "byteorder" 108 - version = "1.5.0" 109 - source = "registry+https://github.com/rust-lang/crates.io-index" 110 - checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 111 - 112 - [[package]] 113 - name = "cc" 114 - version = "1.2.34" 115 - source = "registry+https://github.com/rust-lang/crates.io-index" 116 - checksum = "42bc4aea80032b7bf409b0bc7ccad88853858911b7713a8062fdc0623867bedc" 117 - dependencies = [ 118 - "shlex", 119 - ] 120 - 121 - [[package]] 122 - name = "cfg-if" 123 - version = "1.0.3" 124 - source = "registry+https://github.com/rust-lang/crates.io-index" 125 - checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" 126 - 127 - [[package]] 128 - name = "cobs" 129 - version = "0.3.0" 130 - source = "registry+https://github.com/rust-lang/crates.io-index" 131 - checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" 132 - dependencies = [ 133 - "thiserror", 134 - ] 135 - 136 - [[package]] 137 - name = "cobs" 138 - version = "0.4.0" 139 - source = "registry+https://github.com/rust-lang/crates.io-index" 140 - checksum = "fea6d1b751c55bd9c0dda7d4ff752074e98f4765ae969664648bd193bb326d15" 141 - dependencies = [ 142 - "thiserror", 143 - ] 144 - 145 - [[package]] 146 - name = "cobs-acc" 147 - version = "0.1.0" 148 - dependencies = [ 149 - "cobs 0.4.0", 150 - ] 151 - 152 - [[package]] 153 - name = "const-default" 154 - version = "1.0.0" 155 - source = "registry+https://github.com/rust-lang/crates.io-index" 156 - checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" 157 - 158 - [[package]] 159 - name = "const-fnv1a-hash" 160 - version = "1.1.0" 161 - source = "registry+https://github.com/rust-lang/crates.io-index" 162 - checksum = "32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca" 163 - 164 - [[package]] 165 - name = "const-init" 166 - version = "1.0.0" 167 - source = "registry+https://github.com/rust-lang/crates.io-index" 168 - checksum = "4bd422bfb4f24a97243f60b6a4443e63d810c925d8da4bb2d8fde26a7c1d57ec" 169 - 170 - [[package]] 171 - name = "cordyceps" 172 - version = "0.3.4" 173 - source = "registry+https://github.com/rust-lang/crates.io-index" 174 - checksum = "688d7fbb8092b8de775ef2536f36c8c31f2bc4006ece2e8d8ad2d17d00ce0a2a" 175 - dependencies = [ 176 - "loom", 177 - "tracing", 178 - ] 179 - 180 - [[package]] 181 - name = "cortex-m" 182 - version = "0.7.7" 183 - source = "registry+https://github.com/rust-lang/crates.io-index" 184 - checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" 185 - dependencies = [ 186 - "bare-metal", 187 - "bitfield", 188 - "critical-section", 189 - "embedded-hal 0.2.7", 190 - "volatile-register", 191 - ] 192 - 193 - [[package]] 194 - name = "cortex-m-rt" 195 - version = "0.7.5" 196 - source = "registry+https://github.com/rust-lang/crates.io-index" 197 - checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" 198 - dependencies = [ 199 - "cortex-m-rt-macros", 200 - ] 201 - 202 - [[package]] 203 - name = "cortex-m-rt-macros" 204 - version = "0.7.5" 205 - source = "registry+https://github.com/rust-lang/crates.io-index" 206 - checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" 207 - dependencies = [ 208 - "proc-macro2", 209 - "quote", 210 - "syn 2.0.106", 211 - ] 212 - 213 - [[package]] 214 - name = "critical-section" 215 - version = "1.2.0" 216 - source = "registry+https://github.com/rust-lang/crates.io-index" 217 - checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 218 - 219 - [[package]] 220 - name = "darling" 221 - version = "0.20.11" 222 - source = "registry+https://github.com/rust-lang/crates.io-index" 223 - checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" 224 - dependencies = [ 225 - "darling_core", 226 - "darling_macro", 227 - ] 228 - 229 - [[package]] 230 - name = "darling_core" 231 - version = "0.20.11" 232 - source = "registry+https://github.com/rust-lang/crates.io-index" 233 - checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" 234 - dependencies = [ 235 - "fnv", 236 - "ident_case", 237 - "proc-macro2", 238 - "quote", 239 - "strsim", 240 - "syn 2.0.106", 241 - ] 242 - 243 - [[package]] 244 - name = "darling_macro" 245 - version = "0.20.11" 246 - source = "registry+https://github.com/rust-lang/crates.io-index" 247 - checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" 248 - dependencies = [ 249 - "darling_core", 250 - "quote", 251 - "syn 2.0.106", 252 - ] 253 - 254 - [[package]] 255 - name = "defmt" 256 - version = "0.3.100" 257 - source = "registry+https://github.com/rust-lang/crates.io-index" 258 - checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" 259 - dependencies = [ 260 - "defmt 1.0.1", 261 - ] 262 - 263 - [[package]] 264 - name = "defmt" 265 - version = "1.0.1" 266 - source = "registry+https://github.com/rust-lang/crates.io-index" 267 - checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" 268 - dependencies = [ 269 - "bitflags 1.3.2", 270 - "defmt-macros", 271 - ] 272 - 273 - [[package]] 274 - name = "defmt-macros" 275 - version = "1.0.1" 276 - source = "registry+https://github.com/rust-lang/crates.io-index" 277 - checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" 278 - dependencies = [ 279 - "defmt-parser", 280 - "proc-macro-error2", 281 - "proc-macro2", 282 - "quote", 283 - "syn 2.0.106", 284 - ] 285 - 286 - [[package]] 287 - name = "defmt-parser" 288 - version = "1.0.0" 289 - source = "registry+https://github.com/rust-lang/crates.io-index" 290 - checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" 291 - dependencies = [ 292 - "thiserror", 293 - ] 294 - 295 - [[package]] 296 - name = "defmt-rtt" 297 - version = "1.0.0" 298 - source = "registry+https://github.com/rust-lang/crates.io-index" 299 - checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1" 300 - dependencies = [ 301 - "critical-section", 302 - "defmt 1.0.1", 303 - ] 304 - 305 - [[package]] 306 - name = "document-features" 307 - version = "0.2.11" 308 - source = "registry+https://github.com/rust-lang/crates.io-index" 309 - checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" 310 - dependencies = [ 311 - "litrs", 312 - ] 313 - 314 - [[package]] 315 - name = "embassy-embedded-hal" 316 - version = "0.5.0" 317 - source = "registry+https://github.com/rust-lang/crates.io-index" 318 - checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 319 - dependencies = [ 320 - "defmt 1.0.1", 321 - "embassy-futures", 322 - "embassy-hal-internal", 323 - "embassy-sync", 324 - "embassy-time", 325 - "embedded-hal 0.2.7", 326 - "embedded-hal 1.0.0", 327 - "embedded-hal-async", 328 - "embedded-storage", 329 - "embedded-storage-async", 330 - "nb 1.1.0", 331 - ] 332 - 333 - [[package]] 334 - name = "embassy-executor" 335 - version = "0.9.1" 336 - source = "registry+https://github.com/rust-lang/crates.io-index" 337 - checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 338 - dependencies = [ 339 - "cortex-m", 340 - "critical-section", 341 - "defmt 1.0.1", 342 - "document-features", 343 - "embassy-executor-macros", 344 - "embassy-executor-timer-queue", 345 - ] 346 - 347 - [[package]] 348 - name = "embassy-executor-macros" 349 - version = "0.7.0" 350 - source = "registry+https://github.com/rust-lang/crates.io-index" 351 - checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" 352 - dependencies = [ 353 - "darling", 354 - "proc-macro2", 355 - "quote", 356 - "syn 2.0.106", 357 - ] 358 - 359 - [[package]] 360 - name = "embassy-executor-timer-queue" 361 - version = "0.1.0" 362 - source = "registry+https://github.com/rust-lang/crates.io-index" 363 - checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 364 - 365 - [[package]] 366 - name = "embassy-futures" 367 - version = "0.1.2" 368 - source = "registry+https://github.com/rust-lang/crates.io-index" 369 - checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 370 - dependencies = [ 371 - "defmt 1.0.1", 372 - ] 373 - 374 - [[package]] 375 - name = "embassy-hal-internal" 376 - version = "0.3.0" 377 - source = "registry+https://github.com/rust-lang/crates.io-index" 378 - checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a" 379 - dependencies = [ 380 - "cortex-m", 381 - "critical-section", 382 - "defmt 1.0.1", 383 - "num-traits", 384 - ] 385 - 386 - [[package]] 387 - name = "embassy-net" 388 - version = "0.7.1" 389 - source = "registry+https://github.com/rust-lang/crates.io-index" 390 - checksum = "0558a231a47e7d4a06a28b5278c92e860f1200f24821d2f365a2f40fe3f3c7b2" 391 - dependencies = [ 392 - "defmt 1.0.1", 393 - "document-features", 394 - "embassy-net-driver", 395 - "embassy-sync", 396 - "embassy-time", 397 - "embedded-io-async", 398 - "embedded-nal-async", 399 - "heapless 0.8.0", 400 - "managed", 401 - "smoltcp", 402 - ] 403 - 404 - [[package]] 405 - name = "embassy-net-driver" 406 - version = "0.2.0" 407 - source = "registry+https://github.com/rust-lang/crates.io-index" 408 - checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" 409 - dependencies = [ 410 - "defmt 0.3.100", 411 - ] 412 - 413 - [[package]] 414 - name = "embassy-stm32" 415 - version = "0.4.0" 416 - source = "registry+https://github.com/rust-lang/crates.io-index" 417 - checksum = "0d972eab325cc96afee98f80a91ca6b00249b6356dc0fdbff68b70c200df9fae" 418 - dependencies = [ 419 - "aligned", 420 - "bit_field", 421 - "bitflags 2.9.3", 422 - "block-device-driver", 423 - "cfg-if", 424 - "cortex-m", 425 - "cortex-m-rt", 426 - "critical-section", 427 - "defmt 1.0.1", 428 - "document-features", 429 - "embassy-embedded-hal", 430 - "embassy-futures", 431 - "embassy-hal-internal", 432 - "embassy-net-driver", 433 - "embassy-sync", 434 - "embassy-time", 435 - "embassy-time-driver", 436 - "embassy-time-queue-utils", 437 - "embassy-usb-driver", 438 - "embassy-usb-synopsys-otg", 439 - "embedded-can", 440 - "embedded-hal 0.2.7", 441 - "embedded-hal 1.0.0", 442 - "embedded-hal-async", 443 - "embedded-hal-nb", 444 - "embedded-io", 445 - "embedded-io-async", 446 - "embedded-storage", 447 - "embedded-storage-async", 448 - "futures-util", 449 - "nb 1.1.0", 450 - "proc-macro2", 451 - "quote", 452 - "rand_core 0.6.4", 453 - "rand_core 0.9.3", 454 - "sdio-host", 455 - "static_assertions", 456 - "stm32-fmc", 457 - "stm32-metapac", 458 - "vcell", 459 - "volatile-register", 460 - ] 461 - 462 - [[package]] 463 - name = "embassy-sync" 464 - version = "0.7.2" 465 - source = "registry+https://github.com/rust-lang/crates.io-index" 466 - checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 467 - dependencies = [ 468 - "cfg-if", 469 - "critical-section", 470 - "defmt 1.0.1", 471 - "embedded-io-async", 472 - "futures-core", 473 - "futures-sink", 474 - "heapless 0.8.0", 475 - ] 476 - 477 - [[package]] 478 - name = "embassy-time" 479 - version = "0.5.0" 480 - source = "registry+https://github.com/rust-lang/crates.io-index" 481 - checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 482 - dependencies = [ 483 - "cfg-if", 484 - "critical-section", 485 - "defmt 1.0.1", 486 - "document-features", 487 - "embassy-time-driver", 488 - "embedded-hal 0.2.7", 489 - "embedded-hal 1.0.0", 490 - "embedded-hal-async", 491 - "futures-core", 492 - ] 493 - 494 - [[package]] 495 - name = "embassy-time-driver" 496 - version = "0.2.1" 497 - source = "registry+https://github.com/rust-lang/crates.io-index" 498 - checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 499 - dependencies = [ 500 - "document-features", 501 - ] 502 - 503 - [[package]] 504 - name = "embassy-time-queue-utils" 505 - version = "0.3.0" 506 - source = "registry+https://github.com/rust-lang/crates.io-index" 507 - checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 508 - dependencies = [ 509 - "embassy-executor-timer-queue", 510 - "heapless 0.8.0", 511 - ] 512 - 513 - [[package]] 514 - name = "embassy-usb-driver" 515 - version = "0.2.0" 516 - source = "registry+https://github.com/rust-lang/crates.io-index" 517 - checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" 518 - dependencies = [ 519 - "defmt 1.0.1", 520 - "embedded-io-async", 521 - ] 522 - 523 - [[package]] 524 - name = "embassy-usb-synopsys-otg" 525 - version = "0.3.1" 526 - source = "registry+https://github.com/rust-lang/crates.io-index" 527 - checksum = "288751f8eaa44a5cf2613f13cee0ca8e06e6638cb96e897e6834702c79084b23" 528 - dependencies = [ 529 - "critical-section", 530 - "defmt 1.0.1", 531 - "embassy-sync", 532 - "embassy-usb-driver", 533 - ] 534 - 535 - [[package]] 536 - name = "embedded-alloc" 537 - version = "0.6.0" 538 - source = "registry+https://github.com/rust-lang/crates.io-index" 539 - checksum = "8f2de9133f68db0d4627ad69db767726c99ff8585272716708227008d3f1bddd" 540 - dependencies = [ 541 - "const-default", 542 - "critical-section", 543 - "linked_list_allocator", 544 - "rlsf", 545 - ] 546 - 547 - [[package]] 548 - name = "embedded-can" 549 - version = "0.4.1" 550 - source = "registry+https://github.com/rust-lang/crates.io-index" 551 - checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" 552 - dependencies = [ 553 - "nb 1.1.0", 554 - ] 555 - 556 - [[package]] 557 - name = "embedded-hal" 558 - version = "0.2.7" 559 - source = "registry+https://github.com/rust-lang/crates.io-index" 560 - checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 561 - dependencies = [ 562 - "nb 0.1.3", 563 - "void", 564 - ] 565 - 566 - [[package]] 567 - name = "embedded-hal" 568 - version = "1.0.0" 569 - source = "registry+https://github.com/rust-lang/crates.io-index" 570 - checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" 571 - 572 - [[package]] 573 - name = "embedded-hal-async" 574 - version = "1.0.0" 575 - source = "registry+https://github.com/rust-lang/crates.io-index" 576 - checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" 577 - dependencies = [ 578 - "embedded-hal 1.0.0", 579 - ] 580 - 581 - [[package]] 582 - name = "embedded-hal-nb" 583 - version = "1.0.0" 584 - source = "registry+https://github.com/rust-lang/crates.io-index" 585 - checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" 586 - dependencies = [ 587 - "embedded-hal 1.0.0", 588 - "nb 1.1.0", 589 - ] 590 - 591 - [[package]] 592 - name = "embedded-io" 593 - version = "0.6.1" 594 - source = "registry+https://github.com/rust-lang/crates.io-index" 595 - checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" 596 - dependencies = [ 597 - "defmt 0.3.100", 598 - ] 599 - 600 - [[package]] 601 - name = "embedded-io-async" 602 - version = "0.6.1" 603 - source = "registry+https://github.com/rust-lang/crates.io-index" 604 - checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" 605 - dependencies = [ 606 - "defmt 0.3.100", 607 - "embedded-io", 608 - ] 609 - 610 - [[package]] 611 - name = "embedded-nal" 612 - version = "0.9.0" 613 - source = "registry+https://github.com/rust-lang/crates.io-index" 614 - checksum = "c56a28be191a992f28f178ec338a0bf02f63d7803244add736d026a471e6ed77" 615 - dependencies = [ 616 - "nb 1.1.0", 617 - ] 618 - 619 - [[package]] 620 - name = "embedded-nal-async" 621 - version = "0.8.0" 622 - source = "registry+https://github.com/rust-lang/crates.io-index" 623 - checksum = "76959917cd2b86f40a98c28dd5624eddd1fa69d746241c8257eac428d83cb211" 624 - dependencies = [ 625 - "embedded-io-async", 626 - "embedded-nal", 627 - ] 628 - 629 - [[package]] 630 - name = "embedded-storage" 631 - version = "0.3.1" 632 - source = "registry+https://github.com/rust-lang/crates.io-index" 633 - checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" 634 - 635 - [[package]] 636 - name = "embedded-storage-async" 637 - version = "0.4.1" 638 - source = "registry+https://github.com/rust-lang/crates.io-index" 639 - checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" 640 - dependencies = [ 641 - "embedded-storage", 642 - ] 643 - 644 - [[package]] 645 - name = "ergot" 646 - version = "0.11.0" 647 - dependencies = [ 648 - "bbq2", 649 - "cobs 0.3.0", 650 - "cobs-acc", 651 - "const-fnv1a-hash", 652 - "cordyceps", 653 - "critical-section", 654 - "defmt 1.0.1", 655 - "embassy-futures", 656 - "embassy-net", 657 - "heapless 0.9.1", 658 - "log", 659 - "maitake-sync", 660 - "mutex", 661 - "pin-project", 662 - "portable-atomic", 663 - "postcard", 664 - "postcard-schema", 665 - "serde", 666 - "static_cell", 667 - ] 668 - 669 - [[package]] 670 - name = "fnv" 671 - version = "1.0.7" 672 - source = "registry+https://github.com/rust-lang/crates.io-index" 673 - checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 674 - 675 - [[package]] 676 - name = "futures-core" 677 - version = "0.3.31" 678 - source = "registry+https://github.com/rust-lang/crates.io-index" 679 - checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 680 - 681 - [[package]] 682 - name = "futures-sink" 683 - version = "0.3.31" 684 - source = "registry+https://github.com/rust-lang/crates.io-index" 685 - checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 686 - 687 - [[package]] 688 - name = "futures-task" 689 - version = "0.3.31" 690 - source = "registry+https://github.com/rust-lang/crates.io-index" 691 - checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 692 - 693 - [[package]] 694 - name = "futures-util" 695 - version = "0.3.31" 696 - source = "registry+https://github.com/rust-lang/crates.io-index" 697 - checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 698 - dependencies = [ 699 - "futures-core", 700 - "futures-task", 701 - "pin-project-lite", 702 - "pin-utils", 703 - ] 704 - 705 - [[package]] 706 - name = "generator" 707 - version = "0.8.7" 708 - source = "registry+https://github.com/rust-lang/crates.io-index" 709 - checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" 710 - dependencies = [ 711 - "cc", 712 - "cfg-if", 713 - "libc", 714 - "log", 715 - "rustversion", 716 - "windows", 717 - ] 718 - 719 - [[package]] 720 - name = "hash32" 721 - version = "0.2.1" 722 - source = "registry+https://github.com/rust-lang/crates.io-index" 723 - checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 724 - dependencies = [ 725 - "byteorder", 726 - ] 727 - 728 - [[package]] 729 - name = "hash32" 730 - version = "0.3.1" 731 - source = "registry+https://github.com/rust-lang/crates.io-index" 732 - checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" 733 - dependencies = [ 734 - "byteorder", 735 - ] 736 - 737 - [[package]] 738 - name = "heapless" 739 - version = "0.7.17" 740 - source = "registry+https://github.com/rust-lang/crates.io-index" 741 - checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" 742 - dependencies = [ 743 - "atomic-polyfill", 744 - "hash32 0.2.1", 745 - "rustc_version 0.4.1", 746 - "serde", 747 - "spin", 748 - "stable_deref_trait", 749 - ] 750 - 751 - [[package]] 752 - name = "heapless" 753 - version = "0.8.0" 754 - source = "registry+https://github.com/rust-lang/crates.io-index" 755 - checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" 756 - dependencies = [ 757 - "defmt 0.3.100", 758 - "hash32 0.3.1", 759 - "stable_deref_trait", 760 - ] 761 - 762 - [[package]] 763 - name = "heapless" 764 - version = "0.9.1" 765 - source = "registry+https://github.com/rust-lang/crates.io-index" 766 - checksum = "b1edcd5a338e64688fbdcb7531a846cfd3476a54784dcb918a0844682bc7ada5" 767 - dependencies = [ 768 - "defmt 1.0.1", 769 - "hash32 0.3.1", 770 - "serde", 771 - "stable_deref_trait", 772 - ] 773 - 774 - [[package]] 775 - name = "ident_case" 776 - version = "1.0.1" 777 - source = "registry+https://github.com/rust-lang/crates.io-index" 778 - checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 779 - 780 - [[package]] 781 - name = "lazy_static" 782 - version = "1.5.0" 783 - source = "registry+https://github.com/rust-lang/crates.io-index" 784 - checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 785 - 786 - [[package]] 787 - name = "libc" 788 - version = "0.2.175" 789 - source = "registry+https://github.com/rust-lang/crates.io-index" 790 - checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" 791 - 792 - [[package]] 793 - name = "linked_list_allocator" 794 - version = "0.10.5" 795 - source = "registry+https://github.com/rust-lang/crates.io-index" 796 - checksum = "9afa463f5405ee81cdb9cc2baf37e08ec7e4c8209442b5d72c04cfb2cd6e6286" 797 - 798 - [[package]] 799 - name = "litrs" 800 - version = "0.4.2" 801 - source = "registry+https://github.com/rust-lang/crates.io-index" 802 - checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" 803 - 804 - [[package]] 805 - name = "lock_api" 806 - version = "0.4.14" 807 - source = "registry+https://github.com/rust-lang/crates.io-index" 808 - checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" 809 - dependencies = [ 810 - "scopeguard", 811 - ] 812 - 813 - [[package]] 814 - name = "log" 815 - version = "0.4.27" 816 - source = "registry+https://github.com/rust-lang/crates.io-index" 817 - checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" 818 - 819 - [[package]] 820 - name = "loom" 821 - version = "0.7.2" 822 - source = "registry+https://github.com/rust-lang/crates.io-index" 823 - checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" 824 - dependencies = [ 825 - "cfg-if", 826 - "generator", 827 - "scoped-tls", 828 - "tracing", 829 - "tracing-subscriber", 830 - ] 831 - 832 - [[package]] 833 - name = "maitake-sync" 834 - version = "0.2.2" 835 - source = "registry+https://github.com/rust-lang/crates.io-index" 836 - checksum = "748f86d9befd480b602c3bebc9ef30dbf2f3dfc8acc4a73d07b90f0117e6de3f" 837 - dependencies = [ 838 - "cordyceps", 839 - "loom", 840 - "mutex-traits", 841 - "mycelium-bitfield", 842 - "pin-project", 843 - "portable-atomic", 844 - "tracing", 845 - ] 846 - 847 - [[package]] 848 - name = "managed" 849 - version = "0.8.0" 850 - source = "registry+https://github.com/rust-lang/crates.io-index" 851 - checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" 852 - 853 - [[package]] 854 - name = "matchers" 855 - version = "0.1.0" 856 - source = "registry+https://github.com/rust-lang/crates.io-index" 857 - checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" 858 - dependencies = [ 859 - "regex-automata 0.1.10", 860 - ] 861 - 862 - [[package]] 863 - name = "memchr" 864 - version = "2.7.5" 865 - source = "registry+https://github.com/rust-lang/crates.io-index" 866 - checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" 867 - 868 - [[package]] 869 - name = "mutex" 870 - version = "1.0.2" 871 - source = "registry+https://github.com/rust-lang/crates.io-index" 872 - checksum = "f23bf5944734b7a5d1bd0a9b594213dd04de471fd3d3a1bfce672913dd72d606" 873 - dependencies = [ 874 - "critical-section", 875 - "mutex-traits", 876 - ] 877 - 878 - [[package]] 879 - name = "mutex-traits" 880 - version = "1.0.1" 881 - source = "registry+https://github.com/rust-lang/crates.io-index" 882 - checksum = "3929f2b5633d29cf7b6624992e5f3c1e9334f1193423e12d17be4faf678cde3f" 883 - 884 - [[package]] 885 - name = "mycelium-bitfield" 886 - version = "0.1.5" 887 - source = "registry+https://github.com/rust-lang/crates.io-index" 888 - checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" 889 - 890 - [[package]] 891 - name = "nb" 892 - version = "0.1.3" 893 - source = "registry+https://github.com/rust-lang/crates.io-index" 894 - checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 895 - dependencies = [ 896 - "nb 1.1.0", 897 - ] 898 - 899 - [[package]] 900 - name = "nb" 901 - version = "1.1.0" 902 - source = "registry+https://github.com/rust-lang/crates.io-index" 903 - checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 904 - 905 - [[package]] 906 - name = "nu-ansi-term" 907 - version = "0.46.0" 908 - source = "registry+https://github.com/rust-lang/crates.io-index" 909 - checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 910 - dependencies = [ 911 - "overload", 912 - "winapi", 913 - ] 914 - 915 - [[package]] 916 - name = "nucleoh743zi-blinky" 917 - version = "0.1.0" 918 - dependencies = [ 919 - "cortex-m", 920 - "cortex-m-rt", 921 - "defmt 1.0.1", 922 - "defmt-rtt", 923 - "embassy-executor", 924 - "embassy-stm32", 925 - "embassy-time", 926 - "embedded-hal 1.0.0", 927 - "ergot", 928 - "heapless 0.9.1", 929 - "mutex", 930 - "panic-probe", 931 - ] 932 - 933 - [[package]] 934 - name = "nucleoh743zi-net-udp-pair" 935 - version = "0.1.0" 936 - dependencies = [ 937 - "bbq2", 938 - "cortex-m", 939 - "cortex-m-rt", 940 - "defmt 1.0.1", 941 - "defmt-rtt", 942 - "embassy-executor", 943 - "embassy-futures", 944 - "embassy-net", 945 - "embassy-stm32", 946 - "embassy-time", 947 - "embedded-alloc", 948 - "embedded-hal 1.0.0", 949 - "ergot", 950 - "heapless 0.9.1", 951 - "log", 952 - "mutex", 953 - "panic-probe", 954 - "postcard-schema", 955 - "serde", 956 - "static_cell", 957 - ] 958 - 959 - [[package]] 960 - name = "num-traits" 961 - version = "0.2.19" 962 - source = "registry+https://github.com/rust-lang/crates.io-index" 963 - checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 964 - dependencies = [ 965 - "autocfg", 966 - ] 967 - 968 - [[package]] 969 - name = "once_cell" 970 - version = "1.21.3" 971 - source = "registry+https://github.com/rust-lang/crates.io-index" 972 - checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 973 - 974 - [[package]] 975 - name = "overload" 976 - version = "0.1.1" 977 - source = "registry+https://github.com/rust-lang/crates.io-index" 978 - checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 979 - 980 - [[package]] 981 - name = "panic-probe" 982 - version = "1.0.0" 983 - source = "registry+https://github.com/rust-lang/crates.io-index" 984 - checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" 985 - dependencies = [ 986 - "cortex-m", 987 - "defmt 1.0.1", 988 - ] 989 - 990 - [[package]] 991 - name = "pin-project" 992 - version = "1.1.10" 993 - source = "registry+https://github.com/rust-lang/crates.io-index" 994 - checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" 995 - dependencies = [ 996 - "pin-project-internal", 997 - ] 998 - 999 - [[package]] 1000 - name = "pin-project-internal" 1001 - version = "1.1.10" 1002 - source = "registry+https://github.com/rust-lang/crates.io-index" 1003 - checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" 1004 - dependencies = [ 1005 - "proc-macro2", 1006 - "quote", 1007 - "syn 2.0.106", 1008 - ] 1009 - 1010 - [[package]] 1011 - name = "pin-project-lite" 1012 - version = "0.2.16" 1013 - source = "registry+https://github.com/rust-lang/crates.io-index" 1014 - checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 1015 - 1016 - [[package]] 1017 - name = "pin-utils" 1018 - version = "0.1.0" 1019 - source = "registry+https://github.com/rust-lang/crates.io-index" 1020 - checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1021 - 1022 - [[package]] 1023 - name = "portable-atomic" 1024 - version = "1.11.1" 1025 - source = "registry+https://github.com/rust-lang/crates.io-index" 1026 - checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" 1027 - 1028 - [[package]] 1029 - name = "postcard" 1030 - version = "1.1.3" 1031 - source = "registry+https://github.com/rust-lang/crates.io-index" 1032 - checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" 1033 - dependencies = [ 1034 - "cobs 0.3.0", 1035 - "heapless 0.7.17", 1036 - "serde", 1037 - ] 1038 - 1039 - [[package]] 1040 - name = "postcard-derive" 1041 - version = "0.2.2" 1042 - source = "registry+https://github.com/rust-lang/crates.io-index" 1043 - checksum = "e0232bd009a197ceec9cc881ba46f727fcd8060a2d8d6a9dde7a69030a6fe2bb" 1044 - dependencies = [ 1045 - "proc-macro2", 1046 - "quote", 1047 - "syn 2.0.106", 1048 - ] 1049 - 1050 - [[package]] 1051 - name = "postcard-schema" 1052 - version = "0.2.5" 1053 - source = "registry+https://github.com/rust-lang/crates.io-index" 1054 - checksum = "9475666d89f42231a0a57da32d5f6ca7f9b5cd4c335ea1fe8f3278215b7a21ff" 1055 - dependencies = [ 1056 - "heapless 0.9.1", 1057 - "postcard-derive", 1058 - "serde", 1059 - ] 1060 - 1061 - [[package]] 1062 - name = "proc-macro-error-attr2" 1063 - version = "2.0.0" 1064 - source = "registry+https://github.com/rust-lang/crates.io-index" 1065 - checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" 1066 - dependencies = [ 1067 - "proc-macro2", 1068 - "quote", 1069 - ] 1070 - 1071 - [[package]] 1072 - name = "proc-macro-error2" 1073 - version = "2.0.1" 1074 - source = "registry+https://github.com/rust-lang/crates.io-index" 1075 - checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" 1076 - dependencies = [ 1077 - "proc-macro-error-attr2", 1078 - "proc-macro2", 1079 - "quote", 1080 - "syn 2.0.106", 1081 - ] 1082 - 1083 - [[package]] 1084 - name = "proc-macro2" 1085 - version = "1.0.101" 1086 - source = "registry+https://github.com/rust-lang/crates.io-index" 1087 - checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" 1088 - dependencies = [ 1089 - "unicode-ident", 1090 - ] 1091 - 1092 - [[package]] 1093 - name = "quote" 1094 - version = "1.0.40" 1095 - source = "registry+https://github.com/rust-lang/crates.io-index" 1096 - checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" 1097 - dependencies = [ 1098 - "proc-macro2", 1099 - ] 1100 - 1101 - [[package]] 1102 - name = "rand_core" 1103 - version = "0.6.4" 1104 - source = "registry+https://github.com/rust-lang/crates.io-index" 1105 - checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1106 - 1107 - [[package]] 1108 - name = "rand_core" 1109 - version = "0.9.3" 1110 - source = "registry+https://github.com/rust-lang/crates.io-index" 1111 - checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 1112 - 1113 - [[package]] 1114 - name = "regex" 1115 - version = "1.11.2" 1116 - source = "registry+https://github.com/rust-lang/crates.io-index" 1117 - checksum = "23d7fd106d8c02486a8d64e778353d1cffe08ce79ac2e82f540c86d0facf6912" 1118 - dependencies = [ 1119 - "aho-corasick", 1120 - "memchr", 1121 - "regex-automata 0.4.10", 1122 - "regex-syntax 0.8.6", 1123 - ] 1124 - 1125 - [[package]] 1126 - name = "regex-automata" 1127 - version = "0.1.10" 1128 - source = "registry+https://github.com/rust-lang/crates.io-index" 1129 - checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" 1130 - dependencies = [ 1131 - "regex-syntax 0.6.29", 1132 - ] 1133 - 1134 - [[package]] 1135 - name = "regex-automata" 1136 - version = "0.4.10" 1137 - source = "registry+https://github.com/rust-lang/crates.io-index" 1138 - checksum = "6b9458fa0bfeeac22b5ca447c63aaf45f28439a709ccd244698632f9aa6394d6" 1139 - dependencies = [ 1140 - "aho-corasick", 1141 - "memchr", 1142 - "regex-syntax 0.8.6", 1143 - ] 1144 - 1145 - [[package]] 1146 - name = "regex-syntax" 1147 - version = "0.6.29" 1148 - source = "registry+https://github.com/rust-lang/crates.io-index" 1149 - checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" 1150 - 1151 - [[package]] 1152 - name = "regex-syntax" 1153 - version = "0.8.6" 1154 - source = "registry+https://github.com/rust-lang/crates.io-index" 1155 - checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" 1156 - 1157 - [[package]] 1158 - name = "rlsf" 1159 - version = "0.2.1" 1160 - source = "registry+https://github.com/rust-lang/crates.io-index" 1161 - checksum = "222fb240c3286247ecdee6fa5341e7cdad0ffdf8e7e401d9937f2d58482a20bf" 1162 - dependencies = [ 1163 - "cfg-if", 1164 - "const-default", 1165 - "libc", 1166 - "svgbobdoc", 1167 - ] 1168 - 1169 - [[package]] 1170 - name = "rustc_version" 1171 - version = "0.2.3" 1172 - source = "registry+https://github.com/rust-lang/crates.io-index" 1173 - checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 1174 - dependencies = [ 1175 - "semver 0.9.0", 1176 - ] 1177 - 1178 - [[package]] 1179 - name = "rustc_version" 1180 - version = "0.4.1" 1181 - source = "registry+https://github.com/rust-lang/crates.io-index" 1182 - checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" 1183 - dependencies = [ 1184 - "semver 1.0.26", 1185 - ] 1186 - 1187 - [[package]] 1188 - name = "rustversion" 1189 - version = "1.0.22" 1190 - source = "registry+https://github.com/rust-lang/crates.io-index" 1191 - checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" 1192 - 1193 - [[package]] 1194 - name = "scoped-tls" 1195 - version = "1.0.1" 1196 - source = "registry+https://github.com/rust-lang/crates.io-index" 1197 - checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" 1198 - 1199 - [[package]] 1200 - name = "scopeguard" 1201 - version = "1.2.0" 1202 - source = "registry+https://github.com/rust-lang/crates.io-index" 1203 - checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1204 - 1205 - [[package]] 1206 - name = "sdio-host" 1207 - version = "0.9.0" 1208 - source = "registry+https://github.com/rust-lang/crates.io-index" 1209 - checksum = "b328e2cb950eeccd55b7f55c3a963691455dcd044cfb5354f0c5e68d2c2d6ee2" 1210 - 1211 - [[package]] 1212 - name = "semver" 1213 - version = "0.9.0" 1214 - source = "registry+https://github.com/rust-lang/crates.io-index" 1215 - checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 1216 - dependencies = [ 1217 - "semver-parser", 1218 - ] 1219 - 1220 - [[package]] 1221 - name = "semver" 1222 - version = "1.0.26" 1223 - source = "registry+https://github.com/rust-lang/crates.io-index" 1224 - checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" 1225 - 1226 - [[package]] 1227 - name = "semver-parser" 1228 - version = "0.7.0" 1229 - source = "registry+https://github.com/rust-lang/crates.io-index" 1230 - checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 1231 - 1232 - [[package]] 1233 - name = "serde" 1234 - version = "1.0.219" 1235 - source = "registry+https://github.com/rust-lang/crates.io-index" 1236 - checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" 1237 - dependencies = [ 1238 - "serde_derive", 1239 - ] 1240 - 1241 - [[package]] 1242 - name = "serde_derive" 1243 - version = "1.0.219" 1244 - source = "registry+https://github.com/rust-lang/crates.io-index" 1245 - checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" 1246 - dependencies = [ 1247 - "proc-macro2", 1248 - "quote", 1249 - "syn 2.0.106", 1250 - ] 1251 - 1252 - [[package]] 1253 - name = "sharded-slab" 1254 - version = "0.1.7" 1255 - source = "registry+https://github.com/rust-lang/crates.io-index" 1256 - checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" 1257 - dependencies = [ 1258 - "lazy_static", 1259 - ] 1260 - 1261 - [[package]] 1262 - name = "shlex" 1263 - version = "1.3.0" 1264 - source = "registry+https://github.com/rust-lang/crates.io-index" 1265 - checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1266 - 1267 - [[package]] 1268 - name = "smallvec" 1269 - version = "1.15.1" 1270 - source = "registry+https://github.com/rust-lang/crates.io-index" 1271 - checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" 1272 - 1273 - [[package]] 1274 - name = "smoltcp" 1275 - version = "0.12.0" 1276 - source = "registry+https://github.com/rust-lang/crates.io-index" 1277 - checksum = "dad095989c1533c1c266d9b1e8d70a1329dd3723c3edac6d03bbd67e7bf6f4bb" 1278 - dependencies = [ 1279 - "bitflags 1.3.2", 1280 - "byteorder", 1281 - "cfg-if", 1282 - "defmt 0.3.100", 1283 - "heapless 0.8.0", 1284 - "managed", 1285 - ] 1286 - 1287 - [[package]] 1288 - name = "spin" 1289 - version = "0.9.8" 1290 - source = "registry+https://github.com/rust-lang/crates.io-index" 1291 - checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 1292 - dependencies = [ 1293 - "lock_api", 1294 - ] 1295 - 1296 - [[package]] 1297 - name = "stable_deref_trait" 1298 - version = "1.2.0" 1299 - source = "registry+https://github.com/rust-lang/crates.io-index" 1300 - checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 1301 - 1302 - [[package]] 1303 - name = "static_assertions" 1304 - version = "1.1.0" 1305 - source = "registry+https://github.com/rust-lang/crates.io-index" 1306 - checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1307 - 1308 - [[package]] 1309 - name = "static_cell" 1310 - version = "2.1.1" 1311 - source = "registry+https://github.com/rust-lang/crates.io-index" 1312 - checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" 1313 - dependencies = [ 1314 - "portable-atomic", 1315 - ] 1316 - 1317 - [[package]] 1318 - name = "stm32-fmc" 1319 - version = "0.3.2" 1320 - source = "registry+https://github.com/rust-lang/crates.io-index" 1321 - checksum = "c7f0639399e2307c2446c54d91d4f1596343a1e1d5cab605b9cce11d0ab3858c" 1322 - dependencies = [ 1323 - "embedded-hal 0.2.7", 1324 - ] 1325 - 1326 - [[package]] 1327 - name = "stm32-metapac" 1328 - version = "18.0.0" 1329 - source = "registry+https://github.com/rust-lang/crates.io-index" 1330 - checksum = "6fd8ec3a292a0d9fc4798416a61b21da5ae50341b2e7b8d12e662bf305366097" 1331 - dependencies = [ 1332 - "cortex-m", 1333 - "cortex-m-rt", 1334 - "defmt 0.3.100", 1335 - ] 1336 - 1337 - [[package]] 1338 - name = "strsim" 1339 - version = "0.11.1" 1340 - source = "registry+https://github.com/rust-lang/crates.io-index" 1341 - checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 1342 - 1343 - [[package]] 1344 - name = "svgbobdoc" 1345 - version = "0.3.0" 1346 - source = "registry+https://github.com/rust-lang/crates.io-index" 1347 - checksum = "f2c04b93fc15d79b39c63218f15e3fdffaa4c227830686e3b7c5f41244eb3e50" 1348 - dependencies = [ 1349 - "base64", 1350 - "proc-macro2", 1351 - "quote", 1352 - "syn 1.0.109", 1353 - "unicode-width", 1354 - ] 1355 - 1356 - [[package]] 1357 - name = "syn" 1358 - version = "1.0.109" 1359 - source = "registry+https://github.com/rust-lang/crates.io-index" 1360 - checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1361 - dependencies = [ 1362 - "proc-macro2", 1363 - "quote", 1364 - "unicode-ident", 1365 - ] 1366 - 1367 - [[package]] 1368 - name = "syn" 1369 - version = "2.0.106" 1370 - source = "registry+https://github.com/rust-lang/crates.io-index" 1371 - checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" 1372 - dependencies = [ 1373 - "proc-macro2", 1374 - "quote", 1375 - "unicode-ident", 1376 - ] 1377 - 1378 - [[package]] 1379 - name = "thiserror" 1380 - version = "2.0.16" 1381 - source = "registry+https://github.com/rust-lang/crates.io-index" 1382 - checksum = "3467d614147380f2e4e374161426ff399c91084acd2363eaf549172b3d5e60c0" 1383 - dependencies = [ 1384 - "thiserror-impl", 1385 - ] 1386 - 1387 - [[package]] 1388 - name = "thiserror-impl" 1389 - version = "2.0.16" 1390 - source = "registry+https://github.com/rust-lang/crates.io-index" 1391 - checksum = "6c5e1be1c48b9172ee610da68fd9cd2770e7a4056cb3fc98710ee6906f0c7960" 1392 - dependencies = [ 1393 - "proc-macro2", 1394 - "quote", 1395 - "syn 2.0.106", 1396 - ] 1397 - 1398 - [[package]] 1399 - name = "thread_local" 1400 - version = "1.1.9" 1401 - source = "registry+https://github.com/rust-lang/crates.io-index" 1402 - checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" 1403 - dependencies = [ 1404 - "cfg-if", 1405 - ] 1406 - 1407 - [[package]] 1408 - name = "tracing" 1409 - version = "0.1.41" 1410 - source = "registry+https://github.com/rust-lang/crates.io-index" 1411 - checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" 1412 - dependencies = [ 1413 - "pin-project-lite", 1414 - "tracing-attributes", 1415 - "tracing-core", 1416 - ] 1417 - 1418 - [[package]] 1419 - name = "tracing-attributes" 1420 - version = "0.1.30" 1421 - source = "registry+https://github.com/rust-lang/crates.io-index" 1422 - checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" 1423 - dependencies = [ 1424 - "proc-macro2", 1425 - "quote", 1426 - "syn 2.0.106", 1427 - ] 1428 - 1429 - [[package]] 1430 - name = "tracing-core" 1431 - version = "0.1.34" 1432 - source = "registry+https://github.com/rust-lang/crates.io-index" 1433 - checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" 1434 - dependencies = [ 1435 - "once_cell", 1436 - "valuable", 1437 - ] 1438 - 1439 - [[package]] 1440 - name = "tracing-log" 1441 - version = "0.2.0" 1442 - source = "registry+https://github.com/rust-lang/crates.io-index" 1443 - checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" 1444 - dependencies = [ 1445 - "log", 1446 - "once_cell", 1447 - "tracing-core", 1448 - ] 1449 - 1450 - [[package]] 1451 - name = "tracing-subscriber" 1452 - version = "0.3.19" 1453 - source = "registry+https://github.com/rust-lang/crates.io-index" 1454 - checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" 1455 - dependencies = [ 1456 - "matchers", 1457 - "nu-ansi-term", 1458 - "once_cell", 1459 - "regex", 1460 - "sharded-slab", 1461 - "smallvec", 1462 - "thread_local", 1463 - "tracing", 1464 - "tracing-core", 1465 - "tracing-log", 1466 - ] 1467 - 1468 - [[package]] 1469 - name = "unicode-ident" 1470 - version = "1.0.18" 1471 - source = "registry+https://github.com/rust-lang/crates.io-index" 1472 - checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 1473 - 1474 - [[package]] 1475 - name = "unicode-width" 1476 - version = "0.1.14" 1477 - source = "registry+https://github.com/rust-lang/crates.io-index" 1478 - checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 1479 - 1480 - [[package]] 1481 - name = "valuable" 1482 - version = "0.1.1" 1483 - source = "registry+https://github.com/rust-lang/crates.io-index" 1484 - checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" 1485 - 1486 - [[package]] 1487 - name = "vcell" 1488 - version = "0.1.3" 1489 - source = "registry+https://github.com/rust-lang/crates.io-index" 1490 - checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 1491 - 1492 - [[package]] 1493 - name = "void" 1494 - version = "1.0.2" 1495 - source = "registry+https://github.com/rust-lang/crates.io-index" 1496 - checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 1497 - 1498 - [[package]] 1499 - name = "volatile-register" 1500 - version = "0.2.2" 1501 - source = "registry+https://github.com/rust-lang/crates.io-index" 1502 - checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" 1503 - dependencies = [ 1504 - "vcell", 1505 - ] 1506 - 1507 - [[package]] 1508 - name = "winapi" 1509 - version = "0.3.9" 1510 - source = "registry+https://github.com/rust-lang/crates.io-index" 1511 - checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1512 - dependencies = [ 1513 - "winapi-i686-pc-windows-gnu", 1514 - "winapi-x86_64-pc-windows-gnu", 1515 - ] 1516 - 1517 - [[package]] 1518 - name = "winapi-i686-pc-windows-gnu" 1519 - version = "0.4.0" 1520 - source = "registry+https://github.com/rust-lang/crates.io-index" 1521 - checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1522 - 1523 - [[package]] 1524 - name = "winapi-x86_64-pc-windows-gnu" 1525 - version = "0.4.0" 1526 - source = "registry+https://github.com/rust-lang/crates.io-index" 1527 - checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1528 - 1529 - [[package]] 1530 - name = "windows" 1531 - version = "0.61.3" 1532 - source = "registry+https://github.com/rust-lang/crates.io-index" 1533 - checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" 1534 - dependencies = [ 1535 - "windows-collections", 1536 - "windows-core", 1537 - "windows-future", 1538 - "windows-link", 1539 - "windows-numerics", 1540 - ] 1541 - 1542 - [[package]] 1543 - name = "windows-collections" 1544 - version = "0.2.0" 1545 - source = "registry+https://github.com/rust-lang/crates.io-index" 1546 - checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" 1547 - dependencies = [ 1548 - "windows-core", 1549 - ] 1550 - 1551 - [[package]] 1552 - name = "windows-core" 1553 - version = "0.61.2" 1554 - source = "registry+https://github.com/rust-lang/crates.io-index" 1555 - checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" 1556 - dependencies = [ 1557 - "windows-implement", 1558 - "windows-interface", 1559 - "windows-link", 1560 - "windows-result", 1561 - "windows-strings", 1562 - ] 1563 - 1564 - [[package]] 1565 - name = "windows-future" 1566 - version = "0.2.1" 1567 - source = "registry+https://github.com/rust-lang/crates.io-index" 1568 - checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" 1569 - dependencies = [ 1570 - "windows-core", 1571 - "windows-link", 1572 - "windows-threading", 1573 - ] 1574 - 1575 - [[package]] 1576 - name = "windows-implement" 1577 - version = "0.60.0" 1578 - source = "registry+https://github.com/rust-lang/crates.io-index" 1579 - checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" 1580 - dependencies = [ 1581 - "proc-macro2", 1582 - "quote", 1583 - "syn 2.0.106", 1584 - ] 1585 - 1586 - [[package]] 1587 - name = "windows-interface" 1588 - version = "0.59.1" 1589 - source = "registry+https://github.com/rust-lang/crates.io-index" 1590 - checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" 1591 - dependencies = [ 1592 - "proc-macro2", 1593 - "quote", 1594 - "syn 2.0.106", 1595 - ] 1596 - 1597 - [[package]] 1598 - name = "windows-link" 1599 - version = "0.1.3" 1600 - source = "registry+https://github.com/rust-lang/crates.io-index" 1601 - checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" 1602 - 1603 - [[package]] 1604 - name = "windows-numerics" 1605 - version = "0.2.0" 1606 - source = "registry+https://github.com/rust-lang/crates.io-index" 1607 - checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" 1608 - dependencies = [ 1609 - "windows-core", 1610 - "windows-link", 1611 - ] 1612 - 1613 - [[package]] 1614 - name = "windows-result" 1615 - version = "0.3.4" 1616 - source = "registry+https://github.com/rust-lang/crates.io-index" 1617 - checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" 1618 - dependencies = [ 1619 - "windows-link", 1620 - ] 1621 - 1622 - [[package]] 1623 - name = "windows-strings" 1624 - version = "0.4.2" 1625 - source = "registry+https://github.com/rust-lang/crates.io-index" 1626 - checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" 1627 - dependencies = [ 1628 - "windows-link", 1629 - ] 1630 - 1631 - [[package]] 1632 - name = "windows-threading" 1633 - version = "0.1.0" 1634 - source = "registry+https://github.com/rust-lang/crates.io-index" 1635 - checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" 1636 - dependencies = [ 1637 - "windows-link", 1638 - ]
···
-50
demos/stm32h743zi/Cargo.toml
··· 1 - [workspace] 2 - members = [ 3 - "nucleoh743zi-blinky", 4 - "nucleoh743zi-net-udp-pair", 5 - ] 6 - resolver = "2" 7 - 8 - [workspace.dependencies] 9 - ergot = { path = "../../crates/ergot", features = ["embassy-net-v0_7"] } 10 - 11 - cortex-m-rt = "0.7.0" 12 - defmt = "1.0.1" 13 - defmt-rtt = "1.0.0" 14 - embedded-hal = "1.0.0" 15 - mutex = "1.0.2" 16 - static_cell = "2.1.1" 17 - embedded-alloc = "0.6.0" 18 - 19 - bbq2 = { version = "0.4.1", default-features = false, features = ["critical-section", "maitake-sync-0_2"] } 20 - 21 - cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } 22 - embassy-executor = { version = "0.9.1", features = ["defmt", "arch-cortex-m", "executor-thread", "executor-interrupt"] } 23 - embassy-stm32 = { version = "0.4.0", features = ["defmt", "stm32h743zi", "unstable-pac", "memory-x", "time-driver-tim2", "exti"] } 24 - embassy-time = { version = "0.5.0", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 25 - embassy-net = { version = "0.7.1", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet", "dns", "proto-ipv4", "proto-ipv6"] } 26 - embassy-futures = { version = "0.1.2", features = ["defmt"] } 27 - heapless = { version = "0.9", default-features = false } 28 - panic-probe = { version = "1.0.0", features = ["print-defmt"] } 29 - postcard-schema = { version = "0.2.5", features = ["derive"] } 30 - serde = { version = "1.0.219", default-features = false, features = ["derive"] } 31 - 32 - [profile.release] 33 - debug = 2 34 - lto = true 35 - opt-level = 0 36 - codegen-units = 1 37 - incremental = false 38 - panic = "abort" 39 - 40 - [profile.ci] 41 - inherits = "dev" 42 - debug = false 43 - strip = true 44 - debug-assertions = true 45 - overflow-checks = true 46 - lto = false 47 - panic = 'unwind' 48 - incremental = false 49 - codegen-units = 256 50 - rpath = false
···
-18
demos/stm32h743zi/nucleoh743zi-blinky/Cargo.toml
··· 1 - [package] 2 - name = "nucleoh743zi-blinky" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cortex-m-rt.workspace = true 8 - cortex-m.workspace = true 9 - defmt-rtt.workspace = true 10 - defmt.workspace = true 11 - embassy-executor.workspace = true 12 - embassy-stm32.workspace = true 13 - embassy-time.workspace = true 14 - embedded-hal.workspace = true 15 - ergot.workspace = true 16 - heapless.workspace = true 17 - mutex.workspace = true 18 - panic-probe.workspace = true
···
-5
demos/stm32h743zi/nucleoh743zi-blinky/build.rs
··· 1 - fn main() { 2 - println!("cargo:rustc-link-arg-bins=--nmagic"); 3 - println!("cargo:rustc-link-arg-bins=-Tlink.x"); 4 - println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); 5 - }
···
-56
demos/stm32h743zi/nucleoh743zi-blinky/src/main.rs
··· 1 - #![no_std] 2 - #![no_main] 3 - 4 - use core::pin::pin; 5 - 6 - use embassy_executor::{Spawner, task}; 7 - use embassy_stm32::gpio::{Level, Output, Speed}; 8 - use embassy_time::{Duration, Ticker}; 9 - use ergot::{Address, NetStack, endpoint, interface_manager::profiles::null::Null}; 10 - use mutex::raw_impls::cs::CriticalSectionRawMutex; 11 - use {defmt_rtt as _, panic_probe as _}; 12 - 13 - pub static STACK: NetStack<CriticalSectionRawMutex, Null> = NetStack::new(); 14 - 15 - // Define some endpoints 16 - endpoint!(LedEndpoint, bool, (), "led/set"); 17 - 18 - #[embassy_executor::main] 19 - async fn main(spawner: Spawner) { 20 - let p = embassy_stm32::init(Default::default()); 21 - 22 - spawner.must_spawn(led_server(Output::new(p.PB14, Level::High, Speed::Low))); 23 - 24 - let mut ticker = Ticker::every(Duration::from_millis(500)); 25 - let client = STACK 26 - .endpoints() 27 - .client::<LedEndpoint>(Address::unknown(), Some("led")); 28 - loop { 29 - ticker.next().await; 30 - let _ = client.request(&true).await; 31 - ticker.next().await; 32 - let _ = client.request(&false).await; 33 - } 34 - } 35 - 36 - #[task] 37 - async fn led_server(mut led: Output<'static>) { 38 - let socket = STACK 39 - .endpoints() 40 - .bounded_server::<LedEndpoint, 2>(Some("led")); 41 - let socket = pin!(socket); 42 - let mut hdl = socket.attach(); 43 - 44 - loop { 45 - let _ = hdl 46 - .serve(async |on| { 47 - defmt::info!("LED set {=bool}", *on); 48 - if *on { 49 - led.set_low(); 50 - } else { 51 - led.set_high(); 52 - } 53 - }) 54 - .await; 55 - } 56 - }
···
-26
demos/stm32h743zi/nucleoh743zi-net-udp-pair/Cargo.toml
··· 1 - [package] 2 - name = "nucleoh743zi-net-udp-pair" 3 - version = "0.1.0" 4 - edition = "2024" 5 - 6 - [dependencies] 7 - cortex-m-rt.workspace = true 8 - cortex-m.workspace = true 9 - defmt-rtt.workspace = true 10 - defmt.workspace = true 11 - embassy-executor.workspace = true 12 - embassy-stm32.workspace = true 13 - embassy-time.workspace = true 14 - embassy-net.workspace = true 15 - embassy-futures.workspace = true 16 - embedded-hal.workspace = true 17 - ergot.workspace = true 18 - heapless.workspace = true 19 - mutex.workspace = true 20 - panic-probe.workspace = true 21 - postcard-schema.workspace = true 22 - serde.workspace = true 23 - static_cell.workspace = true 24 - bbq2.workspace = true 25 - log = "0.4.27" 26 - embedded-alloc.workspace = true
···
-5
demos/stm32h743zi/nucleoh743zi-net-udp-pair/build.rs
··· 1 - fn main() { 2 - println!("cargo:rustc-link-arg-bins=--nmagic"); 3 - println!("cargo:rustc-link-arg-bins=-Tlink.x"); 4 - println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); 5 - }
···
-382
demos/stm32h743zi/nucleoh743zi-net-udp-pair/src/bin/controller.rs
··· 1 - #![no_std] 2 - #![no_main] 3 - extern crate alloc; 4 - 5 - use alloc::boxed::Box; 6 - use core::pin::pin; 7 - 8 - use defmt::*; 9 - use embassy_executor::Spawner; 10 - use embassy_net::StackResources; 11 - use embassy_net::udp::{PacketMetadata, UdpSocket}; 12 - use embassy_net::{IpEndpoint, Ipv4Address}; 13 - use embassy_stm32::eth::PacketQueue; 14 - use embassy_stm32::eth::{Ethernet, GenericPhy}; 15 - use embassy_stm32::pac::rcc::vals::{Pllm, Plln, Pllsrc}; 16 - use embassy_stm32::peripherals::ETH; 17 - use embassy_stm32::rcc::mux::{ 18 - Fdcansel, Fmcsel, I2c4sel, I2c1235sel, Saisel, Sdmmcsel, Spi6sel, Spi45sel, Usart16910sel, Usart234578sel, Usbsel, 19 - }; 20 - use embassy_stm32::rcc::{AHBPrescaler, APBPrescaler, LsConfig, PllDiv, Sysclk}; 21 - use embassy_stm32::rng::Rng; 22 - use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rcc, rng}; 23 - use embassy_time::{Duration, Ticker, Timer, WithTimeout}; 24 - use embedded_alloc::LlffHeap as Heap; 25 - use ergot::exports::bbq2::traits::coordination::cas::AtomicCoord; 26 - use ergot::interface_manager::profiles::direct_edge::embassy_net_udp_0_7::{RxTxWorker, UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX, UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX}; 27 - use ergot::logging::log_v0_4::LogSink; 28 - use ergot::toolkits::embassy_net_v0_7 as kit; 29 - use ergot::well_known::ErgotPingEndpoint; 30 - use ergot::{Address, topic}; 31 - use mutex::raw_impls::cs::CriticalSectionRawMutex; 32 - use static_cell::{ConstStaticCell, StaticCell}; 33 - use {defmt_rtt as _, panic_probe as _}; 34 - 35 - const OUT_QUEUE_SIZE: usize = 4096; 36 - 37 - type Stack = kit::EdgeStack<&'static Queue, CriticalSectionRawMutex>; 38 - type Queue = kit::Queue<OUT_QUEUE_SIZE, AtomicCoord>; 39 - 40 - /// Statically store our netstack 41 - static STACK: Stack = kit::new_controller_stack(OUTQ.framed_producer(), UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX as u16); 42 - /// Statically store our outgoing packet buffer 43 - static OUTQ: Queue = kit::Queue::new(); 44 - /// Statically store receive buffers 45 - static SCRATCH_BUF: ConstStaticCell<[u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]> = ConstStaticCell::new([0u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]); 46 - 47 - static LOGSINK: LogSink<&'static Stack> = LogSink::new(&STACK); 48 - 49 - #[derive(Debug, Copy, Clone, PartialEq, Hash)] 50 - #[allow(dead_code)] 51 - enum CpuRevision { 52 - RevV, 53 - RevY, 54 - RevZ, 55 - } 56 - const CPU_REV: CpuRevision = CpuRevision::RevY; 57 - 58 - #[global_allocator] 59 - static HEAP: Heap = Heap::empty(); 60 - 61 - bind_interrupts!(struct Irqs { 62 - ETH => eth::InterruptHandler; 63 - RNG => rng::InterruptHandler<peripherals::RNG>; 64 - }); 65 - 66 - #[embassy_executor::main] 67 - async fn main(spawner: Spawner) -> ! { 68 - let mut config = Config::default(); 69 - config.rcc.hse = Some(rcc::Hse { 70 - freq: embassy_stm32::time::Hertz(8_000_000), 71 - mode: rcc::HseMode::Oscillator, 72 - }); 73 - config.rcc.ls = LsConfig::off(); 74 - config.rcc.hsi48 = Some(Default::default()); // needed for RNG 75 - config.rcc.sys = Sysclk::PLL1_P; 76 - config.rcc.d1c_pre = AHBPrescaler::DIV1; 77 - config.rcc.ahb_pre = AHBPrescaler::DIV2; 78 - config.rcc.apb1_pre = APBPrescaler::DIV2; 79 - config.rcc.apb2_pre = APBPrescaler::DIV2; 80 - config.rcc.apb3_pre = APBPrescaler::DIV2; 81 - config.rcc.apb4_pre = APBPrescaler::DIV2; 82 - config.rcc.timer_prescaler = rcc::TimerPrescaler::DefaultX2; 83 - 84 - if CPU_REV == CpuRevision::RevV { 85 - config.rcc.voltage_scale = rcc::VoltageScale::Scale0; 86 - config.rcc.pll1 = Some(rcc::Pll { 87 - source: Pllsrc::HSE, 88 - prediv: Pllm::DIV1, 89 - mul: Plln::MUL120, 90 - // 480Mhz 91 - divp: Some(PllDiv::DIV2), 92 - // 160Mhz 93 - divq: Some(PllDiv::DIV6), 94 - divr: None, 95 - }); 96 - } else { 97 - config.rcc.voltage_scale = rcc::VoltageScale::Scale1; 98 - config.rcc.pll1 = Some(rcc::Pll { 99 - source: Pllsrc::HSE, 100 - prediv: Pllm::DIV1, 101 - mul: Plln::MUL100, 102 - // 400Mhz 103 - divp: Some(PllDiv::DIV2), 104 - // 160Mhz 105 - divq: Some(PllDiv::DIV5), 106 - divr: None, 107 - }); 108 - } 109 - config.rcc.pll2 = Some(rcc::Pll { 110 - source: Pllsrc::HSE, 111 - 112 - prediv: Pllm::DIV4, 113 - mul: Plln::MUL200, 114 - // 200Mhz 115 - divp: Some(PllDiv::DIV2), 116 - // 100Mhz 117 - divq: Some(PllDiv::DIV4), 118 - // 200Mhz 119 - divr: Some(PllDiv::DIV2), 120 - }); 121 - config.rcc.pll3 = Some(rcc::Pll { 122 - source: Pllsrc::HSE, 123 - prediv: Pllm::DIV4, 124 - mul: Plln::MUL192, 125 - // 192Mhz 126 - divp: Some(PllDiv::DIV2), 127 - // 48Mhz 128 - divq: Some(PllDiv::DIV8), 129 - // 92Mhz 130 - divr: Some(PllDiv::DIV4), 131 - }); 132 - 133 - // 200mhz 134 - config.rcc.mux.quadspisel = Fmcsel::PLL2_R; 135 - // 200mhz 136 - config.rcc.mux.sdmmcsel = Sdmmcsel::PLL2_R; 137 - // 100mhz 138 - config.rcc.mux.fdcansel = Fdcansel::PLL2_Q; 139 - // 48mhz from crystal (not RC48) 140 - config.rcc.mux.usbsel = Usbsel::PLL3_Q; 141 - // 100/120mhz 142 - config.rcc.mux.usart234578sel = Usart234578sel::PCLK1; 143 - // 100/120mhz 144 - config.rcc.mux.usart16910sel = Usart16910sel::PCLK2; 145 - // 100/120mhz 146 - config.rcc.mux.i2c1235sel = I2c1235sel::PCLK1; 147 - // 100mhz 148 - config.rcc.mux.i2c4sel = I2c4sel::PCLK4; 149 - // 200mhz 150 - config.rcc.mux.spi123sel = Saisel::PLL2_P; 151 - // 100mhz 152 - config.rcc.mux.spi45sel = Spi45sel::PLL2_Q; 153 - // 100mhz 154 - config.rcc.mux.spi6sel = Spi6sel::PLL2_Q; 155 - 156 - let p = embassy_stm32::init(config); 157 - 158 - init_heap(); 159 - 160 - // Generate random seed. 161 - info!("Initializing RNG"); 162 - let mut rng = Rng::new(p.RNG, Irqs); 163 - let mut seed = [0; 8]; 164 - rng.fill_bytes(&mut seed); 165 - let seed = u64::from_le_bytes(seed); 166 - 167 - info!("Initializing ETH"); 168 - // TODO generate mac address from CPU ID 169 - // potentially using this algorythm (C): https://github.com/zephyrproject-rtos/zephyr/issues/59993#issuecomment-1644030438 170 - let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; 171 - 172 - static PACKETS: StaticCell<PacketQueue<8, 8>> = StaticCell::new(); 173 - // warning: Not all STM32H7 devices have the exact same pins here 174 - // for STM32H747XIH, replace p.PB13 for PG12 175 - let device = Ethernet::new( 176 - PACKETS.init(PacketQueue::<8, 8>::new()), 177 - p.ETH, 178 - Irqs, 179 - p.PA1, // ref_clk 180 - p.PA2, // mdio 181 - p.PC1, // eth_mdc 182 - p.PA7, // CRS_DV: Carrier Sense 183 - p.PC4, // RX_D0: Received Bit 0 184 - p.PC5, // RX_D1: Received Bit 1 185 - p.PG13, // TX_D0: Transmit Bit 0 186 - p.PB13, // TX_D1: Transmit Bit 1 187 - p.PG11, // TX_EN: Transmit Enable 188 - GenericPhy::new_auto(), 189 - mac_addr, 190 - ); 191 - 192 - let config = embassy_net::Config::dhcpv4(Default::default()); 193 - //let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { 194 - // address: Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), 195 - // dns_servers: Vec::new(), 196 - // gateway: Some(Ipv4Address::new(10, 42, 0, 1)), 197 - //}); 198 - 199 - // Init network stack 200 - static RESOURCES: StaticCell<StackResources<5>> = StaticCell::new(); 201 - let (embassy_net_stack, runner) = embassy_net::new(device, config, RESOURCES.init(StackResources::new()), seed); 202 - 203 - // Launch network task 204 - spawner.must_spawn(embassy_net_task(runner)); 205 - 206 - // Ensure DHCP configuration is up before trying connect 207 - let mut attempts: u32 = 0; 208 - let config = loop { 209 - if let Some(config) = embassy_net_stack.config_v4() { 210 - break config; 211 - } 212 - 213 - if attempts % 10 == 0 { 214 - info!("Waiting for DHCP address allocation..."); 215 - } 216 - 217 - attempts = attempts.wrapping_add(1); 218 - Timer::after(Duration::from_millis(100)).await; 219 - }; 220 - 221 - info!( 222 - "IP address: {}, gateway: {}, dns: {}", 223 - config.address, config.dns_servers, config.gateway 224 - ); 225 - 226 - let rx_meta = [PacketMetadata::EMPTY; 1]; 227 - let rx_buffer = [0; 4096]; 228 - let tx_meta = [PacketMetadata::EMPTY; 1]; 229 - let tx_buffer = [0; 4096]; 230 - 231 - // move the buffers into the heap, so they don't get dropped 232 - let rx_meta = Box::new(rx_meta); 233 - let rx_meta = Box::leak(rx_meta); 234 - let tx_meta = Box::new(tx_meta); 235 - let tx_meta = Box::leak(tx_meta); 236 - let rx_buffer = Box::new(rx_buffer); 237 - let rx_buffer = Box::leak(rx_buffer); 238 - let tx_buffer = Box::new(tx_buffer); 239 - let tx_buffer = Box::leak(tx_buffer); 240 - // You need to start a server on the host machine, for example: `nc -lu 8000` 241 - 242 - let mut socket = UdpSocket::new(embassy_net_stack, rx_meta, rx_buffer, tx_meta, tx_buffer); 243 - 244 - let port = 8000_u16; 245 - let remote_endpoint = IpEndpoint::new(Ipv4Address::new(192, 168, 18, 65).into(), port); 246 - let local_endpoint = IpEndpoint::new(config.address.address().into(), port); 247 - socket 248 - .bind(local_endpoint) 249 - .expect("bound"); 250 - 251 - info!( 252 - "capacity, receive: {}, send: {}", 253 - socket.packet_recv_capacity(), 254 - socket.packet_send_capacity() 255 - ); 256 - 257 - // Spawn I/O worker tasks 258 - spawner.must_spawn(run_socket(socket, SCRATCH_BUF.take(), remote_endpoint)); 259 - 260 - // Spawn socket using tasks 261 - spawner.must_spawn(pingserver()); 262 - spawner.must_spawn(pinger()); 263 - 264 - spawner.must_spawn(yeeter()); 265 - spawner.must_spawn(yeet_listener(0)); 266 - 267 - LOGSINK.register_static(log::LevelFilter::Info); 268 - 269 - let mut tckr = Ticker::every(Duration::from_secs(2)); 270 - let mut ct = 0; 271 - loop { 272 - tckr.next().await; 273 - log::info!("log # {ct}"); 274 - ct += 1; 275 - } 276 - } 277 - 278 - type Device = Ethernet<'static, ETH, GenericPhy>; 279 - 280 - #[embassy_executor::task] 281 - async fn embassy_net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { 282 - runner.run().await 283 - } 284 - 285 - #[embassy_executor::task] 286 - async fn run_socket( 287 - socket: UdpSocket<'static>, 288 - scratch_buf: &'static mut [u8], 289 - endpoint: IpEndpoint, 290 - ) { 291 - let consumer = OUTQ.framed_consumer(); 292 - let mut rxtx = RxTxWorker::new_controller(&STACK, socket, (), consumer, endpoint); 293 - 294 - loop { 295 - _ = rxtx.run(scratch_buf).await; 296 - } 297 - } 298 - 299 - #[embassy_executor::task] 300 - async fn pinger() { 301 - let mut ticker = Ticker::every(Duration::from_secs(1)); 302 - let mut ctr = 0u32; 303 - let client = STACK 304 - .endpoints() 305 - .client::<ErgotPingEndpoint>( 306 - Address { 307 - network_id: 1, 308 - node_id: 2, 309 - port_id: 0, 310 - }, 311 - None, 312 - ); 313 - loop { 314 - ticker.next().await; 315 - let res = client 316 - .request(&ctr) 317 - .with_timeout(Duration::from_millis(100)) 318 - .await; 319 - match res { 320 - Ok(Ok(n)) => { 321 - defmt::info!("Got ping {=u32} -> {=u32}", ctr, n); 322 - ctr = ctr.wrapping_add(1); 323 - } 324 - Ok(Err(_e)) => { 325 - defmt::warn!("Net stack ping error"); 326 - } 327 - Err(_) => { 328 - defmt::warn!("Ping timeout"); 329 - } 330 - } 331 - } 332 - } 333 - 334 - /// Respond to any incoming pings 335 - #[embassy_executor::task] 336 - async fn pingserver() { 337 - STACK 338 - .services() 339 - .ping_handler::<4>() 340 - .await; 341 - } 342 - 343 - topic!(YeetTopic, u64, "topic/yeet"); 344 - 345 - #[embassy_executor::task] 346 - async fn yeeter() { 347 - let mut ctr = 0; 348 - info!("Yeeter started"); 349 - Timer::after(Duration::from_secs(3)).await; 350 - loop { 351 - Timer::after(Duration::from_secs(5)).await; 352 - warn!("Sending broadcast message. ctr: {}", ctr); 353 - STACK 354 - .topics() 355 - .broadcast::<YeetTopic>(&ctr, None) 356 - .unwrap(); 357 - ctr += 1; 358 - } 359 - } 360 - 361 - #[embassy_executor::task] 362 - async fn yeet_listener(id: u8) { 363 - let subber = STACK 364 - .topics() 365 - .bounded_receiver::<YeetTopic, 4>(None); 366 - let subber = pin!(subber); 367 - let mut hdl = subber.subscribe(); 368 - 369 - info!("Yeet listener started"); 370 - loop { 371 - let msg = hdl.recv().await; 372 - info!("{:?}: Listener id:{} got {}", msg.hdr, id, msg.t); 373 - } 374 - } 375 - 376 - #[allow(static_mut_refs)] 377 - fn init_heap() { 378 - use core::mem::MaybeUninit; 379 - const HEAP_SIZE: usize = 65536; 380 - static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; 381 - unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) } 382 - }
···
-382
demos/stm32h743zi/nucleoh743zi-net-udp-pair/src/bin/target.rs
··· 1 - #![no_std] 2 - #![no_main] 3 - extern crate alloc; 4 - 5 - use alloc::boxed::Box; 6 - use core::pin::pin; 7 - 8 - use defmt::*; 9 - use embassy_executor::Spawner; 10 - use embassy_net::StackResources; 11 - use embassy_net::udp::{PacketMetadata, UdpSocket}; 12 - use embassy_net::{IpEndpoint, Ipv4Address}; 13 - use embassy_stm32::eth::PacketQueue; 14 - use embassy_stm32::eth::{Ethernet, GenericPhy}; 15 - use embassy_stm32::pac::rcc::vals::{Pllm, Plln, Pllsrc}; 16 - use embassy_stm32::peripherals::ETH; 17 - use embassy_stm32::rcc::mux::{ 18 - Fdcansel, Fmcsel, I2c4sel, I2c1235sel, Saisel, Sdmmcsel, Spi6sel, Spi45sel, Usart16910sel, Usart234578sel, Usbsel, 19 - }; 20 - use embassy_stm32::rcc::{AHBPrescaler, APBPrescaler, LsConfig, PllDiv, Sysclk}; 21 - use embassy_stm32::rng::Rng; 22 - use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rcc, rng}; 23 - use embassy_time::{Duration, Ticker, Timer, WithTimeout}; 24 - use embedded_alloc::LlffHeap as Heap; 25 - use ergot::exports::bbq2::traits::coordination::cas::AtomicCoord; 26 - use ergot::interface_manager::profiles::direct_edge::embassy_net_udp_0_7::{RxTxWorker, UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX, UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX}; 27 - use ergot::logging::log_v0_4::LogSink; 28 - use ergot::toolkits::embassy_net_v0_7 as kit; 29 - use ergot::well_known::ErgotPingEndpoint; 30 - use ergot::{Address, topic}; 31 - use mutex::raw_impls::cs::CriticalSectionRawMutex; 32 - use static_cell::{ConstStaticCell, StaticCell}; 33 - use {defmt_rtt as _, panic_probe as _}; 34 - 35 - const OUT_QUEUE_SIZE: usize = 4096; 36 - 37 - type Stack = kit::EdgeStack<&'static Queue, CriticalSectionRawMutex>; 38 - type Queue = kit::Queue<OUT_QUEUE_SIZE, AtomicCoord>; 39 - 40 - /// Statically store our netstack 41 - static STACK: Stack = kit::new_target_stack(OUTQ.framed_producer(), UDP_OVER_ETH_ERGOT_FRAME_SIZE_MAX as u16); 42 - /// Statically store our outgoing packet buffer 43 - static OUTQ: Queue = kit::Queue::new(); 44 - /// Statically store receive buffers 45 - static SCRATCH_BUF: ConstStaticCell<[u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]> = ConstStaticCell::new([0u8; UDP_OVER_ETH_ERGOT_PAYLOAD_SIZE_MAX]); 46 - 47 - static LOGSINK: LogSink<&'static Stack> = LogSink::new(&STACK); 48 - 49 - #[derive(Debug, Copy, Clone, PartialEq, Hash)] 50 - #[allow(dead_code)] 51 - enum CpuRevision { 52 - RevV, 53 - RevY, 54 - RevZ, 55 - } 56 - const CPU_REV: CpuRevision = CpuRevision::RevY; 57 - 58 - #[global_allocator] 59 - static HEAP: Heap = Heap::empty(); 60 - 61 - bind_interrupts!(struct Irqs { 62 - ETH => eth::InterruptHandler; 63 - RNG => rng::InterruptHandler<peripherals::RNG>; 64 - }); 65 - 66 - #[embassy_executor::main] 67 - async fn main(spawner: Spawner) -> ! { 68 - let mut config = Config::default(); 69 - config.rcc.hse = Some(rcc::Hse { 70 - freq: embassy_stm32::time::Hertz(8_000_000), 71 - mode: rcc::HseMode::Oscillator, 72 - }); 73 - config.rcc.ls = LsConfig::off(); 74 - config.rcc.hsi48 = Some(Default::default()); // needed for RNG 75 - config.rcc.sys = Sysclk::PLL1_P; 76 - config.rcc.d1c_pre = AHBPrescaler::DIV1; 77 - config.rcc.ahb_pre = AHBPrescaler::DIV2; 78 - config.rcc.apb1_pre = APBPrescaler::DIV2; 79 - config.rcc.apb2_pre = APBPrescaler::DIV2; 80 - config.rcc.apb3_pre = APBPrescaler::DIV2; 81 - config.rcc.apb4_pre = APBPrescaler::DIV2; 82 - config.rcc.timer_prescaler = rcc::TimerPrescaler::DefaultX2; 83 - 84 - if CPU_REV == CpuRevision::RevV { 85 - config.rcc.voltage_scale = rcc::VoltageScale::Scale0; 86 - config.rcc.pll1 = Some(rcc::Pll { 87 - source: Pllsrc::HSE, 88 - prediv: Pllm::DIV1, 89 - mul: Plln::MUL120, 90 - // 480Mhz 91 - divp: Some(PllDiv::DIV2), 92 - // 160Mhz 93 - divq: Some(PllDiv::DIV6), 94 - divr: None, 95 - }); 96 - } else { 97 - config.rcc.voltage_scale = rcc::VoltageScale::Scale1; 98 - config.rcc.pll1 = Some(rcc::Pll { 99 - source: Pllsrc::HSE, 100 - prediv: Pllm::DIV1, 101 - mul: Plln::MUL100, 102 - // 400Mhz 103 - divp: Some(PllDiv::DIV2), 104 - // 160Mhz 105 - divq: Some(PllDiv::DIV5), 106 - divr: None, 107 - }); 108 - } 109 - config.rcc.pll2 = Some(rcc::Pll { 110 - source: Pllsrc::HSE, 111 - 112 - prediv: Pllm::DIV4, 113 - mul: Plln::MUL200, 114 - // 200Mhz 115 - divp: Some(PllDiv::DIV2), 116 - // 100Mhz 117 - divq: Some(PllDiv::DIV4), 118 - // 200Mhz 119 - divr: Some(PllDiv::DIV2), 120 - }); 121 - config.rcc.pll3 = Some(rcc::Pll { 122 - source: Pllsrc::HSE, 123 - prediv: Pllm::DIV4, 124 - mul: Plln::MUL192, 125 - // 192Mhz 126 - divp: Some(PllDiv::DIV2), 127 - // 48Mhz 128 - divq: Some(PllDiv::DIV8), 129 - // 92Mhz 130 - divr: Some(PllDiv::DIV4), 131 - }); 132 - 133 - // 200mhz 134 - config.rcc.mux.quadspisel = Fmcsel::PLL2_R; 135 - // 200mhz 136 - config.rcc.mux.sdmmcsel = Sdmmcsel::PLL2_R; 137 - // 100mhz 138 - config.rcc.mux.fdcansel = Fdcansel::PLL2_Q; 139 - // 48mhz from crystal (not RC48) 140 - config.rcc.mux.usbsel = Usbsel::PLL3_Q; 141 - // 100/120mhz 142 - config.rcc.mux.usart234578sel = Usart234578sel::PCLK1; 143 - // 100/120mhz 144 - config.rcc.mux.usart16910sel = Usart16910sel::PCLK2; 145 - // 100/120mhz 146 - config.rcc.mux.i2c1235sel = I2c1235sel::PCLK1; 147 - // 100mhz 148 - config.rcc.mux.i2c4sel = I2c4sel::PCLK4; 149 - // 200mhz 150 - config.rcc.mux.spi123sel = Saisel::PLL2_P; 151 - // 100mhz 152 - config.rcc.mux.spi45sel = Spi45sel::PLL2_Q; 153 - // 100mhz 154 - config.rcc.mux.spi6sel = Spi6sel::PLL2_Q; 155 - 156 - let p = embassy_stm32::init(config); 157 - 158 - init_heap(); 159 - 160 - // Generate random seed. 161 - info!("Initializing RNG"); 162 - let mut rng = Rng::new(p.RNG, Irqs); 163 - let mut seed = [0; 8]; 164 - rng.fill_bytes(&mut seed); 165 - let seed = u64::from_le_bytes(seed); 166 - 167 - info!("Initializing ETH"); 168 - // TODO generate mac address from CPU ID 169 - // potentially using this algorythm (C): https://github.com/zephyrproject-rtos/zephyr/issues/59993#issuecomment-1644030438 170 - let mac_addr = [0x00, 0x00, 0xFE, 0xED, 0xF0, 0x0D]; 171 - 172 - static PACKETS: StaticCell<PacketQueue<8, 8>> = StaticCell::new(); 173 - // warning: Not all STM32H7 devices have the exact same pins here 174 - // for STM32H747XIH, replace p.PB13 for PG12 175 - let device = Ethernet::new( 176 - PACKETS.init(PacketQueue::<8, 8>::new()), 177 - p.ETH, 178 - Irqs, 179 - p.PA1, // ref_clk 180 - p.PA2, // mdio 181 - p.PC1, // eth_mdc 182 - p.PA7, // CRS_DV: Carrier Sense 183 - p.PC4, // RX_D0: Received Bit 0 184 - p.PC5, // RX_D1: Received Bit 1 185 - p.PG13, // TX_D0: Transmit Bit 0 186 - p.PB13, // TX_D1: Transmit Bit 1 187 - p.PG11, // TX_EN: Transmit Enable 188 - GenericPhy::new_auto(), 189 - mac_addr, 190 - ); 191 - 192 - let config = embassy_net::Config::dhcpv4(Default::default()); 193 - //let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { 194 - // address: Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), 195 - // dns_servers: Vec::new(), 196 - // gateway: Some(Ipv4Address::new(10, 42, 0, 1)), 197 - //}); 198 - 199 - // Init network stack 200 - static RESOURCES: StaticCell<StackResources<5>> = StaticCell::new(); 201 - let (embassy_net_stack, runner) = embassy_net::new(device, config, RESOURCES.init(StackResources::new()), seed); 202 - 203 - // Launch network task 204 - spawner.must_spawn(embassy_net_task(runner)); 205 - 206 - // Ensure DHCP configuration is up before trying connect 207 - let mut attempts: u32 = 0; 208 - let config = loop { 209 - if let Some(config) = embassy_net_stack.config_v4() { 210 - break config; 211 - } 212 - 213 - if attempts % 10 == 0 { 214 - info!("Waiting for DHCP address allocation..."); 215 - } 216 - 217 - attempts = attempts.wrapping_add(1); 218 - Timer::after(Duration::from_millis(100)).await; 219 - }; 220 - 221 - info!( 222 - "IP address: {}, gateway: {}, dns: {}", 223 - config.address, config.dns_servers, config.gateway 224 - ); 225 - 226 - let rx_meta = [PacketMetadata::EMPTY; 1]; 227 - let rx_buffer = [0; 4096]; 228 - let tx_meta = [PacketMetadata::EMPTY; 1]; 229 - let tx_buffer = [0; 4096]; 230 - 231 - // move the buffers into the heap, so they don't get dropped 232 - let rx_meta = Box::new(rx_meta); 233 - let rx_meta = Box::leak(rx_meta); 234 - let tx_meta = Box::new(tx_meta); 235 - let tx_meta = Box::leak(tx_meta); 236 - let rx_buffer = Box::new(rx_buffer); 237 - let rx_buffer = Box::leak(rx_buffer); 238 - let tx_buffer = Box::new(tx_buffer); 239 - let tx_buffer = Box::leak(tx_buffer); 240 - // You need to start a server on the host machine, for example: `nc -lu 8000` 241 - 242 - let mut socket = UdpSocket::new(embassy_net_stack, rx_meta, rx_buffer, tx_meta, tx_buffer); 243 - 244 - let port = 8000_u16; 245 - let remote_endpoint = IpEndpoint::new(Ipv4Address::new(192, 168, 18, 64).into(), port); 246 - let local_endpoint = IpEndpoint::new(config.address.address().into(), port); 247 - socket 248 - .bind(local_endpoint) 249 - .expect("bound"); 250 - 251 - info!( 252 - "capacity, receive: {}, send: {}", 253 - socket.packet_recv_capacity(), 254 - socket.packet_send_capacity() 255 - ); 256 - 257 - // Spawn I/O worker tasks 258 - spawner.must_spawn(run_socket(socket, SCRATCH_BUF.take(), remote_endpoint)); 259 - 260 - // Spawn socket using tasks 261 - spawner.must_spawn(pingserver()); 262 - spawner.must_spawn(pinger()); 263 - 264 - spawner.must_spawn(yeeter()); 265 - spawner.must_spawn(yeet_listener(0)); 266 - 267 - LOGSINK.register_static(log::LevelFilter::Info); 268 - 269 - let mut tckr = Ticker::every(Duration::from_secs(2)); 270 - let mut ct = 0; 271 - loop { 272 - tckr.next().await; 273 - log::info!("log # {ct}"); 274 - ct += 1; 275 - } 276 - } 277 - 278 - type Device = Ethernet<'static, ETH, GenericPhy>; 279 - 280 - #[embassy_executor::task] 281 - async fn embassy_net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { 282 - runner.run().await 283 - } 284 - 285 - #[embassy_executor::task] 286 - async fn run_socket( 287 - socket: UdpSocket<'static>, 288 - scratch_buf: &'static mut [u8], 289 - endpoint: IpEndpoint, 290 - ) { 291 - let consumer = OUTQ.framed_consumer(); 292 - let mut rxtx = RxTxWorker::new_target(&STACK, socket, (), consumer, endpoint); 293 - 294 - loop { 295 - _ = rxtx.run(scratch_buf).await; 296 - } 297 - } 298 - 299 - #[embassy_executor::task] 300 - async fn pinger() { 301 - let mut ticker = Ticker::every(Duration::from_secs(1)); 302 - let mut ctr = 0u32; 303 - let client = STACK 304 - .endpoints() 305 - .client::<ErgotPingEndpoint>( 306 - Address { 307 - network_id: 1, 308 - node_id: 1, 309 - port_id: 0, 310 - }, 311 - None, 312 - ); 313 - loop { 314 - ticker.next().await; 315 - let res = client 316 - .request(&ctr) 317 - .with_timeout(Duration::from_millis(100)) 318 - .await; 319 - match res { 320 - Ok(Ok(n)) => { 321 - defmt::info!("Got ping {=u32} -> {=u32}", ctr, n); 322 - ctr = ctr.wrapping_add(1); 323 - } 324 - Ok(Err(_e)) => { 325 - defmt::warn!("Net stack ping error"); 326 - } 327 - Err(_) => { 328 - defmt::warn!("Ping timeout"); 329 - } 330 - } 331 - } 332 - } 333 - 334 - /// Respond to any incoming pings 335 - #[embassy_executor::task] 336 - async fn pingserver() { 337 - STACK 338 - .services() 339 - .ping_handler::<4>() 340 - .await; 341 - } 342 - 343 - topic!(YeetTopic, u64, "topic/yeet"); 344 - 345 - #[embassy_executor::task] 346 - async fn yeeter() { 347 - let mut ctr = 0; 348 - info!("Yeeter started"); 349 - Timer::after(Duration::from_secs(3)).await; 350 - loop { 351 - Timer::after(Duration::from_secs(5)).await; 352 - warn!("Sending broadcast message. ctr: {}", ctr); 353 - STACK 354 - .topics() 355 - .broadcast::<YeetTopic>(&ctr, None) 356 - .unwrap(); 357 - ctr += 1; 358 - } 359 - } 360 - 361 - #[embassy_executor::task] 362 - async fn yeet_listener(id: u8) { 363 - let subber = STACK 364 - .topics() 365 - .bounded_receiver::<YeetTopic, 4>(None); 366 - let subber = pin!(subber); 367 - let mut hdl = subber.subscribe(); 368 - 369 - info!("Yeet listener started"); 370 - loop { 371 - let msg = hdl.recv().await; 372 - info!("{:?}: Listener id:{} got {}", msg.hdr, id, msg.t); 373 - } 374 - } 375 - 376 - #[allow(static_mut_refs)] 377 - fn init_heap() { 378 - use core::mem::MaybeUninit; 379 - const HEAP_SIZE: usize = 65536; 380 - static mut HEAP_MEM: [MaybeUninit<u8>; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; 381 - unsafe { HEAP.init(HEAP_MEM.as_ptr() as usize, HEAP_SIZE) } 382 - }
···
+238
notes/proposals/0145-phone-number-addressing.md
···
··· 1 + # Phone number addressing 2 + 3 + Status: WIP 4 + 5 + This is a proposal to move from AppleTalk-style "fixed class" routing, to a technique we're referring to as "phone number addressing". 6 + 7 + As the name suggests, this technique takes inspiration from the way that phone numbers in many locations operate: 8 + 9 + * You can dial "local" numbers using a shorter number 10 + * You can dial "further away" numbers using a longer number 11 + * The shorter "local" numbers are a suffix of the longer "further away" numbers. 12 + 13 + Phone number addressing is a form of [prefix coding](https://en.wikipedia.org/wiki/Prefix_code), and is somewhat inspired by [Classless Inter-Domain Routing (CIDR)](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) from TCP/IP, but diverges somewhat in usage. 14 + 15 + As an example, within your *building*, you could dial any 4-digit number, e.g. 1234, to reach that room. Your building may have a prefix of 678, meaning that from other buildings (but still on your street), you could dial 678-1234 to reach that same room. Within your city, your street may have the prefix of 808, meaning that someone on the other side of the city could reach that same room by dialing 808-678-1234. Even if your street was reassigned a new prefix, changing 808 to 909, people on your street (and in all buildings) would be unaffected by the change when dialing inside of the "relocated" street. 16 + 17 + The primary motivations of this scheme are: 18 + 19 + * We can use shorter numbers when speaking "locally", reducing the amount of data sent in every packet 20 + * Zones of entities that may "travel together" can assign and retain stable addresses autonomously, even if they are relocated and assigned a different prefix, or go from "disconnected" to "connected" with a larger network. 21 + 22 + Currently, Phone Number Addressing is only intended to provide addressing for strictly hierarchical networks, e.g. those without loops or duplicate routes. This simplification/restriction makes it unsuitable for general "internet" style routing, but still usable for the simple networks targeted by ergot. 23 + 24 + ## Implementation Details 25 + 26 + For the current implementation, an address space of 32 bits is planned, though this may be expanded in the future. 27 + 28 + In *contrast* to CIDR notation, which uses the `/N` notation to state how many bits are in the PREFIX, e.g. `/24` means that there are 24 "network prefix" bits, and 8 "host identifier" bits, we will use the "PNA" (Phone Number Addressing) notation `^N` to denote the number of significant address bits. This means that an address notated `^8` would have eight address bits used, with an unused 24 bits as a prefix. This `^8` would contain up to 256 addresses (including any reserved addresses), and would take up the eight *least significant* bits of the 32-bit address space. 29 + 30 + This shift from "left-notation" (in CIDR) to "right-notation" (in PNA) also allows for the removal of ambiguity in the future if 64-bit addresses are allowed. 31 + 32 + Phone Number Addresses are typically written in hexidecimal format, with letters in all caps, and the PNA suffix denoting the "scope" written in decimal form. An address may be written as `3A0^10`, meaning the binary address of `0b11_1010_0000`, or in decimal form: 928. Leading zeros WITHIN the PNA scope should always be contained, e.g. `001^10`, NOT `1^10`. 33 + 34 + A PNA notation of `^0` is invalid, as it describes an address range containing no addresses. 35 + 36 + ## Merging "Network Segments", "Node IDs", and "Ports" 37 + 38 + In the previous system, we had: 39 + 40 + * 16-bit network segments (NET_ID) 41 + * 8-bit node addresses (NODE_ID) 42 + * 8-bit ports for sockets (PORT) 43 + 44 + In general, the `NET_ID.NODE_ID` was used to route to the destination *device*, and once a packet had reached the destination device, the `PORT` would be used to deliver to the relevant socket. 45 + 46 + Under Phone Number Addressing, these concepts are all merged, meaning that a specific address now always refers to a socket. 47 + 48 + ## Address Allocators 49 + 50 + In an ergot network, there may be multiple aspects of the system that act as "Address Allocators". These allocators need to keep track of two primary pieces of information: 51 + 52 + * Their "Pool" of addresses that they can allocate FROM 53 + * Their list of "Allocations", or address ranges within their Poll that have been exclusively assigned. These Allocations include: 54 + * Specific allocations, e.g. single-address assignments to sockets 55 + * Range allocations, e.g. for downstream devices 56 + 57 + For example: 58 + 59 + * A single device might allocate a range of `^7` to itself, to use as a range of socket addresses. 60 + * A routing device may assign `^10` ranges to each of it's "downstream" connected devices 61 + 62 + It is not currently specified whether the "Pool" of addresses are always contiguous, or a single `^N` allocation. 63 + 64 + ### Apex Entities 65 + 66 + An entity without an "upstream" or "parent" entity above them is referred to as an "Apex" entity. 67 + 68 + An Apex entity is able to use the entire 32-bit address space as it sees fit, as it has no upstream network that it needs to "fit within". However, Apex entities may still want to be conservative in how they use this space for two reasons: 69 + 70 + 1. The existence as an "Apex" may be temporary, if they later join a network as a "downstream" or "child" entity 71 + 2. The smaller addresses uses, the more compact they will be when transmitting. 72 + 73 + Currently, it is suggested that Apex entity make a best guess at the maximum address space needed for all downstream entities, including its own local sockets. 74 + 75 + ### Downstream Entities 76 + 77 + Devices that are connected to another device are referred to as "Downstream" entities. They may be directly connected to an Apex entity, or to another Downstream entity with or more "hops" to the Apex entity. 78 + 79 + Like Apex entities, Downstream entities are expected to make a best guess at the size of address space necessary for themselves and any further downstream entitites. 80 + 81 + ### Initializing the Address Allocator 82 + 83 + When an entity first boots, it must initialize its address allocator. The "best guess" address range is used to initialize the pool. 84 + 85 + For example, if a device has guessed that it needs a `^10` address space, it will seed the allocator with that initial `^10` space, giving it the starting range of `000^10` to `3FF^10`, or 0 to 1023. 86 + 87 + The pool is now ready for allocating. As a common first step, an entity will allocate a range for local sockets, usable for handing out individual addresses. It may decide that a `^7` range is suitable for this, allowing for 128 sockets (including reserved addresses), meaning addresses `00^7` to `7F^7` refer to local sockets. This ALSO means that `000^10` to `07F^10` will refer to sockets on THIS entity. 88 + 89 + This would leave the device with addresses `080^10` to `3FF^10` eligible to allocate. 90 + 91 + This space could be divided up in numerous different ways: 92 + 93 + * A single `^9` could be assigned in EITHER of the ranges: 94 + * `100^10` to `2FF^10` (TODO: allow unaligned?) 95 + * `200^10` to `3FF^10` 96 + * Three `^8`s could be assigned in the ranges: 97 + * `100^10` to `1FF^10` 98 + * `200^10` to `2FF^10` 99 + * `300^10` to `3FF^10` 100 + * Seven `^7`s could be assigned in the ranges: 101 + * `080^10` to `0FF^10` 102 + * `100^10` to `17F^10` 103 + * `180^10` to `1FF^10` 104 + * `200^10` to `27F^10` 105 + * `280^10` to `2FF^10` 106 + * `300^10` to `37F^10` 107 + * `380^10` to `3FF^10` 108 + * And so on 109 + 110 + Allocators are NOT required to divide the space evenly, however all divisions must be a power of two, with a minimum size of `^1`. For example, we could end up with: 111 + 112 + * `000^10` to `07F^10`: A `^7` for local sockets 113 + * `080^10` to `0BF^10`: A `^6` for a downstream device 114 + * `0C0^10` to `0FF^10`: A `^6` for a downstream device 115 + * `100^10` to `1FF^10`: A `^8` for a downstream device 116 + * `200^10` to `3FF^10`: A `^9` for a downstream device 117 + 118 + ## Any/All messages 119 + 120 + In the previous system, port `0` was reserved as the "Any" port, which ergot would attempt to find a single port that matched the requested characteristics. Port `255` was reserved as the "All" port, which ergot would flood to all sockets and interfaces, except for the source interface, until the TTL was consumed. 121 + 122 + In the new system, the 0th address in a range is reserved as the "Any/All" port. A bit in the header will be used to determine if a message is a "broadcast" message. This address is allowed to exist in the local "socket" range, as long as the 0th address is not used for a specific socket. 123 + 124 + This "0th" address is also contextually sensitive to the "scope" of the address. 125 + 126 + # Phone Number Addressing, by example 127 + 128 + For example, if we had a network as follows: 129 + 130 + * Entity A, the Apex entity, with an address scope of `^10`: 131 + * `000^10` to `3FF^10` 132 + * A's sockets assigned the scope `^7`: 133 + * `000^10` to `07F^10` OR `00^7` to `7F^7` 134 + * Entity B, a Downstream entity, with an address scope of `^8`: 135 + * `080^10` to `17F^10` OR `00^8` to `FF^8` 136 + * B's sockets assigned the full scope: 137 + * `00^8` to `FF^8` 138 + * Entity C, a Downstream entity, with an address scope of `^9`: 139 + * `180^10` to `37F^10` OR `000^9` to `1FF^9` 140 + * C's sockets assigned the scope `^7`: 141 + * `180^10` to `1FF^10` OR `000^9` to `07F^9` OR `00^7` to `7F^7` 142 + * Entity D, a Downstream entity, with an address scope of `^8`: 143 + * `200^10` to `2FF^10` OR `080^9` to `17F^9` OR `00^8` to `FF^8` 144 + * D's sockets assigned the scope `^7`: 145 + * `200^10` to `27F^10` OR `080^9` to `17F^9` OR `00^8` to `FF^8` 146 + * Entity E, a Downstream entity, with an address scope of `^6`: 147 + * `300^10` to `33F^10` OR `180^9` to `1BF^9` OR `00^6` to `3F^6` 148 + * Entity F, a Downstream entity, with an address scope of `^7`: 149 + * `380^10` to `3FF^10` OR `00^7` to `7F^7` 150 + 151 + Visually: 152 + 153 + ```text 154 + ┌─────────────┬─────────────┐ 155 + │ 000 │ 156 + │ Entity A │ A's Sockets │ 157 + │ ^10 ^7 │ 158 + │ 000-3FF │ 00-7F │ 159 + │ │ 160 + │ 07F│ │ 161 + │ ┌─────────────┼─────────────┐ 162 + │ 080│ 00 │ 163 + │ │ Entity B │ B's Sockets │ 164 + │ │ ^8 ^8 │ 165 + │ │ 00-FF │ 00-FF │ 166 + │ │ │ 167 + │ │ │ │ 168 + │ │ │ 169 + │ │ │ │ 170 + │ │ │ 171 + │ │ │ │ 172 + │ │ │ 173 + │ │ │ │ 174 + │ 17F│ FF │ 175 + │ ├─────────────┼─────────────┤ 176 + │ 180│ 000 │ 177 + │ │ Entity C │ C's Sockets │ 178 + │ │ ^9 ^7 │ 179 + │ │ 000-1FF │ 00-7F │ 180 + │ │ │ 181 + │ 1FF│ 07F│ │ 182 + │ │ ┌─────────────┼─────────────┐ 183 + │ 200│ 080│ 00 │ 184 + │ │ │ Entity D │ D's Sockets │ 185 + │ │ │ ^8 ^7 │ 186 + │ │ │ 00-FF │ 00-7F │ 187 + │ │ │ │ 188 + │ 27F│ 0FF│ 7F│ │ 189 + │ │ │ ┌─────────────┤ 190 + │ 280│ 100│ 80│ │ 191 + │ │ │ │ Unused │ 192 + │ │ │ │ │ 193 + │ │ │ │ │ 194 + │ │ │ │ │ 195 + │ 2FF│ 17F│ FF│ │ 196 + │ │ ├─────────────┼─────────────┤ 197 + │ 300│ 180│ Entity E 00 E's Sockets │ 198 + │ │ │ ^6 │ ^6 │ 199 + │ 33F│ 1BF│ 00-3F 3F 00-3F │ 200 + │ │ ├─────────────┼─────────────┘ 201 + │ 340│ 1C0│ │ 202 + │ │ │ Unused │ 203 + │ 37F│ 1FF│ │ 204 + │ ├─────────────┼─────────────┤ 205 + │ 380│ 00 │ 206 + │ │ Entity F │ F's Sockets │ 207 + │ │ ^7 ^7 │ 208 + │ │ 00-FF │ 00-7F │ 209 + │ │ │ 210 + │ 3FF│ 7F│ │ 211 + └─────────────┴───────────────────────────┘ 212 + ``` 213 + 214 + Like: 215 + 216 + ## How does E find B, and do something with it? 217 + 218 + 219 + 1. E sends a broadcast discovery message to 00000000^32 asking "who has endpoint service $LED_OUTPUT?, with the source address of `03^6`. 220 + 2. E's Profile says "this needs to go to my parent. I am aware my base address in my parent's space is `180^9`. I will forward this message to my parent, C, and update the source address to `183^9`. 221 + 3. C delivers to it's own socket range, as well as to D, both with the source address `183^9`. Let's say neither respond. 222 + 4. C's profile knows it's base address is `180^10`. It forwards to its parent, A, and updates the source address to `303^10`. 223 + 5. A delivers to it's own socket range, as well as entities B and F. Let's say only B cares, and it is delivered to B's 09^8. 224 + 6. B receives the discovery request, and notes that it has an `$LED_OUTPUT` service on socket `0A^8`, which it does ??? to determine that `0A^8` maps to `08A^10`. It replies TO `303^10` with this info. 225 + 7. B sends it to A:303^10 is outside it's range of 080^10 to 17F^10. 226 + 8. A sends it to C, as 303^10 is in the range 180^10 to 37F^10. 227 + 9. C sends it to E, as 303^10 is in the range 300^10 to 33F^10 228 + 10. E gives it to it's own sockets, as 303^10 is in the range 300^10 to 33F^10 229 + 230 + Now: E can send messages to B, using `303^10` as the source (it got this in the header of the reply), and `08A^10` as the destination (it got this in the body of the reply). B can reply to E using the same. 231 + 232 + As descrived, this generally requires: 233 + 234 + 1. All devices know their own range (e.g. E's socket knows it is `03^6`) 235 + 2. The profile of a device knows it's parents range, and it's own offset in that range (e.g. E's profile knows it is 180^9, so its socket is `183^9` 236 + 3. A device has some way of looking up it's offset in a given range, e.g. B's socket `0A^8` can ask `000^10`, "hey what is my offset in the `^10` range?", and get back "you are `08A^10`". 237 + 4. Profiles are smart enough to route UP to addresses outside their range, and DOWN to addresses inside their range 238 + 5. A nice-to-have would be some way to determine the "smallest possible scope" between two addresses. e.g. What is the closest common parent between `08A^10` and `303^10`? In this case it would be `^10`, but for `303^10` and `202^10`, it's actually `^9` (doesn't need to leave C's address space)
+3
notes/proposals/README.md
···
··· 1 + # Proposals for Ergot 2 + 3 + No formal structure yet. This is where proposals go while we're discussing them.