A personal rust firmware for the Badger 2040 W

Compare changes

Choose any two refs to compare.

+2 -1
.gitignore
··· 1 1 /target 2 2 .DS_Store 3 - .env 3 + .env 4 + .idea
+565 -539
Cargo.lock
··· 1 1 # This file is automatically @generated by Cargo. 2 2 # It is not intended for manual editing. 3 - version = 3 3 + version = 4 4 4 5 5 [[package]] 6 6 name = "aead" ··· 38 38 ] 39 39 40 40 [[package]] 41 - name = "ahash" 42 - version = "0.8.11" 43 - source = "registry+https://github.com/rust-lang/crates.io-index" 44 - checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" 45 - dependencies = [ 46 - "cfg-if", 47 - "once_cell", 48 - "version_check", 49 - "zerocopy 0.7.35", 50 - ] 51 - 52 - [[package]] 53 41 name = "aho-corasick" 54 42 version = "1.1.3" 55 43 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 82 70 source = "registry+https://github.com/rust-lang/crates.io-index" 83 71 checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" 84 72 dependencies = [ 85 - "term", 73 + "term 0.7.0", 74 + ] 75 + 76 + [[package]] 77 + name = "ascii-canvas" 78 + version = "4.0.0" 79 + source = "registry+https://github.com/rust-lang/crates.io-index" 80 + checksum = "ef1e3e699d84ab1b0911a1010c5c106aa34ae89aeac103be5ce0c3859db1e891" 81 + dependencies = [ 82 + "term 1.2.0", 86 83 ] 87 84 88 85 [[package]] ··· 138 135 source = "registry+https://github.com/rust-lang/crates.io-index" 139 136 checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" 140 137 dependencies = [ 141 - "bit-vec", 138 + "bit-vec 0.6.3", 139 + ] 140 + 141 + [[package]] 142 + name = "bit-set" 143 + version = "0.8.0" 144 + source = "registry+https://github.com/rust-lang/crates.io-index" 145 + checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" 146 + dependencies = [ 147 + "bit-vec 0.8.0", 142 148 ] 143 149 144 150 [[package]] ··· 148 154 checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" 149 155 150 156 [[package]] 151 - name = "bitfield" 152 - version = "0.13.2" 157 + name = "bit-vec" 158 + version = "0.8.0" 153 159 source = "registry+https://github.com/rust-lang/crates.io-index" 154 - checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 160 + checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" 155 161 156 162 [[package]] 157 163 name = "bitfield" 158 - version = "0.14.0" 164 + version = "0.13.2" 159 165 source = "registry+https://github.com/rust-lang/crates.io-index" 160 - checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" 166 + checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 161 167 162 168 [[package]] 163 169 name = "bitflags" ··· 181 187 ] 182 188 183 189 [[package]] 184 - name = "bt-hci" 185 - version = "0.1.0" 186 - source = "registry+https://github.com/rust-lang/crates.io-index" 187 - checksum = "499d74e90e6b1e61660adc8fb5f17aeac9487bced16f57c1f91a8783736ada53" 188 - dependencies = [ 189 - "defmt", 190 - "embassy-sync 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", 191 - "embassy-time", 192 - "embedded-io", 193 - "embedded-io-async", 194 - "futures-intrusive", 195 - "heapless 0.8.0", 196 - ] 197 - 198 - [[package]] 199 190 name = "buffered-io" 200 191 version = "0.5.4" 201 192 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 207 198 208 199 [[package]] 209 200 name = "byte-slice-cast" 210 - version = "0.3.5" 211 - source = "registry+https://github.com/rust-lang/crates.io-index" 212 - checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" 213 - 214 - [[package]] 215 - name = "byte-slice-cast" 216 - version = "1.2.2" 201 + version = "1.2.3" 217 202 source = "registry+https://github.com/rust-lang/crates.io-index" 218 - checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" 203 + checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" 219 204 220 205 [[package]] 221 206 name = "bytemuck" ··· 274 259 checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" 275 260 dependencies = [ 276 261 "bare-metal", 277 - "bitfield 0.13.2", 262 + "bitfield", 278 263 "embedded-hal 0.2.7", 279 264 "volatile-register", 280 265 ] 281 266 282 267 [[package]] 283 268 name = "cortex-m-rt" 284 - version = "0.7.3" 269 + version = "0.7.5" 285 270 source = "registry+https://github.com/rust-lang/crates.io-index" 286 - checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" 271 + checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" 287 272 dependencies = [ 288 273 "cortex-m-rt-macros", 289 274 ] 290 275 291 276 [[package]] 292 277 name = "cortex-m-rt-macros" 293 - version = "0.7.0" 278 + version = "0.7.5" 294 279 source = "registry+https://github.com/rust-lang/crates.io-index" 295 - checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" 280 + checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" 296 281 dependencies = [ 297 282 "proc-macro2", 298 283 "quote", 299 - "syn 1.0.109", 284 + "syn 2.0.106", 300 285 ] 301 286 302 287 [[package]] ··· 319 304 320 305 [[package]] 321 306 name = "critical-section" 322 - version = "1.1.2" 307 + version = "1.2.0" 323 308 source = "registry+https://github.com/rust-lang/crates.io-index" 324 - checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" 309 + checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 325 310 326 311 [[package]] 327 312 name = "crunchy" ··· 336 321 checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" 337 322 dependencies = [ 338 323 "generic-array 0.14.7", 339 - "rand_core", 324 + "rand_core 0.6.4", 340 325 "subtle", 341 326 "zeroize", 342 327 ] ··· 362 347 363 348 [[package]] 364 349 name = "cyw43" 365 - version = "0.2.0" 366 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 350 + version = "0.5.0" 351 + source = "registry+https://github.com/rust-lang/crates.io-index" 352 + checksum = "85d050df7c6c6d253d1044fd5f011873ec6f434f77c202e7e7e88d5b12a1e943" 367 353 dependencies = [ 368 - "bt-hci", 369 354 "cortex-m", 370 355 "cortex-m-rt", 371 - "defmt", 372 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 373 - "embassy-net-driver-channel 0.3.0", 374 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 356 + "embassy-futures", 357 + "embassy-net-driver-channel", 358 + "embassy-sync", 375 359 "embassy-time", 376 360 "embedded-hal 1.0.0", 377 - "embedded-io-async", 378 361 "futures", 379 362 "heapless 0.8.0", 380 - "num_enum", 363 + "num_enum 0.5.11", 381 364 ] 382 365 383 366 [[package]] 384 367 name = "cyw43-pio" 385 - version = "0.2.0" 386 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 368 + version = "0.8.0" 369 + source = "registry+https://github.com/rust-lang/crates.io-index" 370 + checksum = "86bd7dea4d32a73557be29bfadaaa916e758115ed8b42cfca4fda0a111f07644" 387 371 dependencies = [ 388 372 "cyw43", 389 - "defmt", 373 + "defmt 1.0.1", 390 374 "embassy-rp", 391 375 "fixed", 392 - "pio", 393 - "pio-proc", 394 376 ] 395 377 396 378 [[package]] ··· 414 396 "proc-macro2", 415 397 "quote", 416 398 "strsim", 417 - "syn 2.0.72", 399 + "syn 2.0.106", 418 400 ] 419 401 420 402 [[package]] ··· 425 407 dependencies = [ 426 408 "darling_core", 427 409 "quote", 428 - "syn 2.0.72", 410 + "syn 2.0.106", 429 411 ] 430 412 431 413 [[package]] ··· 436 418 437 419 [[package]] 438 420 name = "defmt" 439 - version = "0.3.8" 421 + version = "0.3.100" 440 422 source = "registry+https://github.com/rust-lang/crates.io-index" 441 - checksum = "a99dd22262668b887121d4672af5a64b238f026099f1a2a1b322066c9ecfe9e0" 423 + checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" 424 + dependencies = [ 425 + "defmt 1.0.1", 426 + ] 427 + 428 + [[package]] 429 + name = "defmt" 430 + version = "1.0.1" 431 + source = "registry+https://github.com/rust-lang/crates.io-index" 432 + checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" 442 433 dependencies = [ 443 434 "bitflags 1.3.2", 444 435 "defmt-macros", ··· 446 437 447 438 [[package]] 448 439 name = "defmt-macros" 449 - version = "0.3.9" 440 + version = "1.0.1" 450 441 source = "registry+https://github.com/rust-lang/crates.io-index" 451 - checksum = "e3a9f309eff1f79b3ebdf252954d90ae440599c26c2c553fe87a2d17195f2dcb" 442 + checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" 452 443 dependencies = [ 453 444 "defmt-parser", 454 - "proc-macro-error", 445 + "proc-macro-error2", 455 446 "proc-macro2", 456 447 "quote", 457 - "syn 2.0.72", 448 + "syn 2.0.106", 458 449 ] 459 450 460 451 [[package]] 461 452 name = "defmt-parser" 462 - version = "0.3.4" 453 + version = "1.0.0" 463 454 source = "registry+https://github.com/rust-lang/crates.io-index" 464 - checksum = "ff4a5fefe330e8d7f31b16a318f9ce81000d8e35e69b93eae154d16d2278f70f" 455 + checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" 465 456 dependencies = [ 466 - "thiserror", 457 + "thiserror 2.0.17", 467 458 ] 468 459 469 460 [[package]] ··· 473 464 checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" 474 465 dependencies = [ 475 466 "critical-section", 476 - "defmt", 467 + "defmt 0.3.100", 477 468 ] 478 469 479 470 [[package]] ··· 484 475 dependencies = [ 485 476 "const-oid", 486 477 "zeroize", 478 + ] 479 + 480 + [[package]] 481 + name = "deranged" 482 + version = "0.5.4" 483 + source = "registry+https://github.com/rust-lang/crates.io-index" 484 + checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" 485 + dependencies = [ 486 + "powerfmt", 487 487 ] 488 488 489 489 [[package]] ··· 522 522 "libc", 523 523 "redox_users", 524 524 "winapi", 525 - ] 526 - 527 - [[package]] 528 - name = "display-interface" 529 - version = "0.4.1" 530 - source = "registry+https://github.com/rust-lang/crates.io-index" 531 - checksum = "7517c040926d7b02b111884aa089177db80878533127f7c1b480d852c5fb4112" 532 - 533 - [[package]] 534 - name = "display-interface-spi" 535 - version = "0.4.1" 536 - source = "registry+https://github.com/rust-lang/crates.io-index" 537 - checksum = "489378ad054862146fbd1f09f51d585ccbe4bd1e2feadcda2a13ac33f840e1a5" 538 - dependencies = [ 539 - "byte-slice-cast 0.3.5", 540 - "display-interface", 541 - "embedded-hal 0.2.7", 542 525 ] 543 526 544 527 [[package]] ··· 569 552 "generic-array 0.14.7", 570 553 "group", 571 554 "hkdf", 572 - "rand_core", 555 + "rand_core 0.6.4", 573 556 "sec1", 574 557 "subtle", 575 558 "zeroize", ··· 577 560 578 561 [[package]] 579 562 name = "embassy-embedded-hal" 580 - version = "0.2.0" 581 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 563 + version = "0.5.0" 564 + source = "registry+https://github.com/rust-lang/crates.io-index" 565 + checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8" 582 566 dependencies = [ 583 - "defmt", 584 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 585 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 586 - "embassy-time", 567 + "defmt 1.0.1", 568 + "embassy-futures", 569 + "embassy-hal-internal", 570 + "embassy-sync", 587 571 "embedded-hal 0.2.7", 588 572 "embedded-hal 1.0.0", 589 573 "embedded-hal-async", ··· 594 578 595 579 [[package]] 596 580 name = "embassy-executor" 597 - version = "0.6.0" 598 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 581 + version = "0.9.1" 582 + source = "registry+https://github.com/rust-lang/crates.io-index" 583 + checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b" 599 584 dependencies = [ 600 585 "cortex-m", 601 586 "critical-section", 602 - "defmt", 587 + "defmt 1.0.1", 603 588 "document-features", 604 589 "embassy-executor-macros", 605 - "embassy-time-driver", 606 - "embassy-time-queue-driver", 590 + "embassy-executor-timer-queue", 607 591 ] 608 592 609 593 [[package]] 610 594 name = "embassy-executor-macros" 611 - version = "0.5.0" 612 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 595 + version = "0.7.0" 596 + source = "registry+https://github.com/rust-lang/crates.io-index" 597 + checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472" 613 598 dependencies = [ 614 599 "darling", 615 600 "proc-macro2", 616 601 "quote", 617 - "syn 2.0.72", 602 + "syn 2.0.106", 618 603 ] 619 604 620 605 [[package]] 621 - name = "embassy-futures" 622 - version = "0.1.1" 606 + name = "embassy-executor-timer-queue" 607 + version = "0.1.0" 623 608 source = "registry+https://github.com/rust-lang/crates.io-index" 624 - checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" 625 - 626 - [[package]] 627 - name = "embassy-futures" 628 - version = "0.1.1" 629 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 609 + checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c" 630 610 631 611 [[package]] 632 612 name = "embassy-futures" 633 - version = "0.1.1" 634 - source = "git+https://github.com/embassy-rs/embassy.git#2b031756c6d705f58de972de48f7300b4fdc673c" 613 + version = "0.1.2" 614 + source = "registry+https://github.com/rust-lang/crates.io-index" 615 + checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" 635 616 636 617 [[package]] 637 618 name = "embassy-hal-internal" 638 - version = "0.2.0" 639 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 619 + version = "0.3.0" 620 + source = "registry+https://github.com/rust-lang/crates.io-index" 621 + checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a" 640 622 dependencies = [ 641 623 "cortex-m", 642 624 "critical-section", 643 - "defmt", 625 + "defmt 1.0.1", 644 626 "num-traits", 645 627 ] 646 628 647 629 [[package]] 648 630 name = "embassy-net" 649 - version = "0.4.0" 650 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 631 + version = "0.7.1" 632 + source = "registry+https://github.com/rust-lang/crates.io-index" 633 + checksum = "0558a231a47e7d4a06a28b5278c92e860f1200f24821d2f365a2f40fe3f3c7b2" 651 634 dependencies = [ 652 - "defmt", 635 + "defmt 1.0.1", 653 636 "document-features", 654 - "embassy-net-driver 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 655 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 637 + "embassy-net-driver", 638 + "embassy-sync", 656 639 "embassy-time", 657 640 "embedded-io-async", 658 641 "embedded-nal-async", ··· 664 647 [[package]] 665 648 name = "embassy-net-driver" 666 649 version = "0.2.0" 667 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 650 + source = "registry+https://github.com/rust-lang/crates.io-index" 651 + checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d" 668 652 dependencies = [ 669 - "defmt", 670 - ] 671 - 672 - [[package]] 673 - name = "embassy-net-driver" 674 - version = "0.2.0" 675 - source = "git+https://github.com/embassy-rs/embassy.git#2b031756c6d705f58de972de48f7300b4fdc673c" 676 - 677 - [[package]] 678 - name = "embassy-net-driver-channel" 679 - version = "0.2.0" 680 - source = "git+https://github.com/embassy-rs/embassy.git#2b031756c6d705f58de972de48f7300b4fdc673c" 681 - dependencies = [ 682 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git)", 683 - "embassy-net-driver 0.2.0 (git+https://github.com/embassy-rs/embassy.git)", 684 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git)", 653 + "defmt 0.3.100", 685 654 ] 686 655 687 656 [[package]] 688 657 name = "embassy-net-driver-channel" 689 - version = "0.3.0" 690 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 658 + version = "0.3.2" 659 + source = "registry+https://github.com/rust-lang/crates.io-index" 660 + checksum = "b7b2739fbcf6cd206ae08779c7d709087b16577d255f2ea4a45bc4bbbf305b3f" 691 661 dependencies = [ 692 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 693 - "embassy-net-driver 0.2.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 694 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 662 + "embassy-futures", 663 + "embassy-net-driver", 664 + "embassy-sync", 695 665 ] 696 666 697 667 [[package]] 698 668 name = "embassy-net-wiznet" 699 - version = "0.1.0" 700 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 669 + version = "0.2.1" 670 + source = "registry+https://github.com/rust-lang/crates.io-index" 671 + checksum = "3035678b1fcb8322bbcc3ee9a32ea3ed04e6e388528057abd11ee8382a63abdf" 701 672 dependencies = [ 702 - "defmt", 703 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 704 - "embassy-net-driver-channel 0.3.0", 673 + "defmt 1.0.1", 674 + "embassy-futures", 675 + "embassy-net-driver-channel", 705 676 "embassy-time", 706 677 "embedded-hal 1.0.0", 707 678 "embedded-hal-async", ··· 709 680 710 681 [[package]] 711 682 name = "embassy-rp" 712 - version = "0.2.0" 713 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 683 + version = "0.8.0" 684 + source = "registry+https://github.com/rust-lang/crates.io-index" 685 + checksum = "1a284935af0a869de3fa14af74b5f932389dd66d7048012f1083b06f38d05399" 714 686 dependencies = [ 715 687 "atomic-polyfill", 716 688 "cfg-if", 717 689 "cortex-m", 718 690 "cortex-m-rt", 719 691 "critical-section", 720 - "defmt", 692 + "defmt 1.0.1", 721 693 "document-features", 722 694 "embassy-embedded-hal", 723 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 695 + "embassy-futures", 724 696 "embassy-hal-internal", 725 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 697 + "embassy-sync", 726 698 "embassy-time", 727 699 "embassy-time-driver", 728 - "embassy-usb-driver 0.1.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 700 + "embassy-time-queue-utils", 701 + "embassy-usb-driver", 729 702 "embedded-hal 0.2.7", 730 703 "embedded-hal 1.0.0", 731 704 "embedded-hal-async", ··· 736 709 "embedded-storage-async", 737 710 "fixed", 738 711 "nb 1.1.0", 739 - "pio", 740 - "pio-proc", 741 - "rand_core", 712 + "pio 0.3.0", 713 + "rand_core 0.6.4", 714 + "rand_core 0.9.3", 742 715 "rp-pac", 743 716 "rp2040-boot2", 744 717 "sha2-const-stable", 718 + "smart-leds", 745 719 ] 746 720 747 721 [[package]] 748 722 name = "embassy-sync" 749 - version = "0.6.0" 723 + version = "0.7.2" 750 724 source = "registry+https://github.com/rust-lang/crates.io-index" 751 - checksum = "b3e0c49ff02ebe324faf3a8653ba91582e2d0a7fdef5bc88f449d5aa1bfcc05c" 725 + checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" 752 726 dependencies = [ 753 727 "cfg-if", 754 728 "critical-section", 729 + "defmt 1.0.1", 755 730 "embedded-io-async", 756 - "futures-util", 757 - "heapless 0.8.0", 758 - ] 759 - 760 - [[package]] 761 - name = "embassy-sync" 762 - version = "0.6.0" 763 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 764 - dependencies = [ 765 - "cfg-if", 766 - "critical-section", 767 - "defmt", 768 - "embedded-io-async", 769 - "futures-util", 770 - "heapless 0.8.0", 771 - ] 772 - 773 - [[package]] 774 - name = "embassy-sync" 775 - version = "0.6.0" 776 - source = "git+https://github.com/embassy-rs/embassy.git#2b031756c6d705f58de972de48f7300b4fdc673c" 777 - dependencies = [ 778 - "cfg-if", 779 - "critical-section", 780 - "embedded-io-async", 781 - "futures-util", 731 + "futures-core", 732 + "futures-sink", 782 733 "heapless 0.8.0", 783 734 ] 784 735 785 736 [[package]] 786 737 name = "embassy-time" 787 - version = "0.3.2" 788 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 738 + version = "0.5.0" 739 + source = "registry+https://github.com/rust-lang/crates.io-index" 740 + checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65" 789 741 dependencies = [ 790 742 "cfg-if", 791 743 "critical-section", 792 - "defmt", 744 + "defmt 1.0.1", 793 745 "document-features", 794 746 "embassy-time-driver", 795 - "embassy-time-queue-driver", 796 747 "embedded-hal 0.2.7", 797 748 "embedded-hal 1.0.0", 798 749 "embedded-hal-async", 799 - "futures-util", 800 - "heapless 0.8.0", 750 + "futures-core", 801 751 ] 802 752 803 753 [[package]] 804 754 name = "embassy-time-driver" 805 - version = "0.1.0" 806 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 755 + version = "0.2.1" 756 + source = "registry+https://github.com/rust-lang/crates.io-index" 757 + checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6" 807 758 dependencies = [ 808 759 "document-features", 809 760 ] 810 761 811 762 [[package]] 812 - name = "embassy-time-queue-driver" 813 - version = "0.1.0" 814 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 815 - 816 - [[package]] 817 - name = "embassy-usb" 818 - version = "0.2.0" 819 - source = "git+https://github.com/embassy-rs/embassy.git#2b031756c6d705f58de972de48f7300b4fdc673c" 820 - dependencies = [ 821 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git)", 822 - "embassy-net-driver-channel 0.2.0", 823 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git)", 824 - "embassy-usb-driver 0.1.0 (git+https://github.com/embassy-rs/embassy.git)", 825 - "heapless 0.8.0", 826 - "ssmarshal", 827 - "usbd-hid", 828 - ] 829 - 830 - [[package]] 831 - name = "embassy-usb" 763 + name = "embassy-time-queue-utils" 832 764 version = "0.3.0" 833 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 765 + source = "registry+https://github.com/rust-lang/crates.io-index" 766 + checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454" 834 767 dependencies = [ 835 - "defmt", 836 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 837 - "embassy-net-driver-channel 0.3.0", 838 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 839 - "embassy-usb-driver 0.1.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 768 + "embassy-executor-timer-queue", 840 769 "heapless 0.8.0", 841 - "ssmarshal", 842 - "usbd-hid", 843 770 ] 844 771 845 772 [[package]] 846 773 name = "embassy-usb-driver" 847 - version = "0.1.0" 848 - source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 849 - dependencies = [ 850 - "defmt", 851 - ] 852 - 853 - [[package]] 854 - name = "embassy-usb-driver" 855 - version = "0.1.0" 856 - source = "git+https://github.com/embassy-rs/embassy.git#2b031756c6d705f58de972de48f7300b4fdc673c" 857 - 858 - [[package]] 859 - name = "embassy-usb-logger" 860 774 version = "0.2.0" 861 - source = "git+https://github.com/embassy-rs/embassy.git#2b031756c6d705f58de972de48f7300b4fdc673c" 775 + source = "registry+https://github.com/rust-lang/crates.io-index" 776 + checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a" 862 777 dependencies = [ 863 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git)", 864 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git)", 865 - "embassy-usb 0.2.0", 866 - "log", 867 - ] 868 - 869 - [[package]] 870 - name = "embassy_rp_w_template" 871 - version = "0.1.0" 872 - dependencies = [ 873 - "assign-resources", 874 - "bt-hci", 875 - "byte-slice-cast 1.2.2", 876 - "cortex-m", 877 - "cortex-m-rt", 878 - "critical-section", 879 - "cyw43", 880 - "cyw43-pio", 881 - "defmt", 882 - "defmt-rtt", 883 - "display-interface", 884 - "display-interface-spi", 885 - "embassy-embedded-hal", 886 - "embassy-executor", 887 - "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git)", 888 - "embassy-net", 889 - "embassy-net-wiznet", 890 - "embassy-rp", 891 - "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 892 - "embassy-time", 893 - "embassy-usb 0.3.0", 894 - "embassy-usb-logger", 895 - "embedded-graphics", 896 - "embedded-hal 1.0.0", 897 - "embedded-hal-async", 898 - "embedded-hal-bus", 778 + "defmt 1.0.1", 899 779 "embedded-io-async", 900 - "embedded-sdmmc", 901 - "embedded-storage", 902 - "embedded-text", 903 - "fixed", 904 - "fixed-macro", 905 - "heapless 0.8.0", 906 - "log", 907 - "panic-probe", 908 - "pio", 909 - "pio-proc", 910 - "portable-atomic", 911 - "postcard", 912 - "rand", 913 - "reqwless", 914 - "serde", 915 - "serde-json-core", 916 - "shtcx", 917 - "smart-leds", 918 - "st7789", 919 - "static_cell", 920 - "tinybmp", 921 - "trouble-host", 922 - "uc8151", 923 - "usbd-hid", 924 780 ] 925 781 926 782 [[package]] ··· 931 787 dependencies = [ 932 788 "az", 933 789 "byteorder", 934 - "embedded-graphics-core 0.4.0", 790 + "embedded-graphics-core", 935 791 "float-cmp", 936 792 "micromath", 937 - ] 938 - 939 - [[package]] 940 - name = "embedded-graphics-core" 941 - version = "0.3.3" 942 - source = "registry+https://github.com/rust-lang/crates.io-index" 943 - checksum = "b8b1239db5f3eeb7e33e35bd10bd014e7b2537b17e071f726a09351431337cfa" 944 - dependencies = [ 945 - "az", 946 - "byteorder", 947 793 ] 948 794 949 795 [[package]] ··· 1008 854 source = "registry+https://github.com/rust-lang/crates.io-index" 1009 855 checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" 1010 856 dependencies = [ 1011 - "defmt", 857 + "defmt 0.3.100", 1012 858 ] 1013 859 1014 860 [[package]] ··· 1017 863 source = "registry+https://github.com/rust-lang/crates.io-index" 1018 864 checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" 1019 865 dependencies = [ 1020 - "defmt", 866 + "defmt 0.3.100", 1021 867 "embedded-io", 1022 868 ] 1023 869 1024 870 [[package]] 1025 871 name = "embedded-nal" 1026 - version = "0.8.0" 872 + version = "0.9.0" 1027 873 source = "registry+https://github.com/rust-lang/crates.io-index" 1028 - checksum = "b8a943fad5ed3d3f8a00f1e80f6bba371f1e7f0df28ec38477535eb318dc19cc" 874 + checksum = "c56a28be191a992f28f178ec338a0bf02f63d7803244add736d026a471e6ed77" 1029 875 dependencies = [ 1030 876 "nb 1.1.0", 1031 - "no-std-net", 1032 877 ] 1033 878 1034 879 [[package]] 1035 880 name = "embedded-nal-async" 1036 - version = "0.7.1" 881 + version = "0.8.0" 1037 882 source = "registry+https://github.com/rust-lang/crates.io-index" 1038 - checksum = "72229137a4fc12d239b0b7f50f04b30790678da6d782a0f3f1909bf57ec4b759" 883 + checksum = "76959917cd2b86f40a98c28dd5624eddd1fa69d746241c8257eac428d83cb211" 1039 884 dependencies = [ 1040 885 "embedded-io-async", 1041 886 "embedded-nal", 1042 - "no-std-net", 1043 887 ] 1044 888 1045 889 [[package]] ··· 1088 932 dependencies = [ 1089 933 "aes-gcm", 1090 934 "atomic-polyfill", 1091 - "defmt", 935 + "defmt 0.3.100", 1092 936 "digest", 1093 937 "embedded-io", 1094 938 "embedded-io-async", ··· 1098 942 "hkdf", 1099 943 "hmac", 1100 944 "p256", 1101 - "rand_core", 945 + "rand_core 0.6.4", 1102 946 "sha2", 1103 947 "typenum", 1104 948 ] ··· 1113 957 ] 1114 958 1115 959 [[package]] 1116 - name = "encode_unicode" 1117 - version = "0.3.6" 1118 - source = "registry+https://github.com/rust-lang/crates.io-index" 1119 - checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" 1120 - 1121 - [[package]] 1122 960 name = "equivalent" 1123 961 version = "1.0.1" 1124 962 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1130 968 source = "registry+https://github.com/rust-lang/crates.io-index" 1131 969 checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" 1132 970 dependencies = [ 1133 - "rand_core", 971 + "rand_core 0.6.4", 1134 972 "subtle", 1135 973 ] 1136 974 ··· 1188 1026 checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" 1189 1027 1190 1028 [[package]] 1029 + name = "fixedbitset" 1030 + version = "0.5.7" 1031 + source = "registry+https://github.com/rust-lang/crates.io-index" 1032 + checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" 1033 + 1034 + [[package]] 1191 1035 name = "float-cmp" 1192 1036 version = "0.9.0" 1193 1037 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1228 1072 1229 1073 [[package]] 1230 1074 name = "futures-core" 1231 - version = "0.3.30" 1232 - source = "registry+https://github.com/rust-lang/crates.io-index" 1233 - checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" 1234 - 1235 - [[package]] 1236 - name = "futures-intrusive" 1237 - version = "0.5.0" 1075 + version = "0.3.31" 1238 1076 source = "registry+https://github.com/rust-lang/crates.io-index" 1239 - checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" 1240 - dependencies = [ 1241 - "futures-core", 1242 - "lock_api", 1243 - ] 1077 + checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 1244 1078 1245 1079 [[package]] 1246 1080 name = "futures-io" ··· 1256 1090 dependencies = [ 1257 1091 "proc-macro2", 1258 1092 "quote", 1259 - "syn 2.0.72", 1093 + "syn 2.0.106", 1260 1094 ] 1261 1095 1262 1096 [[package]] ··· 1316 1150 1317 1151 [[package]] 1318 1152 name = "getrandom" 1319 - version = "0.2.15" 1153 + version = "0.2.16" 1320 1154 source = "registry+https://github.com/rust-lang/crates.io-index" 1321 - checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 1155 + checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" 1322 1156 dependencies = [ 1323 1157 "cfg-if", 1324 1158 "libc", ··· 1342 1176 checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" 1343 1177 dependencies = [ 1344 1178 "ff", 1345 - "rand_core", 1179 + "rand_core 0.6.4", 1346 1180 "subtle", 1347 1181 ] 1348 1182 ··· 1385 1219 1386 1220 [[package]] 1387 1221 name = "hashbrown" 1388 - version = "0.13.2" 1389 - source = "registry+https://github.com/rust-lang/crates.io-index" 1390 - checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" 1391 - dependencies = [ 1392 - "ahash", 1393 - ] 1394 - 1395 - [[package]] 1396 - name = "hashbrown" 1397 - version = "0.14.5" 1222 + version = "0.16.0" 1398 1223 source = "registry+https://github.com/rust-lang/crates.io-index" 1399 - checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" 1224 + checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" 1400 1225 1401 1226 [[package]] 1402 1227 name = "heapless" ··· 1430 1255 source = "registry+https://github.com/rust-lang/crates.io-index" 1431 1256 checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" 1432 1257 dependencies = [ 1433 - "defmt", 1258 + "defmt 0.3.100", 1434 1259 "hash32 0.3.1", 1435 1260 "serde", 1436 1261 "stable_deref_trait", ··· 1438 1263 1439 1264 [[package]] 1440 1265 name = "hermit-abi" 1441 - version = "0.3.9" 1266 + version = "0.5.2" 1442 1267 source = "registry+https://github.com/rust-lang/crates.io-index" 1443 - checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 1268 + checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" 1444 1269 1445 1270 [[package]] 1446 1271 name = "hex" ··· 1480 1305 1481 1306 [[package]] 1482 1307 name = "indexmap" 1483 - version = "2.3.0" 1308 + version = "2.11.4" 1484 1309 source = "registry+https://github.com/rust-lang/crates.io-index" 1485 - checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" 1310 + checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" 1486 1311 dependencies = [ 1487 1312 "equivalent", 1488 - "hashbrown 0.14.5", 1313 + "hashbrown", 1489 1314 ] 1490 1315 1491 1316 [[package]] ··· 1499 1324 1500 1325 [[package]] 1501 1326 name = "is-terminal" 1502 - version = "0.4.12" 1327 + version = "0.4.16" 1503 1328 source = "registry+https://github.com/rust-lang/crates.io-index" 1504 - checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" 1329 + checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" 1505 1330 dependencies = [ 1506 1331 "hermit-abi", 1507 1332 "libc", 1508 - "windows-sys", 1333 + "windows-sys 0.52.0", 1509 1334 ] 1510 1335 1511 1336 [[package]] ··· 1518 1343 ] 1519 1344 1520 1345 [[package]] 1346 + name = "itertools" 1347 + version = "0.14.0" 1348 + source = "registry+https://github.com/rust-lang/crates.io-index" 1349 + checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" 1350 + dependencies = [ 1351 + "either", 1352 + ] 1353 + 1354 + [[package]] 1355 + name = "keccak" 1356 + version = "0.1.5" 1357 + source = "registry+https://github.com/rust-lang/crates.io-index" 1358 + checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" 1359 + dependencies = [ 1360 + "cpufeatures", 1361 + ] 1362 + 1363 + [[package]] 1521 1364 name = "lalrpop" 1522 1365 version = "0.19.12" 1523 1366 source = "registry+https://github.com/rust-lang/crates.io-index" 1524 1367 checksum = "0a1cbf952127589f2851ab2046af368fd20645491bb4b376f04b7f94d7a9837b" 1525 1368 dependencies = [ 1526 - "ascii-canvas", 1527 - "bit-set", 1369 + "ascii-canvas 3.0.0", 1370 + "bit-set 0.5.3", 1528 1371 "diff", 1529 1372 "ena", 1530 1373 "is-terminal", 1531 - "itertools", 1532 - "lalrpop-util", 1533 - "petgraph", 1374 + "itertools 0.10.5", 1375 + "lalrpop-util 0.19.12", 1376 + "petgraph 0.6.5", 1534 1377 "regex", 1535 1378 "regex-syntax 0.6.29", 1536 1379 "string_cache", 1537 - "term", 1380 + "term 0.7.0", 1538 1381 "tiny-keccak", 1539 1382 "unicode-xid", 1540 1383 ] 1541 1384 1542 1385 [[package]] 1386 + name = "lalrpop" 1387 + version = "0.22.2" 1388 + source = "registry+https://github.com/rust-lang/crates.io-index" 1389 + checksum = "ba4ebbd48ce411c1d10fb35185f5a51a7bfa3d8b24b4e330d30c9e3a34129501" 1390 + dependencies = [ 1391 + "ascii-canvas 4.0.0", 1392 + "bit-set 0.8.0", 1393 + "ena", 1394 + "itertools 0.14.0", 1395 + "lalrpop-util 0.22.2", 1396 + "petgraph 0.7.1", 1397 + "pico-args", 1398 + "regex", 1399 + "regex-syntax 0.8.4", 1400 + "sha3", 1401 + "string_cache", 1402 + "term 1.2.0", 1403 + "unicode-xid", 1404 + "walkdir", 1405 + ] 1406 + 1407 + [[package]] 1543 1408 name = "lalrpop-util" 1544 1409 version = "0.19.12" 1545 1410 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1549 1414 ] 1550 1415 1551 1416 [[package]] 1417 + name = "lalrpop-util" 1418 + version = "0.22.2" 1419 + source = "registry+https://github.com/rust-lang/crates.io-index" 1420 + checksum = "b5baa5e9ff84f1aefd264e6869907646538a52147a755d494517a8007fb48733" 1421 + dependencies = [ 1422 + "regex-automata", 1423 + "rustversion", 1424 + ] 1425 + 1426 + [[package]] 1552 1427 name = "libc" 1553 1428 version = "0.2.155" 1554 1429 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1556 1431 1557 1432 [[package]] 1558 1433 name = "libredox" 1559 - version = "0.1.3" 1434 + version = "0.1.10" 1560 1435 source = "registry+https://github.com/rust-lang/crates.io-index" 1561 - checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" 1436 + checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" 1562 1437 dependencies = [ 1563 1438 "bitflags 2.6.0", 1564 1439 "libc", ··· 1626 1501 checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" 1627 1502 1628 1503 [[package]] 1629 - name = "no-std-net" 1630 - version = "0.6.0" 1631 - source = "registry+https://github.com/rust-lang/crates.io-index" 1632 - checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" 1633 - 1634 - [[package]] 1635 1504 name = "nourl" 1636 1505 version = "0.1.1" 1637 1506 source = "registry+https://github.com/rust-lang/crates.io-index" 1638 1507 checksum = "b3c12edfda65fe16901d81d3bd93fd18ac07078b5007875a1c3b0d35f7725269" 1639 1508 dependencies = [ 1640 - "defmt", 1509 + "defmt 0.3.100", 1641 1510 ] 1511 + 1512 + [[package]] 1513 + name = "num-conv" 1514 + version = "0.1.0" 1515 + source = "registry+https://github.com/rust-lang/crates.io-index" 1516 + checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 1642 1517 1643 1518 [[package]] 1644 1519 name = "num-traits" ··· 1655 1530 source = "registry+https://github.com/rust-lang/crates.io-index" 1656 1531 checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" 1657 1532 dependencies = [ 1658 - "num_enum_derive", 1533 + "num_enum_derive 0.5.11", 1534 + ] 1535 + 1536 + [[package]] 1537 + name = "num_enum" 1538 + version = "0.7.4" 1539 + source = "registry+https://github.com/rust-lang/crates.io-index" 1540 + checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" 1541 + dependencies = [ 1542 + "num_enum_derive 0.7.4", 1543 + "rustversion", 1659 1544 ] 1660 1545 1661 1546 [[package]] ··· 1670 1555 ] 1671 1556 1672 1557 [[package]] 1558 + name = "num_enum_derive" 1559 + version = "0.7.4" 1560 + source = "registry+https://github.com/rust-lang/crates.io-index" 1561 + checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" 1562 + dependencies = [ 1563 + "proc-macro2", 1564 + "quote", 1565 + "syn 2.0.106", 1566 + ] 1567 + 1568 + [[package]] 1673 1569 name = "object-chain" 1674 1570 version = "0.1.3" 1675 1571 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1699 1595 1700 1596 [[package]] 1701 1597 name = "panic-probe" 1702 - version = "0.3.2" 1598 + version = "1.0.0" 1703 1599 source = "registry+https://github.com/rust-lang/crates.io-index" 1704 - checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" 1600 + checksum = "fd402d00b0fb94c5aee000029204a46884b1262e0c443f166d86d2c0747e1a1a" 1705 1601 dependencies = [ 1706 1602 "cortex-m", 1707 - "defmt", 1603 + "defmt 1.0.1", 1708 1604 ] 1709 1605 1710 1606 [[package]] ··· 1742 1638 source = "registry+https://github.com/rust-lang/crates.io-index" 1743 1639 checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" 1744 1640 dependencies = [ 1745 - "fixedbitset", 1641 + "fixedbitset 0.4.2", 1642 + "indexmap", 1643 + ] 1644 + 1645 + [[package]] 1646 + name = "petgraph" 1647 + version = "0.7.1" 1648 + source = "registry+https://github.com/rust-lang/crates.io-index" 1649 + checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" 1650 + dependencies = [ 1651 + "fixedbitset 0.5.7", 1746 1652 "indexmap", 1747 1653 ] 1748 1654 ··· 1756 1662 ] 1757 1663 1758 1664 [[package]] 1665 + name = "pico-args" 1666 + version = "0.5.0" 1667 + source = "registry+https://github.com/rust-lang/crates.io-index" 1668 + checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" 1669 + 1670 + [[package]] 1759 1671 name = "pin-project-lite" 1760 1672 version = "0.2.14" 1761 1673 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1774 1686 checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3" 1775 1687 dependencies = [ 1776 1688 "arrayvec", 1777 - "num_enum", 1689 + "num_enum 0.5.11", 1690 + "paste", 1691 + ] 1692 + 1693 + [[package]] 1694 + name = "pio" 1695 + version = "0.3.0" 1696 + source = "registry+https://github.com/rust-lang/crates.io-index" 1697 + checksum = "d0ba4153cee9585abc451271aa437d9e8defdea8b468d48ba6b8f098cbe03d7f" 1698 + dependencies = [ 1699 + "pio-core", 1700 + "pio-proc 0.3.0", 1701 + ] 1702 + 1703 + [[package]] 1704 + name = "pio-core" 1705 + version = "0.3.0" 1706 + source = "registry+https://github.com/rust-lang/crates.io-index" 1707 + checksum = "61d90fddc3d67f21bbf93683bc461b05d6a29c708caf3ffb79947d7ff7095406" 1708 + dependencies = [ 1709 + "arrayvec", 1710 + "num_enum 0.7.4", 1778 1711 "paste", 1779 1712 ] 1780 1713 ··· 1784 1717 source = "registry+https://github.com/rust-lang/crates.io-index" 1785 1718 checksum = "77532c2b8279aef98dfc7207ef15298a5a3d6b6cc76ccc8b65913d69f3a8dd6b" 1786 1719 dependencies = [ 1787 - "lalrpop", 1788 - "lalrpop-util", 1789 - "pio", 1720 + "lalrpop 0.19.12", 1721 + "lalrpop-util 0.19.12", 1722 + "pio 0.2.1", 1790 1723 "regex-syntax 0.6.29", 1791 1724 ] 1792 1725 1793 1726 [[package]] 1727 + name = "pio-parser" 1728 + version = "0.3.0" 1729 + source = "registry+https://github.com/rust-lang/crates.io-index" 1730 + checksum = "825266c1eaddf54f636d06eefa4bf3c99d774c14ec46a4a6c6e5128a0f10d205" 1731 + dependencies = [ 1732 + "lalrpop 0.22.2", 1733 + "lalrpop-util 0.22.2", 1734 + "pio-core", 1735 + ] 1736 + 1737 + [[package]] 1794 1738 name = "pio-proc" 1795 1739 version = "0.2.2" 1796 1740 source = "registry+https://github.com/rust-lang/crates.io-index" 1797 1741 checksum = "6b04dc870fb3a4fd8b3e4ca8c61b53bc8ac4eb78b66805d2b3c2e5c4829e0d7a" 1798 1742 dependencies = [ 1799 1743 "codespan-reporting", 1800 - "lalrpop-util", 1801 - "pio", 1802 - "pio-parser", 1744 + "lalrpop-util 0.19.12", 1745 + "pio 0.2.1", 1746 + "pio-parser 0.2.2", 1803 1747 "proc-macro-error", 1804 1748 "proc-macro2", 1805 1749 "quote", ··· 1808 1752 ] 1809 1753 1810 1754 [[package]] 1755 + name = "pio-proc" 1756 + version = "0.3.0" 1757 + source = "registry+https://github.com/rust-lang/crates.io-index" 1758 + checksum = "ed4a76571f5fe51af43cc80ac870fe0c79cc0cdd686b9002a6c4c84bfdd0176b" 1759 + dependencies = [ 1760 + "codespan-reporting", 1761 + "lalrpop-util 0.22.2", 1762 + "pio-core", 1763 + "pio-parser 0.3.0", 1764 + "proc-macro-error2", 1765 + "proc-macro2", 1766 + "quote", 1767 + "syn 2.0.106", 1768 + ] 1769 + 1770 + [[package]] 1811 1771 name = "polyval" 1812 1772 version = "0.6.2" 1813 1773 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1840 1800 ] 1841 1801 1842 1802 [[package]] 1803 + name = "powerfmt" 1804 + version = "0.2.0" 1805 + source = "registry+https://github.com/rust-lang/crates.io-index" 1806 + checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" 1807 + 1808 + [[package]] 1843 1809 name = "ppv-lite86" 1844 1810 version = "0.2.18" 1845 1811 source = "registry+https://github.com/rust-lang/crates.io-index" 1846 1812 checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f" 1847 1813 dependencies = [ 1848 - "zerocopy 0.6.6", 1814 + "zerocopy", 1849 1815 ] 1850 1816 1851 1817 [[package]] ··· 1888 1854 ] 1889 1855 1890 1856 [[package]] 1857 + name = "proc-macro-error-attr2" 1858 + version = "2.0.0" 1859 + source = "registry+https://github.com/rust-lang/crates.io-index" 1860 + checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" 1861 + dependencies = [ 1862 + "proc-macro2", 1863 + "quote", 1864 + ] 1865 + 1866 + [[package]] 1867 + name = "proc-macro-error2" 1868 + version = "2.0.1" 1869 + source = "registry+https://github.com/rust-lang/crates.io-index" 1870 + checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" 1871 + dependencies = [ 1872 + "proc-macro-error-attr2", 1873 + "proc-macro2", 1874 + "quote", 1875 + "syn 2.0.106", 1876 + ] 1877 + 1878 + [[package]] 1891 1879 name = "proc-macro2" 1892 - version = "1.0.86" 1880 + version = "1.0.101" 1893 1881 source = "registry+https://github.com/rust-lang/crates.io-index" 1894 - checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 1882 + checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" 1895 1883 dependencies = [ 1896 1884 "unicode-ident", 1897 1885 ] ··· 1911 1899 source = "registry+https://github.com/rust-lang/crates.io-index" 1912 1900 checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1913 1901 dependencies = [ 1914 - "rand_core", 1902 + "rand_core 0.6.4", 1915 1903 ] 1916 1904 1917 1905 [[package]] ··· 1921 1909 checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1922 1910 dependencies = [ 1923 1911 "ppv-lite86", 1924 - "rand_core", 1912 + "rand_core 0.6.4", 1925 1913 ] 1926 1914 1927 1915 [[package]] ··· 1931 1919 checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1932 1920 1933 1921 [[package]] 1922 + name = "rand_core" 1923 + version = "0.9.3" 1924 + source = "registry+https://github.com/rust-lang/crates.io-index" 1925 + checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 1926 + 1927 + [[package]] 1934 1928 name = "redox_syscall" 1935 1929 version = "0.5.3" 1936 1930 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1941 1935 1942 1936 [[package]] 1943 1937 name = "redox_users" 1944 - version = "0.4.5" 1938 + version = "0.4.6" 1945 1939 source = "registry+https://github.com/rust-lang/crates.io-index" 1946 - checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" 1940 + checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" 1947 1941 dependencies = [ 1948 1942 "getrandom", 1949 1943 "libredox", 1950 - "thiserror", 1944 + "thiserror 1.0.69", 1951 1945 ] 1952 1946 1953 1947 [[package]] ··· 1987 1981 1988 1982 [[package]] 1989 1983 name = "reqwless" 1990 - version = "0.12.1" 1984 + version = "0.13.0" 1991 1985 source = "registry+https://github.com/rust-lang/crates.io-index" 1992 - checksum = "66584b58c3b0cd8cfea750408a932fe86df79ee05ccc87ee745a8e6be4a1abe0" 1986 + checksum = "fb1be74cb817fa6dbda417110f575d9b9ad5488817f1eb65f2f6468fe6d5d663" 1993 1987 dependencies = [ 1994 1988 "base64", 1995 1989 "buffered-io", 1996 - "defmt", 1990 + "defmt 0.3.100", 1997 1991 "embedded-io", 1998 1992 "embedded-io-async", 1999 1993 "embedded-nal-async", ··· 2003 1997 "httparse", 2004 1998 "nourl", 2005 1999 "rand_chacha", 2006 - "rand_core", 2000 + "rand_core 0.6.4", 2007 2001 ] 2008 2002 2009 2003 [[package]] 2010 2004 name = "rgb" 2011 - version = "0.8.45" 2005 + version = "0.8.52" 2012 2006 source = "registry+https://github.com/rust-lang/crates.io-index" 2013 - checksum = "ade4539f42266ded9e755c605bdddf546242b2c961b03b06a7375260788a0523" 2014 - dependencies = [ 2015 - "bytemuck", 2016 - ] 2007 + checksum = "0c6a884d2998352bb4daf0183589aec883f16a6da1f4dde84d8e2e9a5409a1ce" 2017 2008 2018 2009 [[package]] 2019 2010 name = "rp-pac" 2020 - version = "6.0.0" 2021 - source = "git+https://github.com/embassy-rs/rp-pac.git?rev=a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c#a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c" 2011 + version = "7.0.0" 2012 + source = "registry+https://github.com/rust-lang/crates.io-index" 2013 + checksum = "8af65855c40b2c35079514c5489abffc0429347fef25d8467ff98ad84b4322d3" 2022 2014 dependencies = [ 2023 2015 "cortex-m", 2024 2016 "cortex-m-rt", ··· 2058 2050 checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" 2059 2051 2060 2052 [[package]] 2053 + name = "rusty_badger" 2054 + version = "0.1.0" 2055 + dependencies = [ 2056 + "assign-resources", 2057 + "byte-slice-cast", 2058 + "cortex-m", 2059 + "cortex-m-rt", 2060 + "critical-section", 2061 + "cyw43", 2062 + "cyw43-pio", 2063 + "defmt 0.3.100", 2064 + "defmt-rtt", 2065 + "embassy-embedded-hal", 2066 + "embassy-executor", 2067 + "embassy-net", 2068 + "embassy-net-wiznet", 2069 + "embassy-rp", 2070 + "embassy-sync", 2071 + "embassy-time", 2072 + "embedded-graphics", 2073 + "embedded-hal 1.0.0", 2074 + "embedded-hal-async", 2075 + "embedded-hal-bus", 2076 + "embedded-io-async", 2077 + "embedded-sdmmc", 2078 + "embedded-storage", 2079 + "embedded-text", 2080 + "fixed", 2081 + "fixed-macro", 2082 + "heapless 0.8.0", 2083 + "log", 2084 + "panic-probe", 2085 + "pio 0.2.1", 2086 + "pio-proc 0.2.2", 2087 + "portable-atomic", 2088 + "postcard", 2089 + "rand", 2090 + "reqwless", 2091 + "serde", 2092 + "serde-json-core", 2093 + "shtcx", 2094 + "static_cell", 2095 + "time", 2096 + "tinybmp", 2097 + "uc8151", 2098 + ] 2099 + 2100 + [[package]] 2061 2101 name = "ryu" 2062 2102 version = "1.0.18" 2063 2103 source = "registry+https://github.com/rust-lang/crates.io-index" 2064 2104 checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 2105 + 2106 + [[package]] 2107 + name = "same-file" 2108 + version = "1.0.6" 2109 + source = "registry+https://github.com/rust-lang/crates.io-index" 2110 + checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 2111 + dependencies = [ 2112 + "winapi-util", 2113 + ] 2065 2114 2066 2115 [[package]] 2067 2116 name = "scopeguard" ··· 2131 2180 dependencies = [ 2132 2181 "proc-macro2", 2133 2182 "quote", 2134 - "syn 2.0.72", 2183 + "syn 2.0.106", 2135 2184 ] 2136 2185 2137 2186 [[package]] ··· 2152 2201 checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9" 2153 2202 2154 2203 [[package]] 2204 + name = "sha3" 2205 + version = "0.10.8" 2206 + source = "registry+https://github.com/rust-lang/crates.io-index" 2207 + checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" 2208 + dependencies = [ 2209 + "digest", 2210 + "keccak", 2211 + ] 2212 + 2213 + [[package]] 2155 2214 name = "shtcx" 2156 2215 version = "1.0.0" 2157 2216 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2174 2233 2175 2234 [[package]] 2176 2235 name = "smart-leds" 2177 - version = "0.3.0" 2236 + version = "0.4.0" 2178 2237 source = "registry+https://github.com/rust-lang/crates.io-index" 2179 - checksum = "38dd45fa275f70b4110eac5f5182611ad384f88bb22b68b9a9c3cafd7015290b" 2238 + checksum = "66df34e571fa9993fa6f99131a374d58ca3d694b75f9baac93458fe0d6057bf0" 2180 2239 dependencies = [ 2181 2240 "smart-leds-trait", 2182 2241 ] 2183 2242 2184 2243 [[package]] 2185 2244 name = "smart-leds-trait" 2186 - version = "0.2.1" 2245 + version = "0.3.2" 2187 2246 source = "registry+https://github.com/rust-lang/crates.io-index" 2188 - checksum = "ebf6d833fa93f16a1c1874e62c2aebe8567e5bdd436d59bf543ed258b6f7a8e3" 2247 + checksum = "a7f4441a131924d58da6b83a7ad765c460e64630cce504376c3a87a2558c487f" 2189 2248 dependencies = [ 2190 2249 "rgb", 2191 2250 ] 2192 2251 2193 2252 [[package]] 2194 2253 name = "smoltcp" 2195 - version = "0.11.0" 2254 + version = "0.12.0" 2196 2255 source = "registry+https://github.com/rust-lang/crates.io-index" 2197 - checksum = "5a1a996951e50b5971a2c8c0fa05a381480d70a933064245c4a223ddc87ccc97" 2256 + checksum = "dad095989c1533c1c266d9b1e8d70a1329dd3723c3edac6d03bbd67e7bf6f4bb" 2198 2257 dependencies = [ 2199 2258 "bitflags 1.3.2", 2200 2259 "byteorder", 2201 2260 "cfg-if", 2202 - "defmt", 2261 + "defmt 0.3.100", 2203 2262 "heapless 0.8.0", 2204 2263 "managed", 2205 2264 ] ··· 2214 2273 ] 2215 2274 2216 2275 [[package]] 2217 - name = "ssmarshal" 2218 - version = "1.0.0" 2219 - source = "registry+https://github.com/rust-lang/crates.io-index" 2220 - checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850" 2221 - dependencies = [ 2222 - "encode_unicode", 2223 - "serde", 2224 - ] 2225 - 2226 - [[package]] 2227 - name = "st7789" 2228 - version = "0.6.1" 2229 - source = "registry+https://github.com/rust-lang/crates.io-index" 2230 - checksum = "cba7306a9ca07ffcafd13ac1eaac2d5cedc8e9fc0d342ef674e0f0d059c8f8a9" 2231 - dependencies = [ 2232 - "display-interface", 2233 - "embedded-graphics-core 0.3.3", 2234 - "embedded-hal 0.2.7", 2235 - "heapless 0.7.17", 2236 - "nb 1.1.0", 2237 - ] 2238 - 2239 - [[package]] 2240 2276 name = "stable_deref_trait" 2241 2277 version = "1.2.0" 2242 2278 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2289 2325 2290 2326 [[package]] 2291 2327 name = "syn" 2292 - version = "2.0.72" 2328 + version = "2.0.106" 2293 2329 source = "registry+https://github.com/rust-lang/crates.io-index" 2294 - checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" 2330 + checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" 2295 2331 dependencies = [ 2296 2332 "proc-macro2", 2297 2333 "quote", ··· 2310 2346 ] 2311 2347 2312 2348 [[package]] 2349 + name = "term" 2350 + version = "1.2.0" 2351 + source = "registry+https://github.com/rust-lang/crates.io-index" 2352 + checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" 2353 + dependencies = [ 2354 + "windows-sys 0.61.1", 2355 + ] 2356 + 2357 + [[package]] 2313 2358 name = "termcolor" 2314 2359 version = "1.4.1" 2315 2360 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2320 2365 2321 2366 [[package]] 2322 2367 name = "thiserror" 2323 - version = "1.0.63" 2368 + version = "1.0.69" 2324 2369 source = "registry+https://github.com/rust-lang/crates.io-index" 2325 - checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" 2370 + checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" 2326 2371 dependencies = [ 2327 - "thiserror-impl", 2372 + "thiserror-impl 1.0.69", 2373 + ] 2374 + 2375 + [[package]] 2376 + name = "thiserror" 2377 + version = "2.0.17" 2378 + source = "registry+https://github.com/rust-lang/crates.io-index" 2379 + checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" 2380 + dependencies = [ 2381 + "thiserror-impl 2.0.17", 2328 2382 ] 2329 2383 2330 2384 [[package]] 2331 2385 name = "thiserror-impl" 2332 - version = "1.0.63" 2386 + version = "1.0.69" 2333 2387 source = "registry+https://github.com/rust-lang/crates.io-index" 2334 - checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" 2388 + checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" 2335 2389 dependencies = [ 2336 2390 "proc-macro2", 2337 2391 "quote", 2338 - "syn 2.0.72", 2392 + "syn 2.0.106", 2339 2393 ] 2340 2394 2341 2395 [[package]] 2396 + name = "thiserror-impl" 2397 + version = "2.0.17" 2398 + source = "registry+https://github.com/rust-lang/crates.io-index" 2399 + checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" 2400 + dependencies = [ 2401 + "proc-macro2", 2402 + "quote", 2403 + "syn 2.0.106", 2404 + ] 2405 + 2406 + [[package]] 2407 + name = "time" 2408 + version = "0.3.44" 2409 + source = "registry+https://github.com/rust-lang/crates.io-index" 2410 + checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" 2411 + dependencies = [ 2412 + "deranged", 2413 + "num-conv", 2414 + "powerfmt", 2415 + "time-core", 2416 + ] 2417 + 2418 + [[package]] 2419 + name = "time-core" 2420 + version = "0.1.6" 2421 + source = "registry+https://github.com/rust-lang/crates.io-index" 2422 + checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" 2423 + 2424 + [[package]] 2342 2425 name = "tiny-keccak" 2343 2426 version = "2.0.2" 2344 2427 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2357 2440 ] 2358 2441 2359 2442 [[package]] 2360 - name = "trouble-host" 2361 - version = "0.1.0" 2362 - source = "git+https://github.com/embassy-rs/trouble.git?rev=4b8c0f499b34e46ca23a56e2d1640ede371722cf#4b8c0f499b34e46ca23a56e2d1640ede371722cf" 2363 - dependencies = [ 2364 - "bt-hci", 2365 - "defmt", 2366 - "embassy-futures 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 2367 - "embassy-sync 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", 2368 - "embassy-time", 2369 - "embedded-io-async", 2370 - "futures", 2371 - "heapless 0.8.0", 2372 - ] 2373 - 2374 - [[package]] 2375 2443 name = "typenum" 2376 2444 version = "1.17.0" 2377 2445 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2382 2450 version = "0.3.0" 2383 2451 source = "git+https://github.com/9names/uc8151-rs.git#37a7feee23716506b777bd4032327038e7e0786a" 2384 2452 dependencies = [ 2385 - "embedded-graphics-core 0.4.0", 2453 + "embedded-graphics-core", 2386 2454 "embedded-hal 1.0.0", 2387 2455 "embedded-hal-async", 2388 2456 ] ··· 2416 2484 ] 2417 2485 2418 2486 [[package]] 2419 - name = "usb-device" 2420 - version = "0.3.2" 2421 - source = "registry+https://github.com/rust-lang/crates.io-index" 2422 - checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" 2423 - dependencies = [ 2424 - "heapless 0.8.0", 2425 - "portable-atomic", 2426 - ] 2427 - 2428 - [[package]] 2429 - name = "usbd-hid" 2430 - version = "0.8.2" 2431 - source = "registry+https://github.com/rust-lang/crates.io-index" 2432 - checksum = "e6f291ab53d428685cc780f08a2eb9d5d6ff58622db2b36e239a4f715f1e184c" 2433 - dependencies = [ 2434 - "serde", 2435 - "ssmarshal", 2436 - "usb-device", 2437 - "usbd-hid-macros", 2438 - ] 2439 - 2440 - [[package]] 2441 - name = "usbd-hid-descriptors" 2442 - version = "0.8.2" 2443 - source = "registry+https://github.com/rust-lang/crates.io-index" 2444 - checksum = "0eee54712c5d778d2fb2da43b1ce5a7b5060886ef7b09891baeb4bf36910a3ed" 2445 - dependencies = [ 2446 - "bitfield 0.14.0", 2447 - ] 2448 - 2449 - [[package]] 2450 - name = "usbd-hid-macros" 2451 - version = "0.8.2" 2452 - source = "registry+https://github.com/rust-lang/crates.io-index" 2453 - checksum = "bb573c76e7884035ac5e1ab4a81234c187a82b6100140af0ab45757650ccda38" 2454 - dependencies = [ 2455 - "byteorder", 2456 - "hashbrown 0.13.2", 2457 - "log", 2458 - "proc-macro2", 2459 - "quote", 2460 - "serde", 2461 - "syn 1.0.109", 2462 - "usbd-hid-descriptors", 2463 - ] 2464 - 2465 - [[package]] 2466 2487 name = "vcell" 2467 2488 version = "0.1.3" 2468 2489 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2490 2511 ] 2491 2512 2492 2513 [[package]] 2514 + name = "walkdir" 2515 + version = "2.5.0" 2516 + source = "registry+https://github.com/rust-lang/crates.io-index" 2517 + checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" 2518 + dependencies = [ 2519 + "same-file", 2520 + "winapi-util", 2521 + ] 2522 + 2523 + [[package]] 2493 2524 name = "wasi" 2494 - version = "0.11.0+wasi-snapshot-preview1" 2525 + version = "0.11.1+wasi-snapshot-preview1" 2495 2526 source = "registry+https://github.com/rust-lang/crates.io-index" 2496 - checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2527 + checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" 2497 2528 2498 2529 [[package]] 2499 2530 name = "winapi" ··· 2517 2548 source = "registry+https://github.com/rust-lang/crates.io-index" 2518 2549 checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" 2519 2550 dependencies = [ 2520 - "windows-sys", 2551 + "windows-sys 0.52.0", 2521 2552 ] 2522 2553 2523 2554 [[package]] ··· 2527 2558 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2528 2559 2529 2560 [[package]] 2561 + name = "windows-link" 2562 + version = "0.2.0" 2563 + source = "registry+https://github.com/rust-lang/crates.io-index" 2564 + checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" 2565 + 2566 + [[package]] 2530 2567 name = "windows-sys" 2531 2568 version = "0.52.0" 2532 2569 source = "registry+https://github.com/rust-lang/crates.io-index" 2533 2570 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 2534 2571 dependencies = [ 2535 2572 "windows-targets", 2573 + ] 2574 + 2575 + [[package]] 2576 + name = "windows-sys" 2577 + version = "0.61.1" 2578 + source = "registry+https://github.com/rust-lang/crates.io-index" 2579 + checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" 2580 + dependencies = [ 2581 + "windows-link", 2536 2582 ] 2537 2583 2538 2584 [[package]] ··· 2606 2652 checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6" 2607 2653 dependencies = [ 2608 2654 "byteorder", 2609 - "zerocopy-derive 0.6.6", 2610 - ] 2611 - 2612 - [[package]] 2613 - name = "zerocopy" 2614 - version = "0.7.35" 2615 - source = "registry+https://github.com/rust-lang/crates.io-index" 2616 - checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 2617 - dependencies = [ 2618 - "zerocopy-derive 0.7.35", 2655 + "zerocopy-derive", 2619 2656 ] 2620 2657 2621 2658 [[package]] ··· 2626 2663 dependencies = [ 2627 2664 "proc-macro2", 2628 2665 "quote", 2629 - "syn 2.0.72", 2630 - ] 2631 - 2632 - [[package]] 2633 - name = "zerocopy-derive" 2634 - version = "0.7.35" 2635 - source = "registry+https://github.com/rust-lang/crates.io-index" 2636 - checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 2637 - dependencies = [ 2638 - "proc-macro2", 2639 - "quote", 2640 - "syn 2.0.72", 2666 + "syn 2.0.106", 2641 2667 ] 2642 2668 2643 2669 [[package]]
+30 -37
Cargo.toml
··· 1 1 [package] 2 - name = "embassy_rp_w_template" 2 + name = "rusty_badger" 3 3 version = "0.1.0" 4 - edition = "2021" 4 + edition = "2024" 5 5 6 6 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 7 8 8 [dependencies] 9 - embassy-embedded-hal = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 9 + embassy-embedded-hal = { version = "0.5.0", features = [ 10 10 "defmt", 11 11 ] } 12 - embassy-sync = { version = "0.6.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 12 + embassy-sync = { version = "0.7.2", features = [ 13 13 "defmt", 14 14 ] } 15 - embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 16 - "task-arena-size-98304", 15 + embassy-executor = { version = "0.9.1", features = [ 17 16 "arch-cortex-m", 18 17 "executor-thread", 19 18 "executor-interrupt", 20 19 "defmt", 21 - "integrated-timers", 22 20 ] } 23 - embassy-time = { version = "0.3.2", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 21 + embassy-time = { version = "0.5.0", features = [ 24 22 "defmt", 25 23 "defmt-timestamp-uptime", 26 24 ] } 27 - embassy-rp = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 25 + embassy-rp = { version = "0.8.0", features = [ 28 26 "defmt", 29 27 "unstable-pac", 30 28 "time-driver", 31 29 "critical-section-impl", 32 30 "rp2040", 33 31 ] } 34 - embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 35 - "defmt", 36 - ] } 37 - embassy-net = { version = "0.4.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 32 + #embassy-usb = { git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 33 + # "defmt", 34 + #] } 35 + embassy-net = { version = "0.7.1", features = [ 38 36 "defmt", 39 37 "tcp", 40 38 "udp", ··· 43 41 "medium-ethernet", 44 42 "dns", 45 43 ] } 46 - embassy-net-wiznet = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 44 + embassy-net-wiznet = { version = "0.2.1", features = [ 47 45 "defmt", 48 46 ] } 49 - embassy-futures = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy.git" } 50 - embassy-usb-logger = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git" } 51 - cyw43 = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 52 - "defmt", 53 - "firmware-logs", 54 - "bluetooth", 47 + #embassy-futures = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy.git" } 48 + #embassy-usb-logger = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git" } 49 + cyw43 = { version = "0.5.0", features = [ 50 + # "defmt", 51 + # "firmware-logs", 52 + # "bluetooth", 55 53 ] } 56 - cyw43-pio = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 54 + cyw43-pio = { version = "0.8.0", features = [ 57 55 "defmt", 58 - "overclock", 59 56 ] } 60 57 61 58 defmt = "0.3" ··· 64 61 fixed-macro = "1.2" 65 62 66 63 # for web request example 67 - reqwless = { version = "0.12.0", features = ["defmt"] } 64 + reqwless = { version = "0.13.0", features = ["defmt"] } 68 65 serde = { version = "1.0.203", default-features = false, features = ["derive"] } 69 66 serde-json-core = "0.5.1" 70 67 ··· 73 70 # for assign resources example 74 71 #cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 75 72 cortex-m = { version = "0.7.6", features = ["inline-asm"] } 76 - cortex-m-rt = "0.7.0" 73 + cortex-m-rt = "0.7.5" 77 74 critical-section = "1.1" 78 - panic-probe = { version = "0.3", features = ["print-defmt"] } 79 - display-interface-spi = "0.4.1" 80 - embedded-graphics = "0.8.0" 81 - st7789 = "0.6.1" 82 - display-interface = "0.4.1" 75 + panic-probe = { version = "1.0.0", features = ["print-defmt"] } 76 + 77 + embedded-graphics = "0.8.1" 83 78 byte-slice-cast = { version = "1.2.0", default-features = false } 84 - smart-leds = "0.3.0" 79 + 85 80 heapless = { version = "0.8", features = ["serde"] } 86 - usbd-hid = "0.8.1" 81 + 87 82 88 83 embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 89 84 embedded-hal-async = "1.0" ··· 97 92 pio = "0.2.1" 98 93 rand = { version = "0.8.5", default-features = false } 99 94 embedded-sdmmc = "0.7.0" 100 - bt-hci = { version = "0.1.0", default-features = false, features = ["defmt"] } 101 - trouble-host = { version = "0.1.0", features = ["defmt", "gatt"] } 102 95 uc8151 = { git = "https://github.com/9names/uc8151-rs.git", features = [ 103 96 "graphics", 104 97 ] } ··· 106 99 tinybmp = "0.5.0" 107 100 shtcx = "1.0.0" 108 101 postcard = "1.0.8" 102 + time = { version = "0.3.17", default-features = false } 103 + #pcf85063a = "0.1.1" 109 104 110 105 [profile.release] 111 106 debug = 2 112 107 113 108 [profile.dev] 114 - debug = 1 109 + debug = 2 115 110 lto = true 116 111 opt-level = "z" 117 112 118 - [patch.crates-io] 119 - trouble-host = { git = "https://github.com/embassy-rs/trouble.git", rev = "4b8c0f499b34e46ca23a56e2d1640ede371722cf" } 120 - embassy-time = { git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6" } 113 +
images/mtras_logo.bmp

This is a binary file and will not be displayed.

+4
rust-toolchain-nightly.toml
··· 1 + [toolchain] 2 + channel = "nightly" 3 + components = ["rust-src", "rustfmt", "llvm-tools", "miri"] 4 + targets = ["thumbv6m-none-eabi"]
+7 -1
src/badge_display/display_image.rs
··· 2 2 3 3 use super::CURRENT_IMAGE; 4 4 5 - static NUMBER_OF_IMAGES: u8 = 2; 5 + static NUMBER_OF_IMAGES: u8 = 3; 6 6 static FERRIS_IMG: &[u8; 15722] = include_bytes!("../../images/ferris_w_a_knife.bmp"); 7 7 static REPO_IMG: &[u8; 11262] = include_bytes!("../../images/repo.bmp"); 8 + static MTRAS_LOGO: &[u8; 11162] = include_bytes!("../../images/mtras_logo.bmp"); 8 9 9 10 pub enum DisplayImage { 10 11 Ferris = 0, 11 12 Repo = 1, 13 + MtrasLogo = 2, 12 14 } 13 15 14 16 pub fn get_current_image() -> DisplayImage { ··· 20 22 match value { 21 23 0 => Some(Self::Ferris), 22 24 1 => Some(Self::Repo), 25 + 2 => Some(Self::MtrasLogo), 23 26 _ => None, 24 27 } 25 28 } ··· 28 31 match self { 29 32 Self::Ferris => 0, 30 33 Self::Repo => 1, 34 + Self::MtrasLogo => 2, 31 35 } 32 36 } 33 37 ··· 35 39 match self { 36 40 Self::Ferris => FERRIS_IMG, 37 41 Self::Repo => REPO_IMG, 42 + Self::MtrasLogo => MTRAS_LOGO, 38 43 } 39 44 } 40 45 ··· 57 62 match self { 58 63 Self::Ferris => Point::new(150, 26), 59 64 Self::Repo => Point::new(190, 26), 65 + Self::MtrasLogo => Point::new(190, 26), 60 66 } 61 67 } 62 68 }
+205 -108
src/badge_display/mod.rs
··· 25 25 TextBox, 26 26 }; 27 27 use gpio::Output; 28 - use heapless::String; 28 + use heapless::{String, Vec}; 29 29 use tinybmp::Bmp; 30 - use uc8151::asynch::Uc8151; 31 30 use uc8151::LUT; 32 31 use uc8151::WIDTH; 32 + use uc8151::{asynch::Uc8151, HEIGHT}; 33 33 use {defmt_rtt as _, panic_probe as _}; 34 34 35 - use crate::{env::env_value, helpers::easy_format, Spi0Bus}; 35 + use crate::{ 36 + env::env_value, 37 + helpers::{easy_format, easy_format_str}, 38 + Spi0Bus, 39 + }; 40 + 41 + pub type RecentWifiNetworksVec = Vec<String<32>, 4>; 36 42 37 43 //Display state 44 + pub static SCREEN_TO_SHOW: blocking_mutex::Mutex<CriticalSectionRawMutex, RefCell<Screen>> = 45 + blocking_mutex::Mutex::new(RefCell::new(Screen::Badge)); 46 + pub static RECENT_WIFI_NETWORKS: blocking_mutex::Mutex< 47 + CriticalSectionRawMutex, 48 + RefCell<RecentWifiNetworksVec>, 49 + > = blocking_mutex::Mutex::new(RefCell::new(RecentWifiNetworksVec::new())); 50 + 51 + pub static FORCE_SCREEN_REFRESH: AtomicBool = AtomicBool::new(true); 52 + pub static DISPLAY_CHANGED: AtomicBool = AtomicBool::new(false); 38 53 pub static CURRENT_IMAGE: AtomicU8 = AtomicU8::new(0); 39 54 pub static CHANGE_IMAGE: AtomicBool = AtomicBool::new(true); 40 55 pub static WIFI_COUNT: AtomicU32 = AtomicU32::new(0); ··· 42 57 blocking_mutex::Mutex::new(RefCell::new(String::<8>::new())); 43 58 pub static TEMP: AtomicU8 = AtomicU8::new(0); 44 59 pub static HUMIDITY: AtomicU8 = AtomicU8::new(0); 60 + 61 + #[derive(Debug, Clone, Copy, PartialEq, defmt::Format)] 62 + pub enum Screen { 63 + Badge, 64 + WifiList, 65 + } 45 66 46 67 #[embassy_executor::task] 47 68 pub async fn run_the_display( ··· 74 95 .into_styled(PrimitiveStyle::with_fill(BinaryColor::On)) 75 96 .draw(&mut display) 76 97 .unwrap(); 98 + info!("Name: {}", env_value("NAME")); 99 + info!("Details: {}", env_value("DETAILS")); 100 + let mut name_and_details_buffer = [0; 128]; 101 + let name_and_details = easy_format_str( 102 + format_args!("{}\n{}", env_value("NAME"), env_value("DETAILS")), 103 + &mut name_and_details_buffer, 104 + ); 77 105 78 - // Create the text box and apply styling options. 79 - let display_text = easy_format::<29>(format_args!( 80 - "{}\n{}", 81 - env_value("NAME"), 82 - env_value("DETAILS") 83 - )); 84 - 85 - // \nWritten in rust\nRunning on a pico w"; 86 106 let name_and_detail_box = TextBox::with_textbox_style( 87 - &display_text, 107 + &name_and_details.unwrap(), 88 108 name_and_detail_bounds, 89 109 character_style, 90 110 textbox_style, 91 111 ); 92 112 93 - // Draw the text box. 94 - name_and_detail_box.draw(&mut display).unwrap(); 95 - 96 113 // let _ = display.update().await; 97 114 98 115 //Each cycle is half a second 99 116 let cycle: Duration = Duration::from_millis(500); 100 117 101 - let mut first_run = true; 102 118 //New start every 120 cycles or 60 seconds 103 119 let cycles_to_clear_at: i32 = 120; 104 120 let mut cycles_since_last_clear = 0; 105 - 121 + let mut current_screen = Screen::Badge; 106 122 loop { 123 + let mut force_screen_refresh = 124 + FORCE_SCREEN_REFRESH.load(core::sync::atomic::Ordering::Relaxed); 107 125 //Timed based display events 126 + if DISPLAY_CHANGED.load(core::sync::atomic::Ordering::Relaxed) { 127 + let clear_rectangle = Rectangle::new(Point::new(0, 0), Size::new(WIDTH, HEIGHT)); 128 + clear_rectangle 129 + .into_styled(PrimitiveStyle::with_fill(BinaryColor::On)) 130 + .draw(&mut display) 131 + .unwrap(); 132 + let _ = display.update().await; 133 + DISPLAY_CHANGED.store(false, core::sync::atomic::Ordering::Relaxed); 134 + force_screen_refresh = true; 135 + } 108 136 109 - //Runs every second; 110 - if cycles_since_last_clear % 2 == 0 { 111 - // update_time_values_from_cycles(); 112 - } 137 + SCREEN_TO_SHOW.lock(|x| current_screen = *x.borrow()); 138 + // info!("Current Screen: {:?}", current_screen); 139 + if current_screen == Screen::Badge { 140 + if force_screen_refresh { 141 + // Draw the text box. 142 + name_and_detail_box.draw(&mut display).unwrap(); 143 + } 113 144 114 - //Updates the top bar 115 - //Runs every 60 cycles/30 seconds and first run 116 - if cycles_since_last_clear % 60 == 0 || first_run { 117 - let count = WIFI_COUNT.load(core::sync::atomic::Ordering::Relaxed); 118 - let temp = TEMP.load(core::sync::atomic::Ordering::Relaxed); 119 - let humidity = HUMIDITY.load(core::sync::atomic::Ordering::Relaxed); 120 - let top_text: String<64> = easy_format::<64>(format_args!( 121 - "{}F {}% Wifi found: {}", 122 - temp, humidity, count 123 - )); 124 - let top_bounds = Rectangle::new(Point::new(0, 0), Size::new(WIDTH, 24)); 125 - top_bounds 126 - .into_styled( 127 - PrimitiveStyleBuilder::default() 128 - .stroke_color(BinaryColor::Off) 129 - .fill_color(BinaryColor::On) 130 - .stroke_width(1) 131 - .build(), 132 - ) 133 - .draw(&mut display) 134 - .unwrap(); 145 + //Updates the top bar 146 + //Runs every 60 cycles/30 seconds and first run 147 + if cycles_since_last_clear % 60 == 0 || force_screen_refresh { 148 + let count = WIFI_COUNT.load(core::sync::atomic::Ordering::Relaxed); 149 + info!("Wifi count: {}", count); 150 + let temp = TEMP.load(core::sync::atomic::Ordering::Relaxed); 151 + let humidity = HUMIDITY.load(core::sync::atomic::Ordering::Relaxed); 152 + let top_text: String<64> = easy_format::<64>(format_args!( 153 + "{}F {}% Wifi found: {}", 154 + temp, humidity, count 155 + )); 156 + let top_bounds = Rectangle::new(Point::new(0, 0), Size::new(WIDTH, 24)); 157 + top_bounds 158 + .into_styled( 159 + PrimitiveStyleBuilder::default() 160 + .stroke_color(BinaryColor::Off) 161 + .fill_color(BinaryColor::On) 162 + .stroke_width(1) 163 + .build(), 164 + ) 165 + .draw(&mut display) 166 + .unwrap(); 135 167 136 - Text::new(top_text.as_str(), Point::new(8, 16), character_style) 137 - .draw(&mut display) 138 - .unwrap(); 168 + Text::new(top_text.as_str(), Point::new(8, 16), character_style) 169 + .draw(&mut display) 170 + .unwrap(); 139 171 140 - // Draw the text box. 141 - let result = display.partial_update(top_bounds.try_into().unwrap()).await; 142 - match result { 143 - Ok(_) => {} 144 - Err(_) => { 145 - info!("Error updating display"); 172 + // Draw the text box. 173 + let result = display.partial_update(top_bounds.try_into().unwrap()).await; 174 + match result { 175 + Ok(_) => {} 176 + Err(_) => { 177 + info!("Error updating display"); 178 + } 146 179 } 147 180 } 148 - } 181 + 182 + //Runs every 120 cycles/60 seconds and first run 183 + if cycles_since_last_clear == 0 || force_screen_refresh { 184 + let mut time_text: String<8> = String::<8>::new(); 149 185 150 - //Runs every 120 cycles/60 seconds and first run 151 - if cycles_since_last_clear == 0 { 152 - let mut time_text: String<8> = String::<8>::new(); 186 + let time_box_rectangle_location = Point::new(0, 96); 187 + RTC_TIME_STRING.lock(|x| { 188 + time_text.push_str(x.borrow().as_str()).unwrap(); 189 + }); 153 190 154 - let time_box_rectangle_location = Point::new(0, 96); 155 - RTC_TIME_STRING.lock(|x| { 156 - time_text.push_str(x.borrow().as_str()).unwrap(); 157 - }); 191 + //The bounds of the box for time and refresh area 192 + let time_bounds = Rectangle::new(time_box_rectangle_location, Size::new(88, 24)); 193 + time_bounds 194 + .into_styled( 195 + PrimitiveStyleBuilder::default() 196 + .stroke_color(BinaryColor::Off) 197 + .fill_color(BinaryColor::On) 198 + .stroke_width(1) 199 + .build(), 200 + ) 201 + .draw(&mut display) 202 + .unwrap(); 158 203 159 - //The bounds of the box for time and refresh area 160 - let time_bounds = Rectangle::new(time_box_rectangle_location, Size::new(88, 24)); 161 - time_bounds 162 - .into_styled( 163 - PrimitiveStyleBuilder::default() 164 - .stroke_color(BinaryColor::Off) 165 - .fill_color(BinaryColor::On) 166 - .stroke_width(1) 167 - .build(), 204 + //Adding a y offset to the box location to fit inside the box 205 + Text::new( 206 + time_text.as_str(), 207 + ( 208 + time_box_rectangle_location.x + 8, 209 + time_box_rectangle_location.y + 16, 210 + ) 211 + .into(), 212 + character_style, 168 213 ) 169 214 .draw(&mut display) 170 215 .unwrap(); 171 216 172 - //Adding a y offset to the box location to fit inside the box 173 - Text::new( 174 - time_text.as_str(), 175 - ( 176 - time_box_rectangle_location.x + 8, 177 - time_box_rectangle_location.y + 16, 178 - ) 179 - .into(), 180 - character_style, 181 - ) 182 - .draw(&mut display) 183 - .unwrap(); 184 - 185 - let result = display 186 - .partial_update(time_bounds.try_into().unwrap()) 187 - .await; 188 - match result { 189 - Ok(_) => {} 190 - Err(_) => { 191 - info!("Error updating display"); 217 + let result = display 218 + .partial_update(time_bounds.try_into().unwrap()) 219 + .await; 220 + match result { 221 + Ok(_) => {} 222 + Err(_) => { 223 + info!("Error updating display"); 224 + } 192 225 } 193 226 } 194 - } 195 227 196 - //Manually triggered display events 228 + //Manually triggered display events 197 229 198 - if CHANGE_IMAGE.load(core::sync::atomic::Ordering::Relaxed) { 199 - let current_image = get_current_image(); 200 - let tga: Bmp<BinaryColor> = Bmp::from_slice(&current_image.image()).unwrap(); 201 - let image = Image::new(&tga, current_image.image_location()); 202 - //clear image location by writing a white rectangle over previous image location 203 - let clear_rectangle = Rectangle::new( 204 - current_image.previous().image_location(), 205 - Size::new(157, 101), 206 - ); 207 - clear_rectangle 208 - .into_styled(PrimitiveStyle::with_fill(BinaryColor::On)) 209 - .draw(&mut display) 210 - .unwrap(); 230 + if CHANGE_IMAGE.load(core::sync::atomic::Ordering::Relaxed) || force_screen_refresh { 231 + let current_image = get_current_image(); 232 + let tga: Bmp<BinaryColor> = Bmp::from_slice(&current_image.image()).unwrap(); 233 + let image = Image::new(&tga, current_image.image_location()); 234 + //clear image location by writing a white rectangle over previous image location 235 + let clear_rectangle = Rectangle::new( 236 + current_image.previous().image_location(), 237 + Size::new(157, 101), 238 + ); 239 + clear_rectangle 240 + .into_styled(PrimitiveStyle::with_fill(BinaryColor::On)) 241 + .draw(&mut display) 242 + .unwrap(); 211 243 212 - let _ = image.draw(&mut display); 213 - //TODO need to look up the reginal area display 214 - let _ = display.update().await; 215 - CHANGE_IMAGE.store(false, core::sync::atomic::Ordering::Relaxed); 244 + let _ = image.draw(&mut display); 245 + //TODO need to look up the reginal area display 246 + let _ = display.update().await; 247 + CHANGE_IMAGE.store(false, core::sync::atomic::Ordering::Relaxed); 248 + } 249 + } else { 250 + if force_screen_refresh { 251 + let top_bounds = Rectangle::new(Point::new(0, 0), Size::new(WIDTH, 24)); 252 + top_bounds 253 + .into_styled( 254 + PrimitiveStyleBuilder::default() 255 + .stroke_color(BinaryColor::Off) 256 + .fill_color(BinaryColor::On) 257 + .stroke_width(1) 258 + .build(), 259 + ) 260 + .draw(&mut display) 261 + .unwrap(); 262 + 263 + let top_text: String<64> = easy_format::<64>(format_args!( 264 + "Wifi found: {}", 265 + WIFI_COUNT.load(core::sync::atomic::Ordering::Relaxed) 266 + )); 267 + 268 + Text::new(top_text.as_str(), Point::new(8, 16), character_style) 269 + .draw(&mut display) 270 + .unwrap(); 271 + 272 + let result = display.partial_update(top_bounds.try_into().unwrap()).await; 273 + match result { 274 + Ok(_) => {} 275 + Err(_) => { 276 + info!("Error updating display"); 277 + } 278 + } 279 + 280 + //write the wifi list 281 + let mut y_offset = 24; 282 + let wifi_list = RECENT_WIFI_NETWORKS.lock(|x| x.borrow().clone()); 283 + for wifi in wifi_list.iter() { 284 + // let wifi_text: String<64> = easy_format::<64>(format_args!("{}", wifi)); 285 + let wifi_bounds = Rectangle::new(Point::new(0, y_offset), Size::new(WIDTH, 24)); 286 + wifi_bounds 287 + .into_styled( 288 + PrimitiveStyleBuilder::default() 289 + .stroke_color(BinaryColor::Off) 290 + .fill_color(BinaryColor::On) 291 + .stroke_width(1) 292 + .build(), 293 + ) 294 + .draw(&mut display) 295 + .unwrap(); 296 + 297 + Text::new(wifi.trim(), Point::new(8, y_offset + 16), character_style) 298 + .draw(&mut display) 299 + .unwrap(); 300 + 301 + let result = display 302 + .partial_update(wifi_bounds.try_into().unwrap()) 303 + .await; 304 + match result { 305 + Ok(_) => {} 306 + Err(_) => { 307 + info!("Error updating display"); 308 + } 309 + } 310 + y_offset += 24; 311 + } 312 + } 216 313 } 217 314 218 315 cycles_since_last_clear += 1; 219 316 if cycles_since_last_clear >= cycles_to_clear_at { 220 317 cycles_since_last_clear = 0; 221 318 } 222 - first_run = false; 319 + FORCE_SCREEN_REFRESH.store(false, core::sync::atomic::Ordering::Relaxed); 223 320 // info!("Display Cycle: {}", cycles_since_last_clear); 224 321 Timer::after(cycle).await; 225 322 }
-63
src/cyw43_driver.rs
··· 1 - use cyw43::Control; 2 - use cyw43_pio::PioSpi; 3 - use defmt::unwrap; 4 - use embassy_executor::Spawner; 5 - use embassy_net_wiznet::Device; 6 - use embassy_rp::bind_interrupts; 7 - use embassy_rp::gpio::{Level, Output}; 8 - use embassy_rp::peripherals::{DMA_CH0, PIO0}; 9 - use embassy_rp::peripherals::{PIN_23, PIN_24, PIN_25, PIN_29}; 10 - use embassy_rp::pio::{InterruptHandler, Pio}; 11 - use static_cell::StaticCell; 12 - 13 - bind_interrupts!(struct Irqs { 14 - PIO0_IRQ_0 => InterruptHandler<PIO0>; 15 - }); 16 - 17 - #[embassy_executor::task] 18 - async fn cyw43_task( 19 - runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>, 20 - ) -> ! { 21 - runner.run().await 22 - } 23 - 24 - pub async fn setup_cyw43<'a>( 25 - pio0: PIO0, 26 - p_23: PIN_23, 27 - p_24: PIN_24, 28 - p_25: PIN_25, 29 - p_29: PIN_29, 30 - dma_ch0: DMA_CH0, 31 - spawner: Spawner, 32 - ) -> (Device<'a>, Control<'a>) { 33 - let fw = include_bytes!("../cyw43-firmware/43439A0.bin"); 34 - let clm = include_bytes!("../cyw43-firmware/43439A0_clm.bin"); 35 - let btfw = include_bytes!("../cyw43-firmware/43439A0_btfw.bin"); 36 - 37 - // To make flashing faster for development, you may want to flash the firmwares independently 38 - // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: 39 - // probe-rs download 43439A0.bin --binary-format bin --chip RP2040 --base-address 0x10100000 40 - // probe-rs download 43439A0_clm.bin --binary-format bin --chip RP2040 --base-address 0x10140000 41 - // probe-rs download 43439A0_btfw.bin --binary-format bin --chip RP2040 --base-address 0x10141400 42 - // let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) }; 43 - // let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; 44 - // let btfw = unsafe { core::slice::from_raw_parts(0x10141400 as *const u8, 6164) }; 45 - 46 - let pwr = Output::new(p_23, Level::Low); 47 - let cs = Output::new(p_25, Level::High); 48 - let mut pio = Pio::new(pio0, Irqs); 49 - let spi = PioSpi::new(&mut pio.common, pio.sm0, pio.irq0, cs, p_24, p_29, dma_ch0); 50 - // let input = Input::new(p_29, Pull::Up); 51 - 52 - static STATE: StaticCell<cyw43::State> = StaticCell::new(); 53 - let state = STATE.init(cyw43::State::new()); 54 - let (net_device, _bt_device, mut control, runner) = 55 - cyw43::new_with_bluetooth(state, pwr, spi, fw, btfw).await; 56 - unwrap!(spawner.spawn(cyw43_task(runner))); 57 - 58 - control.init(clm).await; 59 - control 60 - .set_power_management(cyw43::PowerManagementMode::PowerSave) 61 - .await; 62 - (net_device, control) 63 - }
+48
src/helpers.rs
··· 12 12 } 13 13 } 14 14 } 15 + 16 + pub fn easy_format_str<'a>( 17 + args: Arguments<'_>, 18 + buffer: &'a mut [u8], 19 + ) -> Result<&'a str, core::fmt::Error> { 20 + let mut writer = BufWriter::new(buffer); 21 + let result = core::fmt::write(&mut writer, args); 22 + 23 + match result { 24 + Ok(_) => { 25 + let len = writer.len(); 26 + let response_str = core::str::from_utf8(&buffer[..len]).unwrap(); 27 + Ok(response_str) 28 + } 29 + Err(_) => { 30 + panic!("Error formatting the string") 31 + } 32 + } 33 + } 34 + 35 + // A simple wrapper struct to use core::fmt::Write on a [u8] buffer 36 + pub struct BufWriter<'a> { 37 + buf: &'a mut [u8], 38 + pos: usize, 39 + } 40 + 41 + impl<'a> BufWriter<'a> { 42 + pub fn new(buf: &'a mut [u8]) -> Self { 43 + BufWriter { buf, pos: 0 } 44 + } 45 + 46 + pub fn len(&self) -> usize { 47 + self.pos 48 + } 49 + } 50 + 51 + impl<'a> core::fmt::Write for BufWriter<'a> { 52 + fn write_str(&mut self, s: &str) -> core::fmt::Result { 53 + let bytes = s.as_bytes(); 54 + if self.pos + bytes.len() > self.buf.len() { 55 + return Err(core::fmt::Error); // Buffer overflow 56 + } 57 + 58 + self.buf[self.pos..self.pos + bytes.len()].copy_from_slice(bytes); 59 + self.pos += bytes.len(); 60 + Ok(()) 61 + } 62 + }
+333 -126
src/main.rs
··· 1 - //! This example test the RP Pico W on board LED. 2 - //! 3 - //! It does not work with the RP Pico board. 4 - 5 1 #![no_std] 6 2 #![no_main] 3 + 4 + use crate::pcf85063a::{Control, Error}; 7 5 use badge_display::display_image::DisplayImage; 8 - use badge_display::{run_the_display, CHANGE_IMAGE, CURRENT_IMAGE, RTC_TIME_STRING, WIFI_COUNT}; 6 + use badge_display::{ 7 + CHANGE_IMAGE, CURRENT_IMAGE, DISPLAY_CHANGED, FORCE_SCREEN_REFRESH, RECENT_WIFI_NETWORKS, 8 + RTC_TIME_STRING, RecentWifiNetworksVec, SCREEN_TO_SHOW, Screen, WIFI_COUNT, run_the_display, 9 + }; 10 + use core::cell::RefCell; 9 11 use core::fmt::Write; 10 12 use core::str::from_utf8; 11 - use cyw43_driver::setup_cyw43; 13 + use cyw43::JoinOptions; 14 + use cyw43_pio::{DEFAULT_CLOCK_DIVIDER, PioSpi}; 12 15 use defmt::info; 13 16 use defmt::*; 17 + use embassy_embedded_hal::shared_bus::I2cDeviceError; 18 + use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice; 14 19 use embassy_executor::Spawner; 20 + use embassy_net::StackResources; 15 21 use embassy_net::dns::DnsSocket; 16 22 use embassy_net::tcp::client::{TcpClient, TcpClientState}; 17 - use embassy_net::{Stack, StackResources}; 18 23 use embassy_rp::clocks::RoscRng; 19 24 use embassy_rp::flash::Async; 20 - use embassy_rp::gpio; 21 25 use embassy_rp::gpio::Input; 22 - use embassy_rp::peripherals::SPI0; 26 + use embassy_rp::i2c::I2c; 27 + use embassy_rp::peripherals::{DMA_CH0, I2C0, PIO0, SPI0}; 28 + use embassy_rp::pio::{InterruptHandler, Pio}; 23 29 use embassy_rp::rtc::{DateTime, DayOfWeek}; 24 30 use embassy_rp::spi::Spi; 25 31 use embassy_rp::spi::{self}; 32 + use embassy_rp::watchdog::Watchdog; 33 + use embassy_rp::{bind_interrupts, gpio, i2c}; 34 + use embassy_sync::blocking_mutex::NoopMutex; 26 35 use embassy_sync::blocking_mutex::raw::NoopRawMutex; 27 36 use embassy_sync::mutex::Mutex; 28 37 use embassy_time::{Duration, Timer}; ··· 30 39 use gpio::{Level, Output, Pull}; 31 40 use heapless::{String, Vec}; 32 41 use helpers::easy_format; 33 - use rand::RngCore; 42 + use pcf85063a::PCF85063; 34 43 use reqwless::client::{HttpClient, TlsConfig, TlsVerify}; 35 44 use reqwless::request::Method; 36 - use save::{read_postcard_from_flash, save_postcard_to_flash, Save}; 45 + use save::{Save, read_postcard_from_flash, save_postcard_to_flash}; 37 46 use serde::Deserialize; 38 47 use static_cell::StaticCell; 39 48 use temp_sensor::run_the_temp_sensor; 49 + use time::PrimitiveDateTime; 40 50 use {defmt_rtt as _, panic_probe as _}; 41 51 42 52 mod badge_display; 43 - mod cyw43_driver; 44 53 mod env; 45 54 mod helpers; 55 + mod pcf85063a; 46 56 mod save; 47 57 mod temp_sensor; 48 58 49 59 type Spi0Bus = Mutex<NoopRawMutex, Spi<'static, SPI0, spi::Async>>; 60 + type I2c0Bus = NoopMutex<RefCell<I2c<'static, I2C0, i2c::Blocking>>>; 50 61 51 62 const BSSID_LEN: usize = 1_000; 52 63 const ADDR_OFFSET: u32 = 0x100000; ··· 54 65 55 66 const FLASH_SIZE: usize = 2 * 1024 * 1024; 56 67 68 + bind_interrupts!(struct Irqs { 69 + PIO0_IRQ_0 => InterruptHandler<PIO0>; 70 + }); 71 + 57 72 #[embassy_executor::main] 58 73 async fn main(spawner: Spawner) { 59 74 let p = embassy_rp::init(Default::default()); 60 75 let mut user_led = Output::new(p.PIN_22, Level::High); 61 76 user_led.set_high(); 62 77 63 - let (net_device, mut control) = setup_cyw43( 64 - p.PIO0, p.PIN_23, p.PIN_24, p.PIN_25, p.PIN_29, p.DMA_CH0, spawner, 65 - ) 66 - .await; 78 + //Wifi driver and cyw43 setup 79 + let fw = include_bytes!("../cyw43-firmware/43439A0.bin"); 80 + let clm = include_bytes!("../cyw43-firmware/43439A0_clm.bin"); 81 + 82 + let pwr = Output::new(p.PIN_23, Level::Low); 83 + let cs = Output::new(p.PIN_25, Level::High); 84 + let mut pio = Pio::new(p.PIO0, Irqs); 85 + let spi = PioSpi::new( 86 + &mut pio.common, 87 + pio.sm0, 88 + DEFAULT_CLOCK_DIVIDER, 89 + pio.irq0, 90 + cs, 91 + p.PIN_24, 92 + p.PIN_29, 93 + p.DMA_CH0, 94 + ); 95 + static STATE: StaticCell<cyw43::State> = StaticCell::new(); 96 + let state = STATE.init(cyw43::State::new()); 97 + let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await; 98 + spawner.must_spawn(cyw43_task(runner)); 99 + 100 + control.init(clm).await; 101 + control 102 + .set_power_management(cyw43::PowerManagementMode::PowerSave) 103 + .await; 67 104 68 105 let miso = p.PIN_16; 69 106 let mosi = p.PIN_19; ··· 75 112 let power = p.PIN_10; 76 113 77 114 let reset = Output::new(reset, Level::Low); 78 - let _power = Output::new(power, Level::Low); 115 + let mut power = Output::new(power, Level::Low); 116 + power.set_high(); 79 117 80 118 let dc = Output::new(dc, Level::Low); 81 119 let cs = Output::new(cs, Level::High); 82 120 let busy = Input::new(busy, Pull::Up); 83 121 84 - let _btn_up = Input::new(p.PIN_15, Pull::Down); 85 - let _btn_down = Input::new(p.PIN_11, Pull::Down); 86 - let _btn_a = Input::new(p.PIN_12, Pull::Down); 122 + let btn_up = Input::new(p.PIN_15, Pull::Down); 123 + let btn_down = Input::new(p.PIN_11, Pull::Down); 124 + let btn_a = Input::new(p.PIN_12, Pull::Down); 87 125 let btn_b = Input::new(p.PIN_13, Pull::Down); 88 126 let btn_c = Input::new(p.PIN_14, Pull::Down); 127 + let rtc_alarm = Input::new(p.PIN_8, Pull::Down); 128 + let mut watchdog = Watchdog::new(p.WATCHDOG); 129 + 130 + //Setup i2c bus 131 + let config = embassy_rp::i2c::Config::default(); 132 + let i2c = i2c::I2c::new_blocking(p.I2C0, p.PIN_5, p.PIN_4, config); 133 + static I2C_BUS: StaticCell<I2c0Bus> = StaticCell::new(); 134 + let i2c_bus = NoopMutex::new(RefCell::new(i2c)); 135 + let i2c_bus = I2C_BUS.init(i2c_bus); 136 + 137 + let i2c_dev = I2cDevice::new(i2c_bus); 138 + let mut rtc_device = PCF85063::new(i2c_dev); 139 + 140 + if btn_a.is_high() { 141 + //Clears the alarm on start if A button is pressed (manual start) 142 + _ = rtc_device.disable_all_alarms(); 143 + _ = rtc_device.clear_alarm_flag(); 144 + } 145 + 146 + // //RTC alarm stuff 147 + // let mut go_to_sleep = false; 148 + // let mut reset_cycles_till_sleep = 0; 149 + // //Like 15ish mins?? 150 + // let sleep_after_cycles = 2; 151 + // 152 + // if rtc_alarm.is_high() { 153 + // //sleep happened 154 + // go_to_sleep = true; 155 + // info!("Alarm went off"); 156 + // _ = rtc_device.disable_all_alarms(); 157 + // _ = rtc_device.clear_alarm_flag(); 158 + // } else { 159 + // info!("Alarm was clear") 160 + // } 89 161 90 162 let spi = Spi::new( 91 163 p.SPI0, ··· 111 183 let seed = rng.next_u64(); 112 184 113 185 // Init network stack 114 - static STACK: StaticCell<Stack<cyw43::NetDriver<'static>>> = StaticCell::new(); 115 186 static RESOURCES: StaticCell<StackResources<5>> = StaticCell::new(); 116 - let stack = &*STACK.init(Stack::new( 187 + let (stack, runner) = embassy_net::new( 117 188 net_device, 118 189 config, 119 - RESOURCES.init(StackResources::<5>::new()), 190 + RESOURCES.init(StackResources::new()), 120 191 seed, 121 - )); 122 - //rtc setup 123 - let mut rtc = embassy_rp::rtc::Rtc::new(p.RTC); 192 + ); 193 + 194 + //If the watch dog isn't fed in 8 seconds reboot to help with hang up 195 + watchdog.start(Duration::from_secs(8)); 124 196 125 - spawner.must_spawn(net_task(stack)); 197 + spawner.must_spawn(net_task(runner)); 126 198 //Attempt to connect to wifi to get RTC time loop for 2 minutes 127 199 let mut wifi_connection_attempts = 0; 128 200 let mut connected_to_wifi = false; ··· 130 202 let wifi_ssid = env_value("WIFI_SSID"); 131 203 let wifi_password = env_value("WIFI_PASSWORD"); 132 204 while wifi_connection_attempts < 30 { 133 - match control.join_wpa2(wifi_ssid, &wifi_password).await { 205 + watchdog.feed(); 206 + match control 207 + .join(wifi_ssid, JoinOptions::new(wifi_password.as_bytes())) 208 + .await 209 + { 134 210 Ok(_) => { 135 211 connected_to_wifi = true; 136 212 info!("join successful"); ··· 144 220 wifi_connection_attempts += 1; 145 221 } 146 222 147 - let mut time_was_set = false; 148 223 if connected_to_wifi { 224 + //Feed the dog if it makes it this far 225 + watchdog.feed(); 149 226 info!("waiting for DHCP..."); 150 227 while !stack.is_config_up() { 151 228 Timer::after_millis(100).await; ··· 176 253 TlsVerify::None, 177 254 ); 178 255 256 + Timer::after(Duration::from_millis(500)).await; 257 + // let mut http_client = HttpClient::new(&tcp_client, &dns_client); 179 258 let mut http_client = HttpClient::new_with_tls(&tcp_client, &dns_client, tls_config); 259 + 180 260 let url = env_value("TIME_API"); 181 261 info!("connecting to {}", &url); 182 262 183 - let mut request = match http_client.request(Method::GET, &url).await { 184 - Ok(req) => req, 185 - Err(e) => { 186 - error!("Failed to make HTTP request: {:?}", e); 187 - return; // handle the error 188 - } 189 - }; 263 + // Feeds the dog again for one last time 264 + watchdog.feed(); 265 + 266 + //If the call goes through set the rtc 267 + match http_client.request(Method::GET, &url).await { 268 + Ok(mut request) => { 269 + let response = match request.send(&mut rx_buffer).await { 270 + Ok(resp) => resp, 271 + Err(e) => { 272 + error!("Failed to send HTTP request: {:?}", e); 273 + // error!("Failed to send HTTP request"); 274 + return; // handle the error; 275 + } 276 + }; 190 277 191 - let response = match request.send(&mut rx_buffer).await { 192 - Ok(resp) => resp, 193 - Err(_e) => { 194 - error!("Failed to send HTTP request"); 195 - return; // handle the error; 196 - } 197 - }; 278 + let body = match from_utf8(response.body().read_to_end().await.unwrap()) { 279 + Ok(b) => b, 280 + Err(_e) => { 281 + error!("Failed to read response body"); 282 + return; // handle the error 283 + } 284 + }; 285 + info!("Response body: {:?}", &body); 198 286 199 - let body = match from_utf8(response.body().read_to_end().await.unwrap()) { 200 - Ok(b) => b, 201 - Err(_e) => { 202 - error!("Failed to read response body"); 203 - return; // handle the error 204 - } 205 - }; 206 - info!("Response body: {:?}", &body); 287 + let bytes = body.as_bytes(); 288 + match serde_json_core::de::from_slice::<TimeApiResponse>(bytes) { 289 + Ok((output, _used)) => { 290 + //Deadlines am i right? 291 + info!("Datetime: {:?}", output.datetime); 292 + //split at T 293 + let datetime = output.datetime.split('T').collect::<Vec<&str, 2>>(); 294 + //split at - 295 + let date = datetime[0].split('-').collect::<Vec<&str, 3>>(); 296 + let year = date[0].parse::<u16>().unwrap(); 297 + let month = date[1].parse::<u8>().unwrap(); 298 + let day = date[2].parse::<u8>().unwrap(); 299 + //split at : 300 + let time = datetime[1].split(':').collect::<Vec<&str, 4>>(); 301 + let hour = time[0].parse::<u8>().unwrap(); 302 + let minute = time[1].parse::<u8>().unwrap(); 303 + //split at . 304 + let second_split = time[2].split('.').collect::<Vec<&str, 2>>(); 305 + let second = second_split[0].parse::<f64>().unwrap(); 306 + let rtc_time = DateTime { 307 + year: year, 308 + month: month, 309 + day: day, 310 + day_of_week: match output.day_of_week { 311 + 0 => DayOfWeek::Sunday, 312 + 1 => DayOfWeek::Monday, 313 + 2 => DayOfWeek::Tuesday, 314 + 3 => DayOfWeek::Wednesday, 315 + 4 => DayOfWeek::Thursday, 316 + 5 => DayOfWeek::Friday, 317 + 6 => DayOfWeek::Saturday, 318 + _ => DayOfWeek::Sunday, 319 + }, 320 + hour, 321 + minute, 322 + second: second as u8, 323 + }; 207 324 208 - let bytes = body.as_bytes(); 209 - match serde_json_core::de::from_slice::<TimeApiResponse>(bytes) { 210 - Ok((output, _used)) => { 211 - //Deadlines am i right? 212 - info!("Datetime: {:?}", output.datetime); 213 - //split at T 214 - let datetime = output.datetime.split('T').collect::<Vec<&str, 2>>(); 215 - //split at - 216 - let date = datetime[0].split('-').collect::<Vec<&str, 3>>(); 217 - let year = date[0].parse::<u16>().unwrap(); 218 - let month = date[1].parse::<u8>().unwrap(); 219 - let day = date[2].parse::<u8>().unwrap(); 220 - //split at : 221 - let time = datetime[1].split(':').collect::<Vec<&str, 4>>(); 222 - let hour = time[0].parse::<u8>().unwrap(); 223 - let minute = time[1].parse::<u8>().unwrap(); 224 - //split at . 225 - let second_split = time[2].split('.').collect::<Vec<&str, 2>>(); 226 - let second = second_split[0].parse::<f64>().unwrap(); 227 - let rtc_time = DateTime { 228 - year: year, 229 - month: month, 230 - day: day, 231 - day_of_week: match output.day_of_week { 232 - 0 => DayOfWeek::Sunday, 233 - 1 => DayOfWeek::Monday, 234 - 2 => DayOfWeek::Tuesday, 235 - 3 => DayOfWeek::Wednesday, 236 - 4 => DayOfWeek::Thursday, 237 - 5 => DayOfWeek::Friday, 238 - 6 => DayOfWeek::Saturday, 239 - _ => DayOfWeek::Sunday, 240 - }, 241 - hour, 242 - minute, 243 - second: second as u8, 244 - }; 245 - rtc.set_datetime(rtc_time).unwrap(); 246 - time_was_set = true; 325 + rtc_device 326 + .set_datetime(&rtc_time) 327 + .expect("TODO: panic message"); 328 + } 329 + Err(_e) => { 330 + error!("Failed to parse response body"); 331 + // return; // handle the error 332 + } 333 + } 247 334 } 248 - Err(_e) => { 249 - error!("Failed to parse response body"); 250 - return; // handle the error 335 + Err(e) => { 336 + error!("Failed to make HTTP request: {:?}", e); 337 + // return; // handle the error 251 338 } 252 - } 339 + }; 340 + //leave the wifi no longer needed 341 + let _ = control.leave().await; 253 342 } 254 343 255 344 //Set up saving 256 345 let mut flash = embassy_rp::flash::Flash::<_, Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH3); 257 - let mut save: Save = read_postcard_from_flash(ADDR_OFFSET, &mut flash, SAVE_OFFSET).unwrap(); 346 + let mut save = 347 + read_postcard_from_flash(ADDR_OFFSET, &mut flash, SAVE_OFFSET).unwrap_or_else(|err| { 348 + error!("Error getting the save from the flash: {:?}", err); 349 + Save::new() 350 + }); 258 351 WIFI_COUNT.store(save.wifi_counted, core::sync::atomic::Ordering::Relaxed); 352 + 259 353 //Task spawning 260 - spawner.must_spawn(run_the_temp_sensor(p.I2C0, p.PIN_5, p.PIN_4)); 354 + spawner.must_spawn(run_the_temp_sensor(i2c_bus)); 261 355 spawner.must_spawn(run_the_display(spi_bus, cs, dc, busy, reset)); 262 356 263 357 //Input loop 264 358 let cycle = Duration::from_millis(100); 265 359 let mut current_cycle = 0; 266 - //5 minutes 267 - let reset_cycle = 300_000; 360 + let mut time_to_scan = true; 361 + //5 minutes(ish) idk it's late and my math is so bad rn 362 + let reset_cycle = 3_000; 363 + 268 364 //Turn off led to signify that the badge is ready 269 - user_led.set_low(); 365 + // user_led.set_low(); 270 366 271 367 loop { 368 + //Keep feeding the dog 369 + watchdog.feed(); 370 + 272 371 //Change Image Button 273 372 if btn_c.is_high() { 274 373 info!("Button C pressed"); 374 + // reset_cycles_till_sleep = 0; 275 375 let current_image = CURRENT_IMAGE.load(core::sync::atomic::Ordering::Relaxed); 276 376 let new_image = DisplayImage::from_u8(current_image).unwrap().next(); 277 377 CURRENT_IMAGE.store(new_image.as_u8(), core::sync::atomic::Ordering::Relaxed); 278 378 CHANGE_IMAGE.store(true, core::sync::atomic::Ordering::Relaxed); 279 379 Timer::after(Duration::from_millis(500)).await; 280 - current_cycle += 500; 281 380 continue; 282 381 } 283 382 284 - if btn_b.is_high() { 285 - info!("Button B pressed"); 383 + if btn_a.is_high() { 384 + println!("{:?}", current_cycle); 385 + info!("Button A pressed"); 386 + // reset_cycles_till_sleep = 0; 286 387 user_led.toggle(); 287 388 Timer::after(Duration::from_millis(500)).await; 288 - current_cycle += 500; 389 + continue; 390 + } 391 + 392 + if btn_down.is_high() { 393 + info!("Button Down pressed"); 394 + // reset_cycles_till_sleep = 0; 395 + SCREEN_TO_SHOW.lock(|screen| { 396 + screen.replace(Screen::WifiList); 397 + }); 398 + DISPLAY_CHANGED.store(true, core::sync::atomic::Ordering::Relaxed); 399 + Timer::after(Duration::from_millis(500)).await; 400 + continue; 401 + } 402 + 403 + if btn_up.is_high() { 404 + info!("Button Up pressed"); 405 + // reset_cycles_till_sleep = 0; 406 + SCREEN_TO_SHOW.lock(|screen| { 407 + screen.replace(Screen::Badge); 408 + }); 409 + DISPLAY_CHANGED.store(true, core::sync::atomic::Ordering::Relaxed); 410 + Timer::after(Duration::from_millis(500)).await; 289 411 continue; 290 412 } 291 413 292 - if time_was_set { 293 - let now = rtc.now(); 294 - match now { 295 - Ok(time) => set_display_time(time), 296 - Err(_) => { 297 - info!("Error getting time"); 414 + if btn_b.is_high() { 415 + info!("Button B pressed"); 416 + // reset_cycles_till_sleep = 0; 417 + SCREEN_TO_SHOW.lock(|screen| { 418 + if *screen.borrow() == Screen::Badge { 419 + //IF on badge screen and b pressed reset wifi count 420 + save.wifi_counted = 0; 421 + save.bssid.clear(); 422 + WIFI_COUNT.store(0, core::sync::atomic::Ordering::Relaxed); 423 + current_cycle = 0; 424 + } 425 + }); 426 + 427 + let mut recent_networks = RecentWifiNetworksVec::new(); 428 + let mut scanner = control.scan(Default::default()).await; 429 + 430 + while let Some(bss) = scanner.next().await { 431 + process_bssid(bss.bssid, &mut save.wifi_counted, &mut save.bssid); 432 + if recent_networks.len() < 8 { 433 + let possible_ssid = core::str::from_utf8(&bss.ssid); 434 + match possible_ssid { 435 + Ok(ssid) => { 436 + let removed_zeros = ssid.trim_end_matches(char::from(0)); 437 + let ssid_string: String<32> = 438 + easy_format::<32>(format_args!("{}", removed_zeros)); 439 + 440 + if recent_networks.contains(&ssid_string) { 441 + continue; 442 + } 443 + if ssid_string != "" { 444 + let _ = recent_networks.push(ssid_string); 445 + } 446 + } 447 + Err(_) => { 448 + continue; 449 + } 450 + } 298 451 } 299 452 } 300 - } else { 301 - RTC_TIME_STRING.lock(|rtc_time_string| { 302 - rtc_time_string.borrow_mut().clear(); 303 - rtc_time_string.borrow_mut().push_str("No Wifi").unwrap(); 453 + RECENT_WIFI_NETWORKS.lock(|recent_networks_vec| { 454 + recent_networks_vec.replace(recent_networks); 304 455 }); 456 + 457 + FORCE_SCREEN_REFRESH.store(true, core::sync::atomic::Ordering::Relaxed); 458 + Timer::after(Duration::from_millis(500)).await; 459 + 460 + continue; 305 461 } 306 - if current_cycle == 0 { 462 + 463 + match rtc_device.get_datetime() { 464 + Ok(now) => set_display_time(now), 465 + Err(_err) => { 466 + error!("Error getting time"); 467 + RTC_TIME_STRING.lock(|rtc_time_string| { 468 + rtc_time_string.borrow_mut().clear(); 469 + rtc_time_string.borrow_mut().push_str("Error").unwrap(); 470 + }); 471 + } 472 + }; 473 + 474 + if time_to_scan { 475 + info!("Scanning for wifi networks"); 476 + // reset_cycles_till_sleep += 1; 477 + time_to_scan = false; 307 478 let mut scanner = control.scan(Default::default()).await; 308 479 while let Some(bss) = scanner.next().await { 309 480 process_bssid(bss.bssid, &mut save.wifi_counted, &mut save.bssid); 310 - let ssid = core::str::from_utf8(&bss.ssid).unwrap(); 311 - info!("ssid: {}", ssid); 312 481 } 313 - save_postcard_to_flash(ADDR_OFFSET, &mut flash, SAVE_OFFSET, &save).unwrap(); 314 482 WIFI_COUNT.store(save.wifi_counted, core::sync::atomic::Ordering::Relaxed); 483 + save_postcard_to_flash(ADDR_OFFSET, &mut flash, SAVE_OFFSET, &save).unwrap(); 315 484 info!("wifi_counted: {}", save.wifi_counted); 316 485 } 317 486 if current_cycle >= reset_cycle { 318 487 current_cycle = 0; 488 + time_to_scan = true; 319 489 } 490 + 491 + // if reset_cycles_till_sleep >= sleep_after_cycles { 492 + // info!("Going to sleep"); 493 + // reset_cycles_till_sleep = 0; 494 + // go_to_sleep = true; 495 + // } 496 + // 497 + // if go_to_sleep { 498 + // info!("going to sleep"); 499 + // //SO i need to wait for 25 seconds to make sure the display updates fully...But i need to keep feeding the dog atleast every 8 seconds 500 + // for _ in 0..25 { 501 + // //watchdog.feed(); 502 + // Timer::after(Duration::from_secs(1)).await; 503 + // } 504 + // //Set the rtc and sleep for 15 minutes 505 + // //goes to sleep for 15 mins 506 + // _ = rtc_device.disable_all_alarms(); 507 + // _ = rtc_device.clear_alarm_flag(); 508 + // _ = rtc_device.set_alarm_minutes(5); 509 + // _ = rtc_device.control_alarm_minutes(Control::On); 510 + // _ = rtc_device.control_alarm_interrupt(Control::On); 511 + // power.set_low(); 512 + // } 513 + 320 514 current_cycle += 1; 321 515 Timer::after(cycle).await; 322 516 } 323 517 } 324 518 325 - fn set_display_time(time: DateTime) { 519 + fn set_display_time(time: PrimitiveDateTime) { 326 520 let mut am = true; 327 - let twelve_hour = if time.hour > 12 { 521 + let twelve_hour = if time.hour() == 0 { 522 + 12 523 + } else if time.hour() == 12 { 328 524 am = false; 329 - time.hour - 12 330 - } else if time.hour == 0 { 331 525 12 526 + } else if time.hour() > 12 { 527 + am = false; 528 + time.hour() - 12 332 529 } else { 333 - time.hour 530 + time.hour() 334 531 }; 335 532 336 533 let am_pm = if am { "AM" } else { "PM" }; 337 534 338 535 let formatted_time = easy_format::<8>(format_args!( 339 536 "{:02}:{:02} {}", 340 - twelve_hour, time.minute, am_pm 537 + twelve_hour, 538 + time.minute(), 539 + am_pm 341 540 )); 342 541 343 542 RTC_TIME_STRING.lock(|rtc_time_string| { ··· 350 549 } 351 550 352 551 #[embassy_executor::task] 353 - async fn net_task(stack: &'static Stack<cyw43::NetDriver<'static>>) -> ! { 354 - stack.run().await 552 + async fn net_task(mut runner: embassy_net::Runner<'static, cyw43::NetDriver<'static>>) -> ! { 553 + runner.run().await 554 + } 555 + 556 + #[embassy_executor::task] 557 + async fn cyw43_task( 558 + runner: cyw43::Runner<'static, Output<'static>, PioSpi<'static, PIO0, 0, DMA_CH0>>, 559 + ) -> ! { 560 + runner.run().await 355 561 } 356 562 357 563 #[derive(Deserialize)] ··· 364 570 let bssid_str = format_bssid(bssid); 365 571 if !bssids.contains(&bssid_str) { 366 572 *wifi_counted += 1; 367 - info!("bssid: {:x}", bssid_str); 573 + WIFI_COUNT.store(*wifi_counted, core::sync::atomic::Ordering::Relaxed); 574 + // info!("bssid: {:x}", bssid_str); 368 575 let result = bssids.push(bssid_str); 369 576 if result.is_err() { 370 577 info!("bssid list full");
+227
src/pcf85063a/alarm.rs
··· 1 + use super::{BitFlags, Control, DEVICE_ADDRESS, Error, PCF85063, Register, decode_bcd, encode_bcd}; 2 + use embedded_hal_1::i2c::I2c; 3 + use time::Time; 4 + 5 + impl<I2C, E> PCF85063<I2C> 6 + where 7 + I2C: I2c<Error = E>, 8 + { 9 + /// Set the alarm seconds, minutes and hours, keeping the AE bit unchanged. 10 + pub fn set_alarm_time(&mut self, time: Time) -> Result<(), Error<E>> { 11 + self.set_alarm_seconds(time.second())?; 12 + self.set_alarm_minutes(time.minute())?; 13 + self.set_alarm_hours(time.hour())?; 14 + Ok(()) 15 + } 16 + 17 + /// Set the alarm seconds [0-59], keeping the AE bit unchanged. 18 + pub fn set_alarm_seconds(&mut self, seconds: u8) -> Result<(), Error<E>> { 19 + if seconds > 59 { 20 + return Err(Error::InvalidInputData); 21 + } 22 + let data: u8 = self.read_register(Register::SECOND_ALARM)?; // read current value 23 + let data: u8 = data & BitFlags::AE; // keep the AE bit as is 24 + let setting: u8 = encode_bcd(seconds); 25 + let data: u8 = data | setting; 26 + self.write_register(Register::SECOND_ALARM, data) 27 + } 28 + 29 + /// Set the alarm minutes [0-59], keeping the AE bit unchanged. 30 + pub fn set_alarm_minutes(&mut self, minutes: u8) -> Result<(), Error<E>> { 31 + if minutes > 59 { 32 + return Err(Error::InvalidInputData); 33 + } 34 + let data: u8 = self.read_register(Register::MINUTE_ALARM)?; // read current value 35 + let data: u8 = data & BitFlags::AE; // keep the AE bit as is 36 + let setting: u8 = encode_bcd(minutes); 37 + let data: u8 = data | setting; 38 + self.write_register(Register::MINUTE_ALARM, data) 39 + } 40 + 41 + /// Set the alarm hours [0-23], keeping the AE bit unchanged. 42 + pub fn set_alarm_hours(&mut self, hours: u8) -> Result<(), Error<E>> { 43 + if hours > 23 { 44 + return Err(Error::InvalidInputData); 45 + } 46 + let data: u8 = self.read_register(Register::HOUR_ALARM)?; // read current value 47 + let data: u8 = data & BitFlags::AE; // keep the AE bit as is 48 + let setting: u8 = encode_bcd(hours); 49 + let data: u8 = data | setting; 50 + self.write_register(Register::HOUR_ALARM, data) 51 + } 52 + 53 + /// Set the alarm day [1-31], keeping the AE bit unchanged. 54 + pub fn set_alarm_day(&mut self, day: u8) -> Result<(), Error<E>> { 55 + if !(1..=31).contains(&day) { 56 + return Err(Error::InvalidInputData); 57 + } 58 + let data: u8 = self.read_register(Register::DAY_ALARM)?; // read current value 59 + let data: u8 = data & BitFlags::AE; // keep the AE bit as is 60 + let setting: u8 = encode_bcd(day); 61 + let data: u8 = data | setting; 62 + self.write_register(Register::DAY_ALARM, data) 63 + } 64 + 65 + /// Set the alarm weekday [0-6], keeping the AE bit unchanged. 66 + pub fn set_alarm_weekday(&mut self, weekday: u8) -> Result<(), Error<E>> { 67 + if weekday > 6 { 68 + return Err(Error::InvalidInputData); 69 + } 70 + let data: u8 = self.read_register(Register::WEEKDAY_ALARM)?; // read current value 71 + let data: u8 = data & BitFlags::AE; // keep the AE bit as is 72 + let setting: u8 = encode_bcd(weekday); 73 + let data: u8 = data | setting; 74 + self.write_register(Register::WEEKDAY_ALARM, data) 75 + } 76 + 77 + /// Control alarm seconds (On: alarm enabled, Off: alarm disabled). 78 + pub fn control_alarm_seconds(&mut self, status: Control) -> Result<(), Error<E>> { 79 + match status { 80 + Control::Off => self.set_register_bit_flag(Register::SECOND_ALARM, BitFlags::AE), 81 + Control::On => self.clear_register_bit_flag(Register::SECOND_ALARM, BitFlags::AE), 82 + } 83 + } 84 + 85 + /// Is alarm seconds enabled? 86 + pub fn is_alarm_seconds_enabled(&mut self) -> Result<bool, Error<E>> { 87 + Ok(!self.is_register_bit_flag_high(Register::SECOND_ALARM, BitFlags::AE)?) 88 + } 89 + 90 + /// Control alarm minutes (On: alarm enabled, Off: alarm disabled). 91 + pub fn control_alarm_minutes(&mut self, status: Control) -> Result<(), Error<E>> { 92 + match status { 93 + Control::Off => self.set_register_bit_flag(Register::MINUTE_ALARM, BitFlags::AE), 94 + Control::On => self.clear_register_bit_flag(Register::MINUTE_ALARM, BitFlags::AE), 95 + } 96 + } 97 + 98 + /// Is alarm minutes enabled? 99 + pub fn is_alarm_minutes_enabled(&mut self) -> Result<bool, Error<E>> { 100 + Ok(!self.is_register_bit_flag_high(Register::MINUTE_ALARM, BitFlags::AE)?) 101 + } 102 + 103 + /// Control alarm hours (On: alarm enabled, Off: alarm disabled). 104 + pub fn control_alarm_hours(&mut self, status: Control) -> Result<(), Error<E>> { 105 + match status { 106 + Control::Off => self.set_register_bit_flag(Register::HOUR_ALARM, BitFlags::AE), 107 + Control::On => self.clear_register_bit_flag(Register::HOUR_ALARM, BitFlags::AE), 108 + } 109 + } 110 + 111 + /// Is alarm hours enabled? 112 + pub fn is_alarm_hours_enabled(&mut self) -> Result<bool, Error<E>> { 113 + Ok(!self.is_register_bit_flag_high(Register::HOUR_ALARM, BitFlags::AE)?) 114 + } 115 + 116 + /// Control alarm day (On: alarm enabled, Off: alarm disabled). 117 + pub fn control_alarm_day(&mut self, status: Control) -> Result<(), Error<E>> { 118 + match status { 119 + Control::Off => self.set_register_bit_flag(Register::DAY_ALARM, BitFlags::AE), 120 + Control::On => self.clear_register_bit_flag(Register::DAY_ALARM, BitFlags::AE), 121 + } 122 + } 123 + 124 + /// Is alarm day enabled? 125 + pub fn is_alarm_day_enabled(&mut self) -> Result<bool, Error<E>> { 126 + Ok(!self.is_register_bit_flag_high(Register::DAY_ALARM, BitFlags::AE)?) 127 + } 128 + 129 + /// Control alarm weekday (On: alarm enabled, Off: alarm disabled). 130 + pub fn control_alarm_weekday(&mut self, status: Control) -> Result<(), Error<E>> { 131 + match status { 132 + Control::Off => self.set_register_bit_flag(Register::WEEKDAY_ALARM, BitFlags::AE), 133 + Control::On => self.clear_register_bit_flag(Register::WEEKDAY_ALARM, BitFlags::AE), 134 + } 135 + } 136 + 137 + /// Is alarm weekday enabled? 138 + pub fn is_alarm_weekday_enabled(&mut self) -> Result<bool, Error<E>> { 139 + Ok(!self.is_register_bit_flag_high(Register::WEEKDAY_ALARM, BitFlags::AE)?) 140 + } 141 + 142 + /// Enable or disable alarm interrupt. 143 + pub fn control_alarm_interrupt(&mut self, status: Control) -> Result<(), Error<E>> { 144 + match status { 145 + Control::On => self.set_register_bit_flag(Register::CONTROL_2, BitFlags::AIE), 146 + Control::Off => self.clear_register_bit_flag(Register::CONTROL_2, BitFlags::AIE), 147 + } 148 + } 149 + 150 + pub fn get_alarm_time(&mut self) -> Result<Time, Error<E>> { 151 + Ok(Time::from_hms( 152 + self.get_alarm_hours()?, 153 + self.get_alarm_minutes()?, 154 + self.get_alarm_seconds()?, 155 + )?) 156 + } 157 + 158 + /// Read the alarm seconds setting. 159 + pub fn get_alarm_seconds(&mut self) -> Result<u8, Error<E>> { 160 + let mut data = [0]; 161 + self.i2c 162 + .write_read(DEVICE_ADDRESS, &[Register::SECOND_ALARM], &mut data) 163 + .map_err(Error::I2C)?; 164 + Ok(decode_bcd(data[0])) 165 + } 166 + 167 + /// Read the alarm minutes setting. 168 + pub fn get_alarm_minutes(&mut self) -> Result<u8, Error<E>> { 169 + let mut data = [0]; 170 + self.i2c 171 + .write_read(DEVICE_ADDRESS, &[Register::MINUTE_ALARM], &mut data) 172 + .map_err(Error::I2C)?; 173 + Ok(decode_bcd(data[0])) 174 + } 175 + 176 + /// Read the alarm hours setting. 177 + pub fn get_alarm_hours(&mut self) -> Result<u8, Error<E>> { 178 + let mut data = [0]; 179 + self.i2c 180 + .write_read(DEVICE_ADDRESS, &[Register::HOUR_ALARM], &mut data) 181 + .map_err(Error::I2C)?; 182 + Ok(decode_bcd(data[0])) 183 + } 184 + 185 + /// Read the alarm day setting. 186 + pub fn get_alarm_day(&mut self) -> Result<u8, Error<E>> { 187 + let mut data = [0]; 188 + self.i2c 189 + .write_read(DEVICE_ADDRESS, &[Register::DAY_ALARM], &mut data) 190 + .map_err(Error::I2C)?; 191 + Ok(decode_bcd(data[0])) 192 + } 193 + 194 + /// Read the alarm weekday setting. 195 + pub fn get_alarm_weekday(&mut self) -> Result<u8, Error<E>> { 196 + let mut data = [0]; 197 + self.i2c 198 + .write_read(DEVICE_ADDRESS, &[Register::WEEKDAY_ALARM], &mut data) 199 + .map_err(Error::I2C)?; 200 + Ok(decode_bcd(data[0])) 201 + } 202 + 203 + /// Get the alarm flag (if true, alarm event happened). 204 + pub fn get_alarm_flag(&mut self) -> Result<bool, Error<E>> { 205 + self.is_register_bit_flag_high(Register::CONTROL_2, BitFlags::AF) 206 + } 207 + 208 + /// Clear the alarm flag. 209 + pub fn clear_alarm_flag(&mut self) -> Result<(), Error<E>> { 210 + self.clear_register_bit_flag(Register::CONTROL_2, BitFlags::AF) 211 + } 212 + 213 + /// Check if alarm interrupt is enabled. 214 + pub fn is_alarm_interrupt_enabled(&mut self) -> Result<bool, Error<E>> { 215 + self.is_register_bit_flag_high(Register::CONTROL_2, BitFlags::AIE) 216 + } 217 + 218 + /// Shut off the alarms at once. 219 + pub fn disable_all_alarms(&mut self) -> Result<(), Error<E>> { 220 + self.control_alarm_seconds(Control::Off)?; 221 + self.control_alarm_minutes(Control::Off)?; 222 + self.control_alarm_hours(Control::Off)?; 223 + self.control_alarm_day(Control::Off)?; 224 + self.control_alarm_weekday(Control::Off)?; 225 + Ok(()) 226 + } 227 + }
+67
src/pcf85063a/datetime.rs
··· 1 + //! All date and time-related functions will be defined here. 2 + //! 3 + //! Reading and setting single elements (seconds, hours, months) will NOT be implemented 4 + //! following the recommendations in the NXP datasheet to set and read all the seven date and time registers in one go. 5 + //! 6 + //! TO DO: As the chip may be used for devices that are clocks only, without the calendar function 7 + //! a convenient set_time() function could be added (sets only seconds, minutes and hours) 8 + 9 + use super::{DEVICE_ADDRESS, Error, PCF85063, Register, decode_bcd, encode_bcd}; 10 + use embassy_rp::rtc::DateTime; 11 + use embedded_hal_1::i2c::I2c; 12 + use time::{Date, PrimitiveDateTime, Time}; 13 + 14 + impl<I2C, E> PCF85063<I2C> 15 + where 16 + I2C: I2c<Error = E>, 17 + { 18 + /// Read date and time all at once. 19 + pub fn get_datetime(&mut self) -> Result<PrimitiveDateTime, Error<E>> { 20 + let mut data = [0; 7]; 21 + self.i2c 22 + .write_read(DEVICE_ADDRESS, &[Register::SECONDS], &mut data) 23 + .map_err(Error::I2C)?; 24 + 25 + Ok(PrimitiveDateTime::new( 26 + Date::from_calendar_date( 27 + 2000 + decode_bcd(data[6]) as i32, 28 + decode_bcd(data[5] & 0x1f).try_into()?, 29 + decode_bcd(data[3] & 0x3f), 30 + )?, 31 + Time::from_hms( 32 + decode_bcd(data[2] & 0x3f), 33 + decode_bcd(data[1] & 0b0111_1111), 34 + decode_bcd(data[0] & 0b0111_1111), 35 + )?, 36 + )) 37 + } 38 + 39 + /// Set date and time all at once. 40 + pub fn set_datetime(&mut self, datetime: &DateTime) -> Result<(), Error<E>> { 41 + let payload = [ 42 + Register::SECONDS, //first register 43 + encode_bcd(datetime.second), 44 + encode_bcd(datetime.minute), 45 + encode_bcd(datetime.hour), 46 + encode_bcd(datetime.day), 47 + //Not sure if this is correct 48 + encode_bcd(datetime.day_of_week as u8), 49 + encode_bcd(datetime.month), 50 + encode_bcd((datetime.year - 2000) as u8), 51 + ]; 52 + self.i2c.write(DEVICE_ADDRESS, &payload).map_err(Error::I2C) 53 + } 54 + 55 + /// Set only the time, date remains unchanged. 56 + /// 57 + /// Will return an 'Error::InvalidInputData' if any of the parameters is out of range. 58 + pub fn set_time(&mut self, time: &Time) -> Result<(), Error<E>> { 59 + let payload = [ 60 + Register::SECONDS, //first register 61 + encode_bcd(time.second()), 62 + encode_bcd(time.minute()), 63 + encode_bcd(time.hour()), 64 + ]; 65 + self.i2c.write(DEVICE_ADDRESS, &payload).map_err(Error::I2C) 66 + } 67 + }
+253
src/pcf85063a/mod.rs
··· 1 + #![allow(dead_code)] 2 + 3 + ///None of this code is mine. It's https://crates.io/crates/pcf85063a 4 + /// I just needed a synchronous version so did a local clone and pulled the async and awaits 5 + pub mod alarm; 6 + pub mod datetime; 7 + 8 + use embedded_hal_1::i2c::I2c; 9 + 10 + /// All possible errors in this crate 11 + #[derive(Debug, defmt::Format)] 12 + pub enum Error<E> { 13 + /// I2C bus error 14 + I2C(E), 15 + /// Invalid input data 16 + InvalidInputData, 17 + /// A time component was out of range 18 + ComponentRange, 19 + } 20 + 21 + impl<E> From<time::error::ComponentRange> for Error<E> { 22 + fn from(_: time::error::ComponentRange) -> Self { 23 + Self::ComponentRange 24 + } 25 + } 26 + 27 + pub struct Register; 28 + 29 + impl Register { 30 + // control and status registers 31 + pub const CONTROL_1: u8 = 0x00; 32 + pub const CONTROL_2: u8 = 0x01; 33 + pub const OFFSET: u8 = 0x02; 34 + pub const RAM_BYTE: u8 = 0x03; 35 + 36 + // time and date registers 37 + pub const SECONDS: u8 = 0x04; 38 + pub const MINUTES: u8 = 0x05; 39 + pub const HOURS: u8 = 0x06; 40 + pub const DAYS: u8 = 0x07; 41 + pub const WEEKDAYS: u8 = 0x08; 42 + pub const MONTHS: u8 = 0x09; 43 + pub const YEARS: u8 = 0x0A; 44 + 45 + // alarm registers 46 + pub const SECOND_ALARM: u8 = 0x0B; 47 + pub const MINUTE_ALARM: u8 = 0x0C; 48 + pub const HOUR_ALARM: u8 = 0x0D; 49 + pub const DAY_ALARM: u8 = 0x0E; 50 + pub const WEEKDAY_ALARM: u8 = 0x0F; 51 + 52 + // timer registers 53 + pub const TIMER_VALUE: u8 = 0x10; 54 + pub const TIMER_MODE: u8 = 0x11; 55 + } 56 + 57 + pub struct BitFlags; 58 + 59 + impl BitFlags { 60 + // control 1 61 + pub const CAP_SEL: u8 = 0b0000_0001; // internal oscillator capacitor selection 62 + pub const MODE_12_24: u8 = 0b0000_0010; // 12 or 24-hour mode 63 + pub const CIE: u8 = 0b0000_0100; // connection interrupt enable 64 + // 3: UNUSED 65 + pub const SR: u8 = 0b0001_0000; // software reset 66 + pub const STOP: u8 = 0b0010_0000; // RTC clock stop bit 67 + // 6: UNUSED 68 + pub const EXT_TEST: u8 = 0b1000_0000; // external clock test mode 69 + 70 + // control 2 71 + pub const COF: u8 = 0b0000_0111; // clkout control 72 + pub const TF: u8 = 0b0000_1000; // timer flag 73 + pub const HMI: u8 = 0b0001_0000; // half minute interrupt 74 + pub const MI: u8 = 0b0010_0000; // minute interrupt 75 + pub const AF: u8 = 0b0100_0000; // alarm flag 76 + pub const AIE: u8 = 0b1000_0000; // alarm interrupt enabled 77 + 78 + pub const AE: u8 = 0b1000_0000; // alarm enable/disable for all five (s/m/h/d/wd) settings 79 + } 80 + 81 + const DEVICE_ADDRESS: u8 = 0b1010001; 82 + 83 + /// Two possible choices, used for various enable/disable bit flags 84 + #[allow(non_camel_case_types)] 85 + #[derive(Copy, Clone, Debug, defmt::Format)] 86 + pub enum Control { 87 + /// Enable some feature, eg. timer 88 + On, 89 + /// Disable some feature, eg. timer 90 + Off, 91 + } 92 + 93 + /// PCF8563 driver 94 + #[derive(Debug, Default, defmt::Format)] 95 + pub struct PCF85063<I2C> { 96 + /// The concrete I2C device implementation. 97 + i2c: I2C, 98 + } 99 + 100 + impl<I2C, E> PCF85063<I2C> 101 + where 102 + I2C: I2c<Error = E>, 103 + { 104 + /// Create a new instance of the PCF8563 driver. 105 + pub fn new(i2c: I2C) -> Self { 106 + PCF85063 { i2c } 107 + } 108 + 109 + /// Reset the RTC 110 + pub fn reset(&mut self) -> Result<(), Error<E>> { 111 + self.set_register_bit_flag(Register::CONTROL_1, BitFlags::SR) 112 + } 113 + 114 + /// Destroy driver instance, return I2C bus instance. 115 + pub fn destroy(self) -> I2C { 116 + self.i2c 117 + } 118 + 119 + /// Let the device reset itself 120 + pub fn perform_software_reset(&mut self) -> Result<(), Error<E>> { 121 + self.write_register(Register::CONTROL_1, 0b01011000) 122 + } 123 + 124 + /// Write to a register. 125 + pub fn write_register(&mut self, register: u8, data: u8) -> Result<(), Error<E>> { 126 + let payload: [u8; 2] = [register, data]; 127 + self.i2c.write(DEVICE_ADDRESS, &payload).map_err(Error::I2C) 128 + } 129 + 130 + /// Read from a register. 131 + pub fn read_register(&mut self, register: u8) -> Result<u8, Error<E>> { 132 + let mut data = [0]; 133 + self.i2c 134 + .write_read(DEVICE_ADDRESS, &[register], &mut data) 135 + .map_err(Error::I2C) 136 + .and(Ok(data[0])) 137 + } 138 + 139 + /// Check if specific bits are set. 140 + pub fn is_register_bit_flag_high( 141 + &mut self, 142 + address: u8, 143 + bitmask: u8, 144 + ) -> Result<bool, Error<E>> { 145 + let data = self.read_register(address)?; 146 + Ok((data & bitmask) != 0) 147 + } 148 + 149 + /// Set specific bits. 150 + pub fn set_register_bit_flag(&mut self, address: u8, bitmask: u8) -> Result<(), Error<E>> { 151 + let data = self.read_register(address)?; 152 + if (data & bitmask) == 0 { 153 + self.write_register(address, data | bitmask) 154 + } else { 155 + Ok(()) 156 + } 157 + } 158 + 159 + /// Clear specific bits. 160 + pub fn clear_register_bit_flag(&mut self, address: u8, bitmask: u8) -> Result<(), Error<E>> { 161 + let data = self.read_register(address)?; 162 + if (data & bitmask) != 0 { 163 + self.write_register(address, data & !bitmask) 164 + } else { 165 + Ok(()) 166 + } 167 + } 168 + } 169 + 170 + impl<I2C, E> PCF85063<I2C> 171 + where 172 + I2C: I2c<Error = E>, 173 + { 174 + pub fn read_ram_byte(&mut self) -> Result<u8, Error<E>> { 175 + self.read_register(Register::RAM_BYTE) 176 + } 177 + 178 + pub fn write_ram_byte(&mut self, byte: u8) -> Result<(), Error<E>> { 179 + self.write_register(Register::RAM_BYTE, byte) 180 + } 181 + } 182 + 183 + impl<I2C, E> PCF85063<I2C> 184 + where 185 + I2C: I2c<Error = E>, 186 + { 187 + pub fn stop_clock(&mut self) -> Result<(), Error<E>> { 188 + self.set_register_bit_flag(Register::CONTROL_1, BitFlags::STOP) 189 + } 190 + 191 + pub fn start_clock(&mut self) -> Result<(), Error<E>> { 192 + self.clear_register_bit_flag(Register::CONTROL_1, BitFlags::STOP) 193 + } 194 + } 195 + 196 + #[derive(Debug, Clone, Copy, PartialEq, Eq, defmt::Format)] 197 + #[repr(u8)] 198 + pub enum OutputFrequency { 199 + Hz32768 = 0b000, 200 + Hz16384 = 0b001, 201 + Hz8192 = 0b010, 202 + Hz4096 = 0b011, 203 + Hz2048 = 0b100, 204 + Hz1024 = 0b101, 205 + Hz1 = 0b110, 206 + Hz0 = 0b111, 207 + } 208 + 209 + impl Default for OutputFrequency { 210 + fn default() -> Self { 211 + OutputFrequency::Hz32768 212 + } 213 + } 214 + 215 + impl OutputFrequency { 216 + pub const fn bits(self) -> u8 { 217 + self as u8 218 + } 219 + } 220 + 221 + impl<I2C, E> PCF85063<I2C> 222 + where 223 + I2C: I2c<Error = E>, 224 + { 225 + pub fn read_clock_output_frequency(&mut self) -> Result<OutputFrequency, Error<E>> { 226 + let value = self.read_register(Register::CONTROL_2)? & BitFlags::COF; 227 + 228 + Ok(unsafe { core::mem::transmute(value) }) 229 + } 230 + 231 + pub fn write_clock_output_frequency(&mut self, freq: OutputFrequency) -> Result<(), Error<E>> { 232 + let value = self.read_register(Register::CONTROL_2)?; 233 + let cleared = value ^ BitFlags::COF; 234 + let set = cleared | freq as u8; 235 + 236 + self.write_register(Register::CONTROL_2, set) 237 + } 238 + } 239 + 240 + /// Convert the Binary Coded Decimal value to decimal (only the lowest 7 bits). 241 + fn decode_bcd(input: u8) -> u8 { 242 + let digits: u8 = input & 0xf; 243 + let tens: u8 = (input >> 4) & 0x7; 244 + 10 * tens + digits 245 + } 246 + 247 + /// Convert the decimal value to Binary Coded Decimal. 248 + fn encode_bcd(input: u8) -> u8 { 249 + let digits: u8 = input % 10; 250 + let tens: u8 = input / 10; 251 + let tens = tens << 4; 252 + tens + digits 253 + }
+9
src/save.rs
··· 60 60 pub wifi_counted: u32, 61 61 pub bssid: Vec<String<17>, BSSID_LEN>, 62 62 } 63 + 64 + impl Save { 65 + pub fn new() -> Self { 66 + Self { 67 + wifi_counted: 0, 68 + bssid: Vec::new(), 69 + } 70 + } 71 + }
+6 -12
src/temp_sensor.rs
··· 1 + use crate::I2c0Bus; 2 + use crate::badge_display::{HUMIDITY, TEMP}; 1 3 use defmt::*; 2 - use embassy_rp::i2c::{I2c, SclPin, SdaPin}; 3 - use embassy_rp::peripherals::I2C0; 4 - use embassy_rp::{i2c, Peripheral}; 4 + use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice; 5 5 use embassy_time::Timer; 6 6 use shtcx::{self, PowerMode}; 7 7 8 - use crate::badge_display::{HUMIDITY, TEMP}; // Import the necessary items from shtcx 9 - 10 8 #[embassy_executor::task] 11 - pub async fn run_the_temp_sensor( 12 - i2c0: I2C0, 13 - scl: impl Peripheral<P = impl SclPin<I2C0>> + 'static, 14 - sda: impl Peripheral<P = impl SdaPin<I2C0>> + 'static, 15 - ) { 16 - let i2c = I2c::new_blocking(i2c0, scl, sda, i2c::Config::default()); 9 + pub async fn run_the_temp_sensor(i2c_bus: &'static I2c0Bus) { 10 + let i2c_dev = I2cDevice::new(i2c_bus); 17 11 18 - let mut sht = shtcx::shtc3(i2c); 12 + let mut sht = shtcx::shtc3(i2c_dev); 19 13 let mut sht_delay = embassy_time::Delay; // Create a delay instance 20 14 21 15 loop {