diff options
| author | MathisDerooNXP <[email protected]> | 2025-11-26 10:05:16 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-26 10:05:16 -0800 |
| commit | d12bc9785399991065e511efbea34f0138c7645e (patch) | |
| tree | 47472365383c3a5ad5d4ab0495e655a3418477d9 /examples | |
| parent | 1efaaa4025120413ec17de90106244445208804a (diff) | |
Add GPIO interrupt support and embedded-hal-async trait implementation (#38)
* Add GPIO interrupt support and embedded-hal-async trait implementation
Signed-off-by: Mathis Deroo <[email protected]>
* Run cargo fmt
* Improve GPIO driver interrupt mechanism and example
- GPIO interrupt managed internally at the HAL level,
- Renamed and cleaned gpio_interrupt example; now button_async.rs,
- Use BitIter instead of simple for loop in the irq handler,
- Fix comments and add "rt" wrappen to GPIO IRQ handler.
Signed-off-by: Mathis Deroo <[email protected]>
* Modify INTERRUPT_DETECTED (AtomicBool to AtomicU32) to work with pin number and not only port number interrupt
Signed-off-by: Mathis Deroo <[email protected]>
* add embedded_hal_async::digital::* traits
Signed-off-by: Mathis Deroo <[email protected]>
* Update irq_handler with BitIter loop
Co-authored-by: Felipe Balbi <[email protected]>
* Add suggested changes
Signed-off-by: Mathis Deroo <[email protected]>
* cargo fmt
Signed-off-by: Felipe Balbi <[email protected]>
* WIP: Modify Wakers from AtomicWaker to WaitMap, with pin number (per PORT) as key
Signed-off-by: Mathis Deroo <[email protected]>
* Tweak maitake-sync usage
* Improve docs
* refactor a bit
* Move all of the async+interrupt stuff into a module
* Remove defmt debug traces
Signed-off-by: Mathis Deroo <[email protected]>
* cargo vet
* Move e-hal-async impls into the gated block
* "rt", begone!
---------
Signed-off-by: Mathis Deroo <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Co-authored-by: Felipe Balbi <[email protected]>
Co-authored-by: Felipe Balbi <[email protected]>
Co-authored-by: Felipe Balbi <[email protected]>
Co-authored-by: James Munns <[email protected]>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/Cargo.lock | 414 | ||||
| -rw-r--r-- | examples/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/src/bin/button_async.rs | 28 |
3 files changed, 443 insertions, 1 deletions
diff --git a/examples/Cargo.lock b/examples/Cargo.lock index cda1f9ec8..c6e864df2 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock | |||
| @@ -3,6 +3,15 @@ | |||
| 3 | version = 4 | 3 | version = 4 |
| 4 | 4 | ||
| 5 | [[package]] | 5 | [[package]] |
| 6 | name = "aho-corasick" | ||
| 7 | version = "1.1.4" | ||
| 8 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 9 | checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" | ||
| 10 | dependencies = [ | ||
| 11 | "memchr", | ||
| 12 | ] | ||
| 13 | |||
| 14 | [[package]] | ||
| 6 | name = "anyhow" | 15 | name = "anyhow" |
| 7 | version = "1.0.100" | 16 | version = "1.0.100" |
| 8 | source = "registry+https://github.com/rust-lang/crates.io-index" | 17 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -97,6 +106,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 97 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" | 106 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" |
| 98 | 107 | ||
| 99 | [[package]] | 108 | [[package]] |
| 109 | name = "cc" | ||
| 110 | version = "1.2.47" | ||
| 111 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 112 | checksum = "cd405d82c84ff7f35739f175f67d8b9fb7687a0e84ccdc78bd3568839827cf07" | ||
| 113 | dependencies = [ | ||
| 114 | "find-msvc-tools", | ||
| 115 | "shlex", | ||
| 116 | ] | ||
| 117 | |||
| 118 | [[package]] | ||
| 100 | name = "cfg-if" | 119 | name = "cfg-if" |
| 101 | version = "1.0.4" | 120 | version = "1.0.4" |
| 102 | source = "registry+https://github.com/rust-lang/crates.io-index" | 121 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -112,6 +131,16 @@ dependencies = [ | |||
| 112 | ] | 131 | ] |
| 113 | 132 | ||
| 114 | [[package]] | 133 | [[package]] |
| 134 | name = "cordyceps" | ||
| 135 | version = "0.3.4" | ||
| 136 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 137 | checksum = "688d7fbb8092b8de775ef2536f36c8c31f2bc4006ece2e8d8ad2d17d00ce0a2a" | ||
| 138 | dependencies = [ | ||
| 139 | "loom", | ||
| 140 | "tracing", | ||
| 141 | ] | ||
| 142 | |||
| 143 | [[package]] | ||
| 115 | name = "cortex-m" | 144 | name = "cortex-m" |
| 116 | version = "0.7.7" | 145 | version = "0.7.7" |
| 117 | source = "registry+https://github.com/rust-lang/crates.io-index" | 146 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -376,6 +405,7 @@ dependencies = [ | |||
| 376 | "embedded-io", | 405 | "embedded-io", |
| 377 | "embedded-io-async", | 406 | "embedded-io-async", |
| 378 | "heapless 0.8.0", | 407 | "heapless 0.8.0", |
| 408 | "maitake-sync", | ||
| 379 | "mcxa-pac", | 409 | "mcxa-pac", |
| 380 | "nb 1.1.0", | 410 | "nb 1.1.0", |
| 381 | "paste", | 411 | "paste", |
| @@ -513,6 +543,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 513 | checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" | 543 | checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" |
| 514 | 544 | ||
| 515 | [[package]] | 545 | [[package]] |
| 546 | name = "find-msvc-tools" | ||
| 547 | version = "0.1.5" | ||
| 548 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 549 | checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" | ||
| 550 | |||
| 551 | [[package]] | ||
| 516 | name = "fnv" | 552 | name = "fnv" |
| 517 | version = "1.0.7" | 553 | version = "1.0.7" |
| 518 | source = "registry+https://github.com/rust-lang/crates.io-index" | 554 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -537,6 +573,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 537 | checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" | 573 | checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" |
| 538 | 574 | ||
| 539 | [[package]] | 575 | [[package]] |
| 576 | name = "generator" | ||
| 577 | version = "0.8.7" | ||
| 578 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 579 | checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2" | ||
| 580 | dependencies = [ | ||
| 581 | "cc", | ||
| 582 | "cfg-if", | ||
| 583 | "libc", | ||
| 584 | "log", | ||
| 585 | "rustversion", | ||
| 586 | "windows", | ||
| 587 | ] | ||
| 588 | |||
| 589 | [[package]] | ||
| 540 | name = "hash32" | 590 | name = "hash32" |
| 541 | version = "0.3.1" | 591 | version = "0.3.1" |
| 542 | source = "registry+https://github.com/rust-lang/crates.io-index" | 592 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -614,12 +664,59 @@ dependencies = [ | |||
| 614 | ] | 664 | ] |
| 615 | 665 | ||
| 616 | [[package]] | 666 | [[package]] |
| 667 | name = "lazy_static" | ||
| 668 | version = "1.5.0" | ||
| 669 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 670 | checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" | ||
| 671 | |||
| 672 | [[package]] | ||
| 673 | name = "libc" | ||
| 674 | version = "0.2.177" | ||
| 675 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 676 | checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" | ||
| 677 | |||
| 678 | [[package]] | ||
| 617 | name = "litrs" | 679 | name = "litrs" |
| 618 | version = "1.0.0" | 680 | version = "1.0.0" |
| 619 | source = "registry+https://github.com/rust-lang/crates.io-index" | 681 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 620 | checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" | 682 | checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" |
| 621 | 683 | ||
| 622 | [[package]] | 684 | [[package]] |
| 685 | name = "log" | ||
| 686 | version = "0.4.28" | ||
| 687 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 688 | checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" | ||
| 689 | |||
| 690 | [[package]] | ||
| 691 | name = "loom" | ||
| 692 | version = "0.7.2" | ||
| 693 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 694 | checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" | ||
| 695 | dependencies = [ | ||
| 696 | "cfg-if", | ||
| 697 | "generator", | ||
| 698 | "scoped-tls", | ||
| 699 | "tracing", | ||
| 700 | "tracing-subscriber", | ||
| 701 | ] | ||
| 702 | |||
| 703 | [[package]] | ||
| 704 | name = "maitake-sync" | ||
| 705 | version = "0.2.2" | ||
| 706 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 707 | checksum = "748f86d9befd480b602c3bebc9ef30dbf2f3dfc8acc4a73d07b90f0117e6de3f" | ||
| 708 | dependencies = [ | ||
| 709 | "cordyceps", | ||
| 710 | "critical-section", | ||
| 711 | "loom", | ||
| 712 | "mutex-traits", | ||
| 713 | "mycelium-bitfield", | ||
| 714 | "pin-project", | ||
| 715 | "portable-atomic", | ||
| 716 | "tracing", | ||
| 717 | ] | ||
| 718 | |||
| 719 | [[package]] | ||
| 623 | name = "manyhow" | 720 | name = "manyhow" |
| 624 | version = "0.11.4" | 721 | version = "0.11.4" |
| 625 | source = "registry+https://github.com/rust-lang/crates.io-index" | 722 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -644,6 +741,15 @@ dependencies = [ | |||
| 644 | ] | 741 | ] |
| 645 | 742 | ||
| 646 | [[package]] | 743 | [[package]] |
| 744 | name = "matchers" | ||
| 745 | version = "0.2.0" | ||
| 746 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 747 | checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" | ||
| 748 | dependencies = [ | ||
| 749 | "regex-automata", | ||
| 750 | ] | ||
| 751 | |||
| 752 | [[package]] | ||
| 647 | name = "maybe-async-cfg" | 753 | name = "maybe-async-cfg" |
| 648 | version = "0.2.5" | 754 | version = "0.2.5" |
| 649 | source = "registry+https://github.com/rust-lang/crates.io-index" | 755 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -685,6 +791,18 @@ dependencies = [ | |||
| 685 | ] | 791 | ] |
| 686 | 792 | ||
| 687 | [[package]] | 793 | [[package]] |
| 794 | name = "mutex-traits" | ||
| 795 | version = "1.0.1" | ||
| 796 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 797 | checksum = "3929f2b5633d29cf7b6624992e5f3c1e9334f1193423e12d17be4faf678cde3f" | ||
| 798 | |||
| 799 | [[package]] | ||
| 800 | name = "mycelium-bitfield" | ||
| 801 | version = "0.1.5" | ||
| 802 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 803 | checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc" | ||
| 804 | |||
| 805 | [[package]] | ||
| 688 | name = "nb" | 806 | name = "nb" |
| 689 | version = "0.1.3" | 807 | version = "0.1.3" |
| 690 | source = "registry+https://github.com/rust-lang/crates.io-index" | 808 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -700,6 +818,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 700 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" | 818 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" |
| 701 | 819 | ||
| 702 | [[package]] | 820 | [[package]] |
| 821 | name = "nu-ansi-term" | ||
| 822 | version = "0.50.3" | ||
| 823 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 824 | checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" | ||
| 825 | dependencies = [ | ||
| 826 | "windows-sys", | ||
| 827 | ] | ||
| 828 | |||
| 829 | [[package]] | ||
| 703 | name = "num" | 830 | name = "num" |
| 704 | version = "0.4.3" | 831 | version = "0.4.3" |
| 705 | source = "registry+https://github.com/rust-lang/crates.io-index" | 832 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -773,6 +900,12 @@ dependencies = [ | |||
| 773 | ] | 900 | ] |
| 774 | 901 | ||
| 775 | [[package]] | 902 | [[package]] |
| 903 | name = "once_cell" | ||
| 904 | version = "1.21.3" | ||
| 905 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 906 | checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" | ||
| 907 | |||
| 908 | [[package]] | ||
| 776 | name = "panic-probe" | 909 | name = "panic-probe" |
| 777 | version = "1.0.0" | 910 | version = "1.0.0" |
| 778 | source = "registry+https://github.com/rust-lang/crates.io-index" | 911 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -795,6 +928,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 795 | checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" | 928 | checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" |
| 796 | 929 | ||
| 797 | [[package]] | 930 | [[package]] |
| 931 | name = "pin-project" | ||
| 932 | version = "1.1.10" | ||
| 933 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 934 | checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" | ||
| 935 | dependencies = [ | ||
| 936 | "pin-project-internal", | ||
| 937 | ] | ||
| 938 | |||
| 939 | [[package]] | ||
| 940 | name = "pin-project-internal" | ||
| 941 | version = "1.1.10" | ||
| 942 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 943 | checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" | ||
| 944 | dependencies = [ | ||
| 945 | "proc-macro2", | ||
| 946 | "quote", | ||
| 947 | "syn 2.0.110", | ||
| 948 | ] | ||
| 949 | |||
| 950 | [[package]] | ||
| 951 | name = "pin-project-lite" | ||
| 952 | version = "0.2.16" | ||
| 953 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 954 | checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" | ||
| 955 | |||
| 956 | [[package]] | ||
| 957 | name = "portable-atomic" | ||
| 958 | version = "1.11.1" | ||
| 959 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 960 | checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" | ||
| 961 | dependencies = [ | ||
| 962 | "critical-section", | ||
| 963 | ] | ||
| 964 | |||
| 965 | [[package]] | ||
| 798 | name = "proc-macro-error-attr2" | 966 | name = "proc-macro-error-attr2" |
| 799 | version = "2.0.0" | 967 | version = "2.0.0" |
| 800 | source = "registry+https://github.com/rust-lang/crates.io-index" | 968 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -863,6 +1031,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 863 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" | 1031 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" |
| 864 | 1032 | ||
| 865 | [[package]] | 1033 | [[package]] |
| 1034 | name = "regex-automata" | ||
| 1035 | version = "0.4.13" | ||
| 1036 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1037 | checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" | ||
| 1038 | dependencies = [ | ||
| 1039 | "aho-corasick", | ||
| 1040 | "memchr", | ||
| 1041 | "regex-syntax", | ||
| 1042 | ] | ||
| 1043 | |||
| 1044 | [[package]] | ||
| 1045 | name = "regex-syntax" | ||
| 1046 | version = "0.8.8" | ||
| 1047 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1048 | checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" | ||
| 1049 | |||
| 1050 | [[package]] | ||
| 866 | name = "rustc-hash" | 1051 | name = "rustc-hash" |
| 867 | version = "2.1.1" | 1052 | version = "2.1.1" |
| 868 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1053 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -878,12 +1063,24 @@ dependencies = [ | |||
| 878 | ] | 1063 | ] |
| 879 | 1064 | ||
| 880 | [[package]] | 1065 | [[package]] |
| 1066 | name = "rustversion" | ||
| 1067 | version = "1.0.22" | ||
| 1068 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1069 | checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" | ||
| 1070 | |||
| 1071 | [[package]] | ||
| 881 | name = "ryu" | 1072 | name = "ryu" |
| 882 | version = "1.0.20" | 1073 | version = "1.0.20" |
| 883 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1074 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 884 | checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" | 1075 | checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" |
| 885 | 1076 | ||
| 886 | [[package]] | 1077 | [[package]] |
| 1078 | name = "scoped-tls" | ||
| 1079 | version = "1.0.1" | ||
| 1080 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1081 | checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" | ||
| 1082 | |||
| 1083 | [[package]] | ||
| 887 | name = "semver" | 1084 | name = "semver" |
| 888 | version = "0.9.0" | 1085 | version = "0.9.0" |
| 889 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -950,6 +1147,21 @@ dependencies = [ | |||
| 950 | ] | 1147 | ] |
| 951 | 1148 | ||
| 952 | [[package]] | 1149 | [[package]] |
| 1150 | name = "sharded-slab" | ||
| 1151 | version = "0.1.7" | ||
| 1152 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1153 | checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" | ||
| 1154 | dependencies = [ | ||
| 1155 | "lazy_static", | ||
| 1156 | ] | ||
| 1157 | |||
| 1158 | [[package]] | ||
| 1159 | name = "shlex" | ||
| 1160 | version = "1.3.0" | ||
| 1161 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1162 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" | ||
| 1163 | |||
| 1164 | [[package]] | ||
| 953 | name = "smallvec" | 1165 | name = "smallvec" |
| 954 | version = "1.15.1" | 1166 | version = "1.15.1" |
| 955 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1167 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1016,6 +1228,15 @@ dependencies = [ | |||
| 1016 | ] | 1228 | ] |
| 1017 | 1229 | ||
| 1018 | [[package]] | 1230 | [[package]] |
| 1231 | name = "thread_local" | ||
| 1232 | version = "1.1.9" | ||
| 1233 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1234 | checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" | ||
| 1235 | dependencies = [ | ||
| 1236 | "cfg-if", | ||
| 1237 | ] | ||
| 1238 | |||
| 1239 | [[package]] | ||
| 1019 | name = "tmp108" | 1240 | name = "tmp108" |
| 1020 | version = "0.4.0" | 1241 | version = "0.4.0" |
| 1021 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1069,6 +1290,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1069 | checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" | 1290 | checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" |
| 1070 | 1291 | ||
| 1071 | [[package]] | 1292 | [[package]] |
| 1293 | name = "tracing" | ||
| 1294 | version = "0.1.42" | ||
| 1295 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1296 | checksum = "8eb41cbdb933e23b7929f47bb577710643157d7602ef3a2ebd3902b13ac5eda6" | ||
| 1297 | dependencies = [ | ||
| 1298 | "pin-project-lite", | ||
| 1299 | "tracing-attributes", | ||
| 1300 | "tracing-core", | ||
| 1301 | ] | ||
| 1302 | |||
| 1303 | [[package]] | ||
| 1304 | name = "tracing-attributes" | ||
| 1305 | version = "0.1.31" | ||
| 1306 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1307 | checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" | ||
| 1308 | dependencies = [ | ||
| 1309 | "proc-macro2", | ||
| 1310 | "quote", | ||
| 1311 | "syn 2.0.110", | ||
| 1312 | ] | ||
| 1313 | |||
| 1314 | [[package]] | ||
| 1315 | name = "tracing-core" | ||
| 1316 | version = "0.1.35" | ||
| 1317 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1318 | checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" | ||
| 1319 | dependencies = [ | ||
| 1320 | "once_cell", | ||
| 1321 | "valuable", | ||
| 1322 | ] | ||
| 1323 | |||
| 1324 | [[package]] | ||
| 1325 | name = "tracing-log" | ||
| 1326 | version = "0.2.0" | ||
| 1327 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1328 | checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" | ||
| 1329 | dependencies = [ | ||
| 1330 | "log", | ||
| 1331 | "once_cell", | ||
| 1332 | "tracing-core", | ||
| 1333 | ] | ||
| 1334 | |||
| 1335 | [[package]] | ||
| 1336 | name = "tracing-subscriber" | ||
| 1337 | version = "0.3.20" | ||
| 1338 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1339 | checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" | ||
| 1340 | dependencies = [ | ||
| 1341 | "matchers", | ||
| 1342 | "nu-ansi-term", | ||
| 1343 | "once_cell", | ||
| 1344 | "regex-automata", | ||
| 1345 | "sharded-slab", | ||
| 1346 | "smallvec", | ||
| 1347 | "thread_local", | ||
| 1348 | "tracing", | ||
| 1349 | "tracing-core", | ||
| 1350 | "tracing-log", | ||
| 1351 | ] | ||
| 1352 | |||
| 1353 | [[package]] | ||
| 1072 | name = "unicase" | 1354 | name = "unicase" |
| 1073 | version = "2.8.1" | 1355 | version = "2.8.1" |
| 1074 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1356 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1093,6 +1375,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1093 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" | 1375 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" |
| 1094 | 1376 | ||
| 1095 | [[package]] | 1377 | [[package]] |
| 1378 | name = "valuable" | ||
| 1379 | version = "0.1.1" | ||
| 1380 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1381 | checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" | ||
| 1382 | |||
| 1383 | [[package]] | ||
| 1096 | name = "vcell" | 1384 | name = "vcell" |
| 1097 | version = "0.1.3" | 1385 | version = "0.1.3" |
| 1098 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1386 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1114,6 +1402,132 @@ dependencies = [ | |||
| 1114 | ] | 1402 | ] |
| 1115 | 1403 | ||
| 1116 | [[package]] | 1404 | [[package]] |
| 1405 | name = "windows" | ||
| 1406 | version = "0.61.3" | ||
| 1407 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1408 | checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" | ||
| 1409 | dependencies = [ | ||
| 1410 | "windows-collections", | ||
| 1411 | "windows-core", | ||
| 1412 | "windows-future", | ||
| 1413 | "windows-link 0.1.3", | ||
| 1414 | "windows-numerics", | ||
| 1415 | ] | ||
| 1416 | |||
| 1417 | [[package]] | ||
| 1418 | name = "windows-collections" | ||
| 1419 | version = "0.2.0" | ||
| 1420 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1421 | checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" | ||
| 1422 | dependencies = [ | ||
| 1423 | "windows-core", | ||
| 1424 | ] | ||
| 1425 | |||
| 1426 | [[package]] | ||
| 1427 | name = "windows-core" | ||
| 1428 | version = "0.61.2" | ||
| 1429 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1430 | checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" | ||
| 1431 | dependencies = [ | ||
| 1432 | "windows-implement", | ||
| 1433 | "windows-interface", | ||
| 1434 | "windows-link 0.1.3", | ||
| 1435 | "windows-result", | ||
| 1436 | "windows-strings", | ||
| 1437 | ] | ||
| 1438 | |||
| 1439 | [[package]] | ||
| 1440 | name = "windows-future" | ||
| 1441 | version = "0.2.1" | ||
| 1442 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1443 | checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" | ||
| 1444 | dependencies = [ | ||
| 1445 | "windows-core", | ||
| 1446 | "windows-link 0.1.3", | ||
| 1447 | "windows-threading", | ||
| 1448 | ] | ||
| 1449 | |||
| 1450 | [[package]] | ||
| 1451 | name = "windows-implement" | ||
| 1452 | version = "0.60.2" | ||
| 1453 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1454 | checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" | ||
| 1455 | dependencies = [ | ||
| 1456 | "proc-macro2", | ||
| 1457 | "quote", | ||
| 1458 | "syn 2.0.110", | ||
| 1459 | ] | ||
| 1460 | |||
| 1461 | [[package]] | ||
| 1462 | name = "windows-interface" | ||
| 1463 | version = "0.59.3" | ||
| 1464 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1465 | checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" | ||
| 1466 | dependencies = [ | ||
| 1467 | "proc-macro2", | ||
| 1468 | "quote", | ||
| 1469 | "syn 2.0.110", | ||
| 1470 | ] | ||
| 1471 | |||
| 1472 | [[package]] | ||
| 1473 | name = "windows-link" | ||
| 1474 | version = "0.1.3" | ||
| 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1476 | checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" | ||
| 1477 | |||
| 1478 | [[package]] | ||
| 1479 | name = "windows-link" | ||
| 1480 | version = "0.2.1" | ||
| 1481 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1482 | checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" | ||
| 1483 | |||
| 1484 | [[package]] | ||
| 1485 | name = "windows-numerics" | ||
| 1486 | version = "0.2.0" | ||
| 1487 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1488 | checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" | ||
| 1489 | dependencies = [ | ||
| 1490 | "windows-core", | ||
| 1491 | "windows-link 0.1.3", | ||
| 1492 | ] | ||
| 1493 | |||
| 1494 | [[package]] | ||
| 1495 | name = "windows-result" | ||
| 1496 | version = "0.3.4" | ||
| 1497 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1498 | checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" | ||
| 1499 | dependencies = [ | ||
| 1500 | "windows-link 0.1.3", | ||
| 1501 | ] | ||
| 1502 | |||
| 1503 | [[package]] | ||
| 1504 | name = "windows-strings" | ||
| 1505 | version = "0.4.2" | ||
| 1506 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1507 | checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" | ||
| 1508 | dependencies = [ | ||
| 1509 | "windows-link 0.1.3", | ||
| 1510 | ] | ||
| 1511 | |||
| 1512 | [[package]] | ||
| 1513 | name = "windows-sys" | ||
| 1514 | version = "0.61.2" | ||
| 1515 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1516 | checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" | ||
| 1517 | dependencies = [ | ||
| 1518 | "windows-link 0.2.1", | ||
| 1519 | ] | ||
| 1520 | |||
| 1521 | [[package]] | ||
| 1522 | name = "windows-threading" | ||
| 1523 | version = "0.1.0" | ||
| 1524 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1525 | checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" | ||
| 1526 | dependencies = [ | ||
| 1527 | "windows-link 0.1.3", | ||
| 1528 | ] | ||
| 1529 | |||
| 1530 | [[package]] | ||
| 1117 | name = "winnow" | 1531 | name = "winnow" |
| 1118 | version = "0.6.24" | 1532 | version = "0.6.24" |
| 1119 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1533 | source = "registry+https://github.com/rust-lang/crates.io-index" |
diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 1022e91df..a1092c416 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml | |||
| @@ -12,7 +12,7 @@ defmt = "1.0" | |||
| 12 | defmt-rtt = "1.0" | 12 | defmt-rtt = "1.0" |
| 13 | embassy-embedded-hal = "0.5.0" | 13 | embassy-embedded-hal = "0.5.0" |
| 14 | embassy-executor = { version = "0.9.0", features = ["arch-cortex-m", "executor-interrupt", "executor-thread"], default-features = false } | 14 | embassy-executor = { version = "0.9.0", features = ["arch-cortex-m", "executor-interrupt", "executor-thread"], default-features = false } |
| 15 | embassy-mcxa = { path = "../", features = ["defmt", "rt", "unstable-pac", "time"] } | 15 | embassy-mcxa = { path = "../", features = ["defmt", "unstable-pac", "time"] } |
| 16 | embassy-sync = "0.7.2" | 16 | embassy-sync = "0.7.2" |
| 17 | embassy-time = "0.5.0" | 17 | embassy-time = "0.5.0" |
| 18 | embassy-time-driver = "0.2.1" | 18 | embassy-time-driver = "0.2.1" |
diff --git a/examples/src/bin/button_async.rs b/examples/src/bin/button_async.rs new file mode 100644 index 000000000..1ecec2e48 --- /dev/null +++ b/examples/src/bin/button_async.rs | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | use embassy_executor::Spawner; | ||
| 5 | use embassy_time::Timer; | ||
| 6 | use hal::gpio::{DriveStrength, Input, Pull, SlewRate}; | ||
| 7 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | ||
| 8 | |||
| 9 | #[embassy_executor::main] | ||
| 10 | async fn main(_spawner: Spawner) { | ||
| 11 | let p = hal::init(hal::config::Config::default()); | ||
| 12 | |||
| 13 | defmt::info!("GPIO interrupt example"); | ||
| 14 | |||
| 15 | // This button is labeled "WAKEUP" on the FRDM-MCXA276 | ||
| 16 | let mut pin = Input::new(p.P1_7, Pull::Up, DriveStrength::Normal, SlewRate::Fast); | ||
| 17 | |||
| 18 | let mut press_count = 0u32; | ||
| 19 | |||
| 20 | loop { | ||
| 21 | pin.wait_for_falling_edge().await; | ||
| 22 | |||
| 23 | press_count += 1; | ||
| 24 | |||
| 25 | defmt::info!("Button pressed! Count: {}", press_count); | ||
| 26 | Timer::after_millis(50).await; | ||
| 27 | } | ||
| 28 | } | ||
