aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMathisDerooNXP <[email protected]>2025-11-26 10:05:16 -0800
committerGitHub <[email protected]>2025-11-26 10:05:16 -0800
commitd12bc9785399991065e511efbea34f0138c7645e (patch)
tree47472365383c3a5ad5d4ab0495e655a3418477d9 /examples
parent1efaaa4025120413ec17de90106244445208804a (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.lock414
-rw-r--r--examples/Cargo.toml2
-rw-r--r--examples/src/bin/button_async.rs28
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 @@
3version = 4 3version = 4
4 4
5[[package]] 5[[package]]
6name = "aho-corasick"
7version = "1.1.4"
8source = "registry+https://github.com/rust-lang/crates.io-index"
9checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
10dependencies = [
11 "memchr",
12]
13
14[[package]]
6name = "anyhow" 15name = "anyhow"
7version = "1.0.100" 16version = "1.0.100"
8source = "registry+https://github.com/rust-lang/crates.io-index" 17source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -97,6 +106,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
97checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 106checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
98 107
99[[package]] 108[[package]]
109name = "cc"
110version = "1.2.47"
111source = "registry+https://github.com/rust-lang/crates.io-index"
112checksum = "cd405d82c84ff7f35739f175f67d8b9fb7687a0e84ccdc78bd3568839827cf07"
113dependencies = [
114 "find-msvc-tools",
115 "shlex",
116]
117
118[[package]]
100name = "cfg-if" 119name = "cfg-if"
101version = "1.0.4" 120version = "1.0.4"
102source = "registry+https://github.com/rust-lang/crates.io-index" 121source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -112,6 +131,16 @@ dependencies = [
112] 131]
113 132
114[[package]] 133[[package]]
134name = "cordyceps"
135version = "0.3.4"
136source = "registry+https://github.com/rust-lang/crates.io-index"
137checksum = "688d7fbb8092b8de775ef2536f36c8c31f2bc4006ece2e8d8ad2d17d00ce0a2a"
138dependencies = [
139 "loom",
140 "tracing",
141]
142
143[[package]]
115name = "cortex-m" 144name = "cortex-m"
116version = "0.7.7" 145version = "0.7.7"
117source = "registry+https://github.com/rust-lang/crates.io-index" 146source = "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"
513checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" 543checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
514 544
515[[package]] 545[[package]]
546name = "find-msvc-tools"
547version = "0.1.5"
548source = "registry+https://github.com/rust-lang/crates.io-index"
549checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
550
551[[package]]
516name = "fnv" 552name = "fnv"
517version = "1.0.7" 553version = "1.0.7"
518source = "registry+https://github.com/rust-lang/crates.io-index" 554source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -537,6 +573,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
537checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 573checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
538 574
539[[package]] 575[[package]]
576name = "generator"
577version = "0.8.7"
578source = "registry+https://github.com/rust-lang/crates.io-index"
579checksum = "605183a538e3e2a9c1038635cc5c2d194e2ee8fd0d1b66b8349fad7dbacce5a2"
580dependencies = [
581 "cc",
582 "cfg-if",
583 "libc",
584 "log",
585 "rustversion",
586 "windows",
587]
588
589[[package]]
540name = "hash32" 590name = "hash32"
541version = "0.3.1" 591version = "0.3.1"
542source = "registry+https://github.com/rust-lang/crates.io-index" 592source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -614,12 +664,59 @@ dependencies = [
614] 664]
615 665
616[[package]] 666[[package]]
667name = "lazy_static"
668version = "1.5.0"
669source = "registry+https://github.com/rust-lang/crates.io-index"
670checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
671
672[[package]]
673name = "libc"
674version = "0.2.177"
675source = "registry+https://github.com/rust-lang/crates.io-index"
676checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
677
678[[package]]
617name = "litrs" 679name = "litrs"
618version = "1.0.0" 680version = "1.0.0"
619source = "registry+https://github.com/rust-lang/crates.io-index" 681source = "registry+https://github.com/rust-lang/crates.io-index"
620checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" 682checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
621 683
622[[package]] 684[[package]]
685name = "log"
686version = "0.4.28"
687source = "registry+https://github.com/rust-lang/crates.io-index"
688checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
689
690[[package]]
691name = "loom"
692version = "0.7.2"
693source = "registry+https://github.com/rust-lang/crates.io-index"
694checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca"
695dependencies = [
696 "cfg-if",
697 "generator",
698 "scoped-tls",
699 "tracing",
700 "tracing-subscriber",
701]
702
703[[package]]
704name = "maitake-sync"
705version = "0.2.2"
706source = "registry+https://github.com/rust-lang/crates.io-index"
707checksum = "748f86d9befd480b602c3bebc9ef30dbf2f3dfc8acc4a73d07b90f0117e6de3f"
708dependencies = [
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]]
623name = "manyhow" 720name = "manyhow"
624version = "0.11.4" 721version = "0.11.4"
625source = "registry+https://github.com/rust-lang/crates.io-index" 722source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -644,6 +741,15 @@ dependencies = [
644] 741]
645 742
646[[package]] 743[[package]]
744name = "matchers"
745version = "0.2.0"
746source = "registry+https://github.com/rust-lang/crates.io-index"
747checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9"
748dependencies = [
749 "regex-automata",
750]
751
752[[package]]
647name = "maybe-async-cfg" 753name = "maybe-async-cfg"
648version = "0.2.5" 754version = "0.2.5"
649source = "registry+https://github.com/rust-lang/crates.io-index" 755source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -685,6 +791,18 @@ dependencies = [
685] 791]
686 792
687[[package]] 793[[package]]
794name = "mutex-traits"
795version = "1.0.1"
796source = "registry+https://github.com/rust-lang/crates.io-index"
797checksum = "3929f2b5633d29cf7b6624992e5f3c1e9334f1193423e12d17be4faf678cde3f"
798
799[[package]]
800name = "mycelium-bitfield"
801version = "0.1.5"
802source = "registry+https://github.com/rust-lang/crates.io-index"
803checksum = "24e0cc5e2c585acbd15c5ce911dff71e1f4d5313f43345873311c4f5efd741cc"
804
805[[package]]
688name = "nb" 806name = "nb"
689version = "0.1.3" 807version = "0.1.3"
690source = "registry+https://github.com/rust-lang/crates.io-index" 808source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -700,6 +818,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
700checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 818checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
701 819
702[[package]] 820[[package]]
821name = "nu-ansi-term"
822version = "0.50.3"
823source = "registry+https://github.com/rust-lang/crates.io-index"
824checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
825dependencies = [
826 "windows-sys",
827]
828
829[[package]]
703name = "num" 830name = "num"
704version = "0.4.3" 831version = "0.4.3"
705source = "registry+https://github.com/rust-lang/crates.io-index" 832source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -773,6 +900,12 @@ dependencies = [
773] 900]
774 901
775[[package]] 902[[package]]
903name = "once_cell"
904version = "1.21.3"
905source = "registry+https://github.com/rust-lang/crates.io-index"
906checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
907
908[[package]]
776name = "panic-probe" 909name = "panic-probe"
777version = "1.0.0" 910version = "1.0.0"
778source = "registry+https://github.com/rust-lang/crates.io-index" 911source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -795,6 +928,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
795checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" 928checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
796 929
797[[package]] 930[[package]]
931name = "pin-project"
932version = "1.1.10"
933source = "registry+https://github.com/rust-lang/crates.io-index"
934checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
935dependencies = [
936 "pin-project-internal",
937]
938
939[[package]]
940name = "pin-project-internal"
941version = "1.1.10"
942source = "registry+https://github.com/rust-lang/crates.io-index"
943checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
944dependencies = [
945 "proc-macro2",
946 "quote",
947 "syn 2.0.110",
948]
949
950[[package]]
951name = "pin-project-lite"
952version = "0.2.16"
953source = "registry+https://github.com/rust-lang/crates.io-index"
954checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
955
956[[package]]
957name = "portable-atomic"
958version = "1.11.1"
959source = "registry+https://github.com/rust-lang/crates.io-index"
960checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
961dependencies = [
962 "critical-section",
963]
964
965[[package]]
798name = "proc-macro-error-attr2" 966name = "proc-macro-error-attr2"
799version = "2.0.0" 967version = "2.0.0"
800source = "registry+https://github.com/rust-lang/crates.io-index" 968source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -863,6 +1031,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
863checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" 1031checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
864 1032
865[[package]] 1033[[package]]
1034name = "regex-automata"
1035version = "0.4.13"
1036source = "registry+https://github.com/rust-lang/crates.io-index"
1037checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
1038dependencies = [
1039 "aho-corasick",
1040 "memchr",
1041 "regex-syntax",
1042]
1043
1044[[package]]
1045name = "regex-syntax"
1046version = "0.8.8"
1047source = "registry+https://github.com/rust-lang/crates.io-index"
1048checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
1049
1050[[package]]
866name = "rustc-hash" 1051name = "rustc-hash"
867version = "2.1.1" 1052version = "2.1.1"
868source = "registry+https://github.com/rust-lang/crates.io-index" 1053source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -878,12 +1063,24 @@ dependencies = [
878] 1063]
879 1064
880[[package]] 1065[[package]]
1066name = "rustversion"
1067version = "1.0.22"
1068source = "registry+https://github.com/rust-lang/crates.io-index"
1069checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
1070
1071[[package]]
881name = "ryu" 1072name = "ryu"
882version = "1.0.20" 1073version = "1.0.20"
883source = "registry+https://github.com/rust-lang/crates.io-index" 1074source = "registry+https://github.com/rust-lang/crates.io-index"
884checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" 1075checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
885 1076
886[[package]] 1077[[package]]
1078name = "scoped-tls"
1079version = "1.0.1"
1080source = "registry+https://github.com/rust-lang/crates.io-index"
1081checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"
1082
1083[[package]]
887name = "semver" 1084name = "semver"
888version = "0.9.0" 1085version = "0.9.0"
889source = "registry+https://github.com/rust-lang/crates.io-index" 1086source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -950,6 +1147,21 @@ dependencies = [
950] 1147]
951 1148
952[[package]] 1149[[package]]
1150name = "sharded-slab"
1151version = "0.1.7"
1152source = "registry+https://github.com/rust-lang/crates.io-index"
1153checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
1154dependencies = [
1155 "lazy_static",
1156]
1157
1158[[package]]
1159name = "shlex"
1160version = "1.3.0"
1161source = "registry+https://github.com/rust-lang/crates.io-index"
1162checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
1163
1164[[package]]
953name = "smallvec" 1165name = "smallvec"
954version = "1.15.1" 1166version = "1.15.1"
955source = "registry+https://github.com/rust-lang/crates.io-index" 1167source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1016,6 +1228,15 @@ dependencies = [
1016] 1228]
1017 1229
1018[[package]] 1230[[package]]
1231name = "thread_local"
1232version = "1.1.9"
1233source = "registry+https://github.com/rust-lang/crates.io-index"
1234checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
1235dependencies = [
1236 "cfg-if",
1237]
1238
1239[[package]]
1019name = "tmp108" 1240name = "tmp108"
1020version = "0.4.0" 1241version = "0.4.0"
1021source = "registry+https://github.com/rust-lang/crates.io-index" 1242source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1069,6 +1290,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1069checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" 1290checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
1070 1291
1071[[package]] 1292[[package]]
1293name = "tracing"
1294version = "0.1.42"
1295source = "registry+https://github.com/rust-lang/crates.io-index"
1296checksum = "8eb41cbdb933e23b7929f47bb577710643157d7602ef3a2ebd3902b13ac5eda6"
1297dependencies = [
1298 "pin-project-lite",
1299 "tracing-attributes",
1300 "tracing-core",
1301]
1302
1303[[package]]
1304name = "tracing-attributes"
1305version = "0.1.31"
1306source = "registry+https://github.com/rust-lang/crates.io-index"
1307checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
1308dependencies = [
1309 "proc-macro2",
1310 "quote",
1311 "syn 2.0.110",
1312]
1313
1314[[package]]
1315name = "tracing-core"
1316version = "0.1.35"
1317source = "registry+https://github.com/rust-lang/crates.io-index"
1318checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
1319dependencies = [
1320 "once_cell",
1321 "valuable",
1322]
1323
1324[[package]]
1325name = "tracing-log"
1326version = "0.2.0"
1327source = "registry+https://github.com/rust-lang/crates.io-index"
1328checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
1329dependencies = [
1330 "log",
1331 "once_cell",
1332 "tracing-core",
1333]
1334
1335[[package]]
1336name = "tracing-subscriber"
1337version = "0.3.20"
1338source = "registry+https://github.com/rust-lang/crates.io-index"
1339checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
1340dependencies = [
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]]
1072name = "unicase" 1354name = "unicase"
1073version = "2.8.1" 1355version = "2.8.1"
1074source = "registry+https://github.com/rust-lang/crates.io-index" 1356source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1093,6 +1375,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1093checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 1375checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
1094 1376
1095[[package]] 1377[[package]]
1378name = "valuable"
1379version = "0.1.1"
1380source = "registry+https://github.com/rust-lang/crates.io-index"
1381checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
1382
1383[[package]]
1096name = "vcell" 1384name = "vcell"
1097version = "0.1.3" 1385version = "0.1.3"
1098source = "registry+https://github.com/rust-lang/crates.io-index" 1386source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1114,6 +1402,132 @@ dependencies = [
1114] 1402]
1115 1403
1116[[package]] 1404[[package]]
1405name = "windows"
1406version = "0.61.3"
1407source = "registry+https://github.com/rust-lang/crates.io-index"
1408checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
1409dependencies = [
1410 "windows-collections",
1411 "windows-core",
1412 "windows-future",
1413 "windows-link 0.1.3",
1414 "windows-numerics",
1415]
1416
1417[[package]]
1418name = "windows-collections"
1419version = "0.2.0"
1420source = "registry+https://github.com/rust-lang/crates.io-index"
1421checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
1422dependencies = [
1423 "windows-core",
1424]
1425
1426[[package]]
1427name = "windows-core"
1428version = "0.61.2"
1429source = "registry+https://github.com/rust-lang/crates.io-index"
1430checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
1431dependencies = [
1432 "windows-implement",
1433 "windows-interface",
1434 "windows-link 0.1.3",
1435 "windows-result",
1436 "windows-strings",
1437]
1438
1439[[package]]
1440name = "windows-future"
1441version = "0.2.1"
1442source = "registry+https://github.com/rust-lang/crates.io-index"
1443checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
1444dependencies = [
1445 "windows-core",
1446 "windows-link 0.1.3",
1447 "windows-threading",
1448]
1449
1450[[package]]
1451name = "windows-implement"
1452version = "0.60.2"
1453source = "registry+https://github.com/rust-lang/crates.io-index"
1454checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
1455dependencies = [
1456 "proc-macro2",
1457 "quote",
1458 "syn 2.0.110",
1459]
1460
1461[[package]]
1462name = "windows-interface"
1463version = "0.59.3"
1464source = "registry+https://github.com/rust-lang/crates.io-index"
1465checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
1466dependencies = [
1467 "proc-macro2",
1468 "quote",
1469 "syn 2.0.110",
1470]
1471
1472[[package]]
1473name = "windows-link"
1474version = "0.1.3"
1475source = "registry+https://github.com/rust-lang/crates.io-index"
1476checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
1477
1478[[package]]
1479name = "windows-link"
1480version = "0.2.1"
1481source = "registry+https://github.com/rust-lang/crates.io-index"
1482checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
1483
1484[[package]]
1485name = "windows-numerics"
1486version = "0.2.0"
1487source = "registry+https://github.com/rust-lang/crates.io-index"
1488checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
1489dependencies = [
1490 "windows-core",
1491 "windows-link 0.1.3",
1492]
1493
1494[[package]]
1495name = "windows-result"
1496version = "0.3.4"
1497source = "registry+https://github.com/rust-lang/crates.io-index"
1498checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
1499dependencies = [
1500 "windows-link 0.1.3",
1501]
1502
1503[[package]]
1504name = "windows-strings"
1505version = "0.4.2"
1506source = "registry+https://github.com/rust-lang/crates.io-index"
1507checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
1508dependencies = [
1509 "windows-link 0.1.3",
1510]
1511
1512[[package]]
1513name = "windows-sys"
1514version = "0.61.2"
1515source = "registry+https://github.com/rust-lang/crates.io-index"
1516checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
1517dependencies = [
1518 "windows-link 0.2.1",
1519]
1520
1521[[package]]
1522name = "windows-threading"
1523version = "0.1.0"
1524source = "registry+https://github.com/rust-lang/crates.io-index"
1525checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
1526dependencies = [
1527 "windows-link 0.1.3",
1528]
1529
1530[[package]]
1117name = "winnow" 1531name = "winnow"
1118version = "0.6.24" 1532version = "0.6.24"
1119source = "registry+https://github.com/rust-lang/crates.io-index" 1533source = "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"
12defmt-rtt = "1.0" 12defmt-rtt = "1.0"
13embassy-embedded-hal = "0.5.0" 13embassy-embedded-hal = "0.5.0"
14embassy-executor = { version = "0.9.0", features = ["arch-cortex-m", "executor-interrupt", "executor-thread"], default-features = false } 14embassy-executor = { version = "0.9.0", features = ["arch-cortex-m", "executor-interrupt", "executor-thread"], default-features = false }
15embassy-mcxa = { path = "../", features = ["defmt", "rt", "unstable-pac", "time"] } 15embassy-mcxa = { path = "../", features = ["defmt", "unstable-pac", "time"] }
16embassy-sync = "0.7.2" 16embassy-sync = "0.7.2"
17embassy-time = "0.5.0" 17embassy-time = "0.5.0"
18embassy-time-driver = "0.2.1" 18embassy-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
4use embassy_executor::Spawner;
5use embassy_time::Timer;
6use hal::gpio::{DriveStrength, Input, Pull, SlewRate};
7use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _};
8
9#[embassy_executor::main]
10async 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}