-
-
Save Crest/4661650057935952013dc092573c7f46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 variable swd | |
swd constant swd-rx | |
swd 1 + constant swd-/rts | |
swd 2 + constant swd-tx | |
swd 3 + constant swd-cts | |
: swd. ( -- ) swd @ hex. ; | |
: swd-key? ( -- flag ) swd-/rts c@ 0<> ; | |
: swd-key ( -- char ) begin swd-key? until swd-rx c@ 0 swd-/rts c! ; | |
: swd-emit? ( -- flag ) swd-cts c@ 0= ; | |
: swd-emit ( char -- ) begin swd-emit? until swd-tx c! $ff swd-cts c! ; | |
: swd-init ( -- ) | |
['] swd-key? hook-key? ! | |
['] swd-key hook-key ! | |
['] swd-emit? hook-emit? ! | |
['] swd-emit hook-emit ! ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment