Compare commits
5 Commits
91ef67ef37
...
5418c1b232
| Author | SHA1 | Date | |
|---|---|---|---|
|
5418c1b232
|
|||
|
684dbbd882
|
|||
|
ecd2d92b52
|
|||
|
8e00a9b341
|
|||
|
ae39713e0b
|
571
Cargo.lock
generated
571
Cargo.lock
generated
@ -1,418 +1,563 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "aligned"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aligned"
|
||||
version = "0.3.1"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c19796bd8d477f1a9d4ac2465b464a8b1359474f06a96bb3cda650b4fca309bf"
|
||||
dependencies = [
|
||||
"as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"as-slice",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "apa102-spi"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d92cd690fd2aae5bc549e2dc392d9082aab3ccf851aa39b0ab84b2934f4c57a3"
|
||||
dependencies = [
|
||||
"embedded-hal",
|
||||
"smart-leds-trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "as-slice"
|
||||
version = "0.1.0"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0"
|
||||
dependencies = [
|
||||
"generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"generic-array 0.12.4",
|
||||
"generic-array 0.13.3",
|
||||
"generic-array 0.14.4",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atsamd-hal"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/atsamd-rs/atsamd#d1872cf259bbaf5ec65a477ac2d6b93eb5afbd7a"
|
||||
version = "0.12.0"
|
||||
source = "git+https://github.com/atsamd-rs/atsamd#db1f9b70d351ff73546b012e23b48115e6dfed6c"
|
||||
dependencies = [
|
||||
"atsamd21g18a 0.4.0 (git+https://github.com/atsamd-rs/atsamd)",
|
||||
"bitfield 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-hal 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atsamd21g",
|
||||
"bitfield",
|
||||
"bitflags",
|
||||
"cortex-m",
|
||||
"embedded-hal",
|
||||
"modular-bitfield",
|
||||
"nb 0.1.3",
|
||||
"num-traits",
|
||||
"paste",
|
||||
"rand_core",
|
||||
"seq-macro",
|
||||
"typenum",
|
||||
"usb-device",
|
||||
"vcell",
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atsamd21g18a"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/atsamd-rs/atsamd#d1872cf259bbaf5ec65a477ac2d6b93eb5afbd7a"
|
||||
name = "atsamd21g"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/atsamd-rs/atsamd#db1f9b70d351ff73546b012e23b48115e6dfed6c"
|
||||
dependencies = [
|
||||
"bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bare-metal",
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"vcell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
|
||||
[[package]]
|
||||
name = "bare-metal"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
|
||||
dependencies = [
|
||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitbang-hal"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "470e1522d257e4c76245980d27d5d279442cb18955cc6341249b904074033f4a"
|
||||
dependencies = [
|
||||
"embedded-hal",
|
||||
"nb 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitfield"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bed57e2090563b83ba8f83366628ce535a7584c9afa4c9fc0612a03925c6df58"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
||||
|
||||
[[package]]
|
||||
name = "cortex-m"
|
||||
version = "0.5.10"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88cdafeafba636c00c467ded7f1587210725a1adfab0c24028a7844b87738263"
|
||||
dependencies = [
|
||||
"aligned 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cortex-m"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aligned 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"aligned",
|
||||
"bare-metal",
|
||||
"bitfield",
|
||||
"volatile-register",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cortex-m-rt"
|
||||
version = "0.6.10"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "980c9d0233a909f355ed297ef122f257942de5e0a2cb1c39f60684b65bcb90fb"
|
||||
dependencies = [
|
||||
"cortex-m-rt-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m-rt-macros",
|
||||
"r0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cortex-m-rt-macros"
|
||||
version = "0.1.5"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4717562afbba06e760d34451919f5c3bf3ac15c7bb897e8b04862a7428378647"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-graphics"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2e7ee289ac88cbeea6f749cd72c6eb4cdeb801f4ea26795aace97b9776a2db2"
|
||||
dependencies = [
|
||||
"tinybmp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tinytga 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tinybmp",
|
||||
"tinytga",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-hal"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee4908a155094da7723c2d60d617b820061e3b4efcc3d9e293d206a5a76c170b"
|
||||
dependencies = [
|
||||
"nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nb 0.1.3",
|
||||
"void",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.12.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.12.3"
|
||||
version = "0.13.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309"
|
||||
dependencies = [
|
||||
"typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itsybitsy_m0"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/atsamd-rs/atsamd#d1872cf259bbaf5ec65a477ac2d6b93eb5afbd7a"
|
||||
version = "0.10.0"
|
||||
source = "git+https://github.com/atsamd-rs/atsamd#db1f9b70d351ff73546b012e23b48115e6dfed6c"
|
||||
dependencies = [
|
||||
"atsamd-hal 0.5.0 (git+https://github.com/atsamd-rs/atsamd)",
|
||||
"cortex-m 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-hal 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"apa102-spi",
|
||||
"atsamd-hal",
|
||||
"bitbang-hal",
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"embedded-hal",
|
||||
"nb 0.1.3",
|
||||
"smart-leds",
|
||||
"usb-device",
|
||||
"usbd-hid",
|
||||
"usbd-serial",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.2.1"
|
||||
version = "2.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||
|
||||
[[package]]
|
||||
name = "modular-bitfield"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74"
|
||||
dependencies = [
|
||||
"modular-bitfield-impl",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "modular-bitfield-impl"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nb"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
|
||||
dependencies = [
|
||||
"nb 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nb"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
|
||||
|
||||
[[package]]
|
||||
name = "neowatch"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"atsamd-hal 0.5.0 (git+https://github.com/atsamd-rs/atsamd)",
|
||||
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-graphics 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-hal 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itsybitsy_m0 0.3.0 (git+https://github.com/atsamd-rs/atsamd)",
|
||||
"nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ssd1306 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atsamd-hal",
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"embedded-graphics",
|
||||
"embedded-hal",
|
||||
"itsybitsy_m0",
|
||||
"nb 0.1.3",
|
||||
"ssd1351",
|
||||
"usb-device",
|
||||
"usbd-serial",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "4.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
|
||||
dependencies = [
|
||||
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr",
|
||||
"version_check 0.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "5.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"version_check 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "0.1.6"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste-impl"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.30"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r0"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
checksum = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.3.1"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.4.2"
|
||||
name = "rgb"
|
||||
version = "0.8.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fddb3b23626145d1776addfc307e1a1851f60ef6ca64f376bcb889697144cf0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
dependencies = [
|
||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
dependencies = [
|
||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "ssd1306"
|
||||
version = "0.2.6"
|
||||
name = "seq-macro"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d5b3bd665f328d73d7079123bfbd14a6edd74187667b5c6f340adfc65ea9d25a"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.125"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
|
||||
|
||||
[[package]]
|
||||
name = "smart-leds"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38dd45fa275f70b4110eac5f5182611ad384f88bb22b68b9a9c3cafd7015290b"
|
||||
dependencies = [
|
||||
"embedded-graphics 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"embedded-hal 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smart-leds-trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smart-leds-trait"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebf6d833fa93f16a1c1874e62c2aebe8567e5bdd436d59bf543ed258b6f7a8e3"
|
||||
dependencies = [
|
||||
"rgb",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ssd1351"
|
||||
version = "0.3.0"
|
||||
dependencies = [
|
||||
"embedded-graphics",
|
||||
"embedded-hal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ssmarshal"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.44"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinybmp"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30d12b7f8b271567d6d072c49dee16b22271aabfc473e2066e3353e5af0f5230"
|
||||
dependencies = [
|
||||
"nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nom 5.1.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinytga"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc9485052c1f4b541d888f1d564dd9957671e0c21da9bca0c9824c1123e03f07"
|
||||
dependencies = [
|
||||
"nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nom 4.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.10.0"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
name = "usb-device"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6be90410d4772074ea49525e2e753b65920b94b57eee21a6ef7b6a6fe6296245"
|
||||
|
||||
[[package]]
|
||||
name = "usbd-hid"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3404cbb66a4d6a092d8e88c3e62dcc6f339536e2cf66dfedad342eb0013c7cd"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"ssmarshal",
|
||||
"usb-device",
|
||||
"usbd-hid-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "usbd-hid-descriptors"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e00430c0b39caf3957aba6c2b2824f8e70e1ac0278941418bf1fe35f9566d64"
|
||||
dependencies = [
|
||||
"bitfield",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "usbd-hid-macros"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "673a04e28e2949d0b8d3307996a37330a297d863b6ec1e8904552ca2051c1a7e"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"syn",
|
||||
"usbd-hid-descriptors",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "usbd-serial"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe"
|
||||
dependencies = [
|
||||
"embedded-hal",
|
||||
"nb 0.1.3",
|
||||
"usb-device",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vcell"
|
||||
version = "0.1.0"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
|
||||
[[package]]
|
||||
name = "volatile-register"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286"
|
||||
dependencies = [
|
||||
"vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vcell",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum aligned 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d39da9b88ae1a81c03c9c082b8db83f1d0e93914126041962af61034ab44c4a5"
|
||||
"checksum aligned 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a316c7ea8e1e9ece54862c992def5a7ac14de9f5832b69d71760680efeeefa"
|
||||
"checksum as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "293dac66b274fab06f95e7efb05ec439a6b70136081ea522d270bc351ae5bb27"
|
||||
"checksum atsamd-hal 0.5.0 (git+https://github.com/atsamd-rs/atsamd)" = "<none>"
|
||||
"checksum atsamd21g18a 0.4.0 (git+https://github.com/atsamd-rs/atsamd)" = "<none>"
|
||||
"checksum bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a3caf393d93b2d453e80638d0674597020cef3382ada454faacd43d1a55a735a"
|
||||
"checksum bitfield 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
|
||||
"checksum cortex-m 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0b159a1e8306949579de3698c841dba58058197b65c60807194e4fa1e7a554"
|
||||
"checksum cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3c18719fdc57db65668bfc977db9a0fa1a41d718c5d9cd4f652c9d4b0e0956a"
|
||||
"checksum cortex-m-rt 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17805910e3ecf029bdbfcc42b7384d9e3d9e5626153fa810002c1ef9839338ac"
|
||||
"checksum cortex-m-rt-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d7ae692573e0acccb1579fef1abf5a5bf1d2f3f0149a22b16870ec9309aee25f"
|
||||
"checksum embedded-graphics 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b2e7ee289ac88cbeea6f749cd72c6eb4cdeb801f4ea26795aace97b9776a2db2"
|
||||
"checksum embedded-hal 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ee4908a155094da7723c2d60d617b820061e3b4efcc3d9e293d206a5a76c170b"
|
||||
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
|
||||
"checksum itsybitsy_m0 0.3.0 (git+https://github.com/atsamd-rs/atsamd)" = "<none>"
|
||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
|
||||
"checksum nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b1411551beb3c11dedfb0a90a0fa256b47d28b9ec2cdff34c25a2fa59e45dbdc"
|
||||
"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
|
||||
"checksum paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "423a519e1c6e828f1e73b720f9d9ed2fa643dce8a7737fb43235ce0b41eeaa49"
|
||||
"checksum paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4214c9e912ef61bf42b81ba9a47e8aad1b2ffaf739ab162bf96d1e011f54e6c5"
|
||||
"checksum proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e688f31d92ffd7c1ddc57a1b4e6d773c0f2a14ee437a4b0a4f5a69c80eb221c8"
|
||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802"
|
||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||
"checksum quote 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49d77c41ca8767f2f41394c11a4eebccab83da25e7cc035387a3125f02be90a3"
|
||||
"checksum r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f"
|
||||
"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
|
||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum ssd1306 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "57d818022001ebca8cec28b230700660a3f6a027123c8193c5e76e9764d087f3"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||
"checksum syn 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae5cd13590144ea968ba5d5520da7a4c08415861014399b5b349f74591c375f"
|
||||
"checksum tinybmp 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "503e3fde7e36b1aa2345af8a3af0086c9b01d9db07b24f3fb0aab07316b9fa10"
|
||||
"checksum tinytga 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc9485052c1f4b541d888f1d564dd9957671e0c21da9bca0c9824c1123e03f07"
|
||||
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
"checksum vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45c297f0afb6928cd08ab1ff9d95e99392595ea25ae1b5ecf822ff8764e57a0d"
|
||||
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286"
|
||||
|
||||
21
Cargo.toml
21
Cargo.toml
@ -17,24 +17,33 @@ lto = false
|
||||
cortex-m = "~0.6"
|
||||
cortex-m-rt = "~0.6"
|
||||
nb = "~0.1"
|
||||
ssd1306 = "~0.2"
|
||||
#ssd1351 = "~0.2"
|
||||
embedded-graphics = "^0.4.0"
|
||||
embedded-hal = "=0.2.3"
|
||||
usb-device = "0.2"
|
||||
usbd-serial = "0.1"
|
||||
|
||||
[dependencies.ssd1351]
|
||||
version = "0.3"
|
||||
#git = "https://github.com/MabezDev/ssd1351"
|
||||
#branch = "crude-ehal-digital-v2-support"
|
||||
path = "../ssd1351"
|
||||
|
||||
[dependencies.itsybitsy_m0]
|
||||
version = "~0.3"
|
||||
version = "~0.10"
|
||||
git = "https://github.com/atsamd-rs/atsamd"
|
||||
features = [
|
||||
"rt",
|
||||
"unproven",
|
||||
"usb",
|
||||
]
|
||||
|
||||
[dependencies.atsamd-hal]
|
||||
version = "~0.5"
|
||||
version = "~0.12"
|
||||
git = "https://github.com/atsamd-rs/atsamd"
|
||||
features = [
|
||||
"samd21g18a",
|
||||
"samd21g18a-rt",
|
||||
"atsamd21g",
|
||||
"samd21g",
|
||||
"samd21g-rt",
|
||||
"unproven",
|
||||
]
|
||||
|
||||
|
||||
@ -1,23 +1,38 @@
|
||||
[tasks.build]
|
||||
description = "Build the executable"
|
||||
command = "cargo"
|
||||
args = ["build"]
|
||||
args = ["build", "--release"]
|
||||
|
||||
[tasks.objcopy]
|
||||
description = "Transform the binary for upload"
|
||||
command = "arm-none-eabi-objcopy"
|
||||
args = [
|
||||
"-O", "binary",
|
||||
"target/thumbv6m-none-eabi/debug/neowatch",
|
||||
"target/thumbv6m-none-eabi/debug/neowatch.bin",
|
||||
"target/thumbv6m-none-eabi/release/neowatch",
|
||||
"target/thumbv6m-none-eabi/release/neowatch.bin",
|
||||
]
|
||||
dependencies = ["build"]
|
||||
|
||||
[tasks.wait_for_tty]
|
||||
description = "Wait for serial port to be available for upload"
|
||||
script = [
|
||||
'''
|
||||
#!/bin/sh
|
||||
while :; do
|
||||
if touch /dev/ttyACM0; then
|
||||
break
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
'''
|
||||
]
|
||||
|
||||
[tasks.set_tty]
|
||||
command = "stty"
|
||||
args = [
|
||||
"-F", "/dev/ttyACM0",
|
||||
"ospeed", "1200",
|
||||
]
|
||||
[tasks.test]
|
||||
disabled = true
|
||||
|
||||
[tasks.upload]
|
||||
description = "Upload the program to the device"
|
||||
command = "bossac"
|
||||
args = [
|
||||
"--info",
|
||||
@ -27,15 +42,8 @@ args = [
|
||||
"--erase",
|
||||
"--write",
|
||||
"--verify",
|
||||
"target/thumbv6m-none-eabi/debug/neowatch.bin",
|
||||
"target/thumbv6m-none-eabi/release/neowatch.bin",
|
||||
"--reset",
|
||||
]
|
||||
dependencies = ["build"]
|
||||
#dependencies = ["set_tty", "build"]
|
||||
|
||||
[tasks.test]
|
||||
disabled = true
|
||||
|
||||
[tasks.default]
|
||||
dependencies = ["upload"]
|
||||
dependencies = ["objcopy", "wait_for_tty"]
|
||||
|
||||
|
||||
64
src/bl_demo.rs
Normal file
64
src/bl_demo.rs
Normal file
@ -0,0 +1,64 @@
|
||||
use crate::rn4020::{BaudRate, RN4020};
|
||||
use hal::{
|
||||
clock::GenericClockController,
|
||||
delay::Delay,
|
||||
//digital::v1::OutputPin,
|
||||
gpio::{Pa10, Pa11, PfC},
|
||||
pac::{CorePeripherals, Peripherals},
|
||||
prelude::*,
|
||||
sercom::{PadPin, Sercom0Pad2, Sercom0Pad3},
|
||||
};
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn demo() -> ! {
|
||||
let mut peripherals = Peripherals::take().unwrap();
|
||||
let core = CorePeripherals::take().unwrap();
|
||||
let mut clocks = GenericClockController::with_internal_32kosc(
|
||||
peripherals.GCLK,
|
||||
&mut peripherals.PM,
|
||||
&mut peripherals.SYSCTRL,
|
||||
&mut peripherals.NVMCTRL,
|
||||
);
|
||||
let mut pins = hal::Pins::new(peripherals.PORT);
|
||||
|
||||
let mut delay = Delay::new(core.SYST, &mut clocks);
|
||||
|
||||
let mut red_led = pins.d13.into_open_drain_output(&mut pins.port);
|
||||
|
||||
let button_in = pins.d12.into_pull_up_input(&mut pins.port);
|
||||
let mut button_last: bool = false;
|
||||
|
||||
let glck0 = clocks.gclk0();
|
||||
let bl_baud_rate = BaudRate::BR115200;
|
||||
let mut bluetooth: RN4020<Sercom0Pad3<Pa11<PfC>>, Sercom0Pad2<Pa10<PfC>>> = RN4020::new(
|
||||
&clocks.sercom0_core(&glck0).unwrap(),
|
||||
bl_baud_rate,
|
||||
peripherals.SERCOM0,
|
||||
&mut peripherals.PM,
|
||||
(
|
||||
pins.d0.into_pad(&mut pins.port),
|
||||
pins.d1.into_pad(&mut pins.port),
|
||||
),
|
||||
);
|
||||
|
||||
loop {
|
||||
//match uart.read() {
|
||||
// Ok(word) => uart.write(word).unwrap(),
|
||||
// Err(nb::Error::WouldBlock) => {}
|
||||
// Err(_) => panic!("Something went wrong when reading from UART"),
|
||||
//}
|
||||
|
||||
let button = button_in.is_low().unwrap();
|
||||
|
||||
if button && !button_last {
|
||||
red_led.set_high().unwrap();
|
||||
|
||||
bluetooth.set_serialized_name("MyDude123").unwrap();
|
||||
|
||||
delay.delay_ms(200u8);
|
||||
red_led.set_low().unwrap();
|
||||
}
|
||||
|
||||
button_last = button;
|
||||
}
|
||||
}
|
||||
114
src/display_demo.rs
Normal file
114
src/display_demo.rs
Normal file
@ -0,0 +1,114 @@
|
||||
use hal::clock::GenericClockController;
|
||||
use hal::delay::Delay;
|
||||
use hal::pac::{CorePeripherals, Peripherals};
|
||||
use hal::prelude::*;
|
||||
use hal::time::MegaHertz;
|
||||
|
||||
//use embedded_graphics::pixelcolor::BinaryColor;
|
||||
use embedded_graphics::pixelcolor::PixelColorU16;
|
||||
use embedded_graphics::prelude::*;
|
||||
use embedded_graphics::primitives::{Circle, Line, Rect};
|
||||
use embedded_graphics::style::Style;
|
||||
use ssd1351::{
|
||||
builder::Builder,
|
||||
//ininterface::spi::SpiInterface,
|
||||
//display::Display,
|
||||
mode::GraphicsMode,
|
||||
properties::{DisplayRotation, DisplaySize},
|
||||
};
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn demo() -> ! {
|
||||
let mut peripherals = Peripherals::take().unwrap();
|
||||
let core = CorePeripherals::take().unwrap();
|
||||
let mut clocks = GenericClockController::with_internal_32kosc(
|
||||
peripherals.GCLK,
|
||||
&mut peripherals.PM,
|
||||
&mut peripherals.SYSCTRL,
|
||||
&mut peripherals.NVMCTRL,
|
||||
);
|
||||
let mut pins = hal::Pins::new(peripherals.PORT);
|
||||
let mut red_led = pins.d13.into_open_drain_output(&mut pins.port);
|
||||
let mut delay = Delay::new(core.SYST, &mut clocks);
|
||||
|
||||
let spi = hal::spi_master(
|
||||
&mut clocks,
|
||||
MegaHertz(12),
|
||||
peripherals.SERCOM4,
|
||||
&mut peripherals.PM,
|
||||
pins.sck,
|
||||
pins.mosi,
|
||||
pins.miso,
|
||||
&mut pins.port,
|
||||
);
|
||||
|
||||
let dc = pins.d9.into_open_drain_output(&mut pins.port);
|
||||
let mut rst = pins.d7.into_open_drain_output(&mut pins.port);
|
||||
|
||||
//let interface = SpiInterface::new(spi, dc);
|
||||
//let display = Display::new(interface, DisplaySize::Display128x128, DisplayRotation::Rotate0);
|
||||
//display.set_draw_area((0, 0), (128, 96));
|
||||
|
||||
// NOTE the `DisplaySize` enum comes from the ssd1351 package,
|
||||
// and currently only supports certain display sizes; see
|
||||
// https://jamwaffles.github.io/ssd1306/master/ssd1306/prelude/enum.DisplaySize.html
|
||||
let mut disp: GraphicsMode<_> = Builder::new()
|
||||
.with_size(DisplaySize::Display128x96)
|
||||
.with_rotation(DisplayRotation::Rotate0)
|
||||
.connect_spi(spi, dc)
|
||||
.into();
|
||||
|
||||
loop {
|
||||
disp.reset(&mut rst, &mut delay).unwrap();
|
||||
disp.init().unwrap();
|
||||
//disp.flush().unwrap();
|
||||
|
||||
let style = Style {
|
||||
stroke_width: 10,
|
||||
fill_color: Some(PixelColorU16(100)),
|
||||
stroke_color: Some(PixelColorU16(50000)),
|
||||
};
|
||||
|
||||
disp.draw(
|
||||
Line::new(Coord::new(8, 16 + 16), Coord::new(8 + 8, 16))
|
||||
.with_style(style)
|
||||
.into_iter(),
|
||||
);
|
||||
|
||||
disp.draw(
|
||||
Line::new(Coord::new(8, 16 + 16), Coord::new(8 + 16, 16 + 16))
|
||||
.with_style(style)
|
||||
.into_iter(),
|
||||
);
|
||||
|
||||
disp.draw(
|
||||
Line::new(Coord::new(8 + 16, 16 + 16), Coord::new(8 + 8, 16))
|
||||
.with_style(style)
|
||||
.into_iter(),
|
||||
);
|
||||
|
||||
disp.draw(
|
||||
Rect::new(Coord::new(48, 16), Coord::new(48 + 16, 16 + 16))
|
||||
.with_style(style)
|
||||
.into_iter(),
|
||||
);
|
||||
|
||||
disp.draw(
|
||||
Circle::new(Coord::new(96, 16 + 8), 8)
|
||||
.with_style(style)
|
||||
.into_iter(),
|
||||
);
|
||||
|
||||
//disp.flush().unwrap();
|
||||
|
||||
//loop {
|
||||
delay.delay_ms(200u8);
|
||||
red_led.set_high().unwrap();
|
||||
delay.delay_ms(50u8);
|
||||
red_led.set_low().unwrap();
|
||||
delay.delay_ms(200u8);
|
||||
red_led.set_high().unwrap();
|
||||
delay.delay_ms(200u8);
|
||||
red_led.set_low().unwrap();
|
||||
}
|
||||
}
|
||||
144
src/main.rs
144
src/main.rs
@ -4,21 +4,27 @@
|
||||
extern crate itsybitsy_m0 as hal;
|
||||
|
||||
mod panic;
|
||||
pub mod rn4020;
|
||||
|
||||
//use core::fmt::Write;
|
||||
use crate::rn4020::{BaudRate, RN4020};
|
||||
use hal::{
|
||||
clock::GenericClockController,
|
||||
delay::Delay,
|
||||
//digital::v1::OutputPin,
|
||||
entry,
|
||||
gpio::{Pa10, Pa11, PfC},
|
||||
prelude::*,
|
||||
sercom::{PadPin, Sercom0Pad2, Sercom0Pad3},
|
||||
CorePeripherals,
|
||||
Peripherals,
|
||||
};
|
||||
#[allow(dead_code)]
|
||||
mod rn4020;
|
||||
|
||||
mod bl_demo;
|
||||
mod display_demo;
|
||||
mod ring_buffer;
|
||||
mod usb_shell;
|
||||
mod util;
|
||||
mod wait_delay;
|
||||
|
||||
use crate::ring_buffer::RingBuffer;
|
||||
use crate::util::ByteStr;
|
||||
use core::fmt::Write;
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use hal::clock::GenericClockController;
|
||||
use hal::entry;
|
||||
use hal::pac::{interrupt, CorePeripherals, Peripherals};
|
||||
use hal::prelude::*;
|
||||
use usb_shell::{init, usb_read};
|
||||
use wait_delay::WaitDelay;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
@ -30,47 +36,93 @@ fn main() -> ! {
|
||||
&mut peripherals.SYSCTRL,
|
||||
&mut peripherals.NVMCTRL,
|
||||
);
|
||||
let glck0 = clocks.gclk0();
|
||||
let mut pins = hal::Pins::new(peripherals.PORT);
|
||||
|
||||
let mut delay = Delay::new(core.SYST, &mut clocks);
|
||||
|
||||
let mut red_led = pins.d13.into_open_drain_output(&mut pins.port);
|
||||
let mut delay = WaitDelay::new(core.SYST, &mut clocks);
|
||||
|
||||
let button_in = pins.d12.into_pull_up_input(&mut pins.port);
|
||||
let mut button_last: bool = false;
|
||||
let col0 = pins.d9.into_pull_up_input(&mut pins.port);
|
||||
let col1 = pins.d12.into_pull_up_input(&mut pins.port);
|
||||
let cols = [&col0 as &dyn InputPin<Error = ()>, &col1];
|
||||
|
||||
let bl_baud_rate = BaudRate::BR115200;
|
||||
let mut bluetooth: RN4020<Sercom0Pad3<Pa11<PfC>>, Sercom0Pad2<Pa10<PfC>>> = RN4020::new(
|
||||
&clocks.sercom0_core(&glck0).unwrap(),
|
||||
bl_baud_rate,
|
||||
peripherals.SERCOM0,
|
||||
let mut row0 = pins.d11.into_open_drain_output(&mut pins.port);
|
||||
let mut row1 = pins.d7.into_open_drain_output(&mut pins.port);
|
||||
let mut rows = [&mut row0 as &mut dyn OutputPin<Error = ()>, &mut row1];
|
||||
|
||||
let mut blip = || {
|
||||
red_led.set_low().ok();
|
||||
delay.delay_ms(100u16);
|
||||
red_led.toggle();
|
||||
delay.delay_ms(100u16);
|
||||
};
|
||||
|
||||
let mut usb = init(
|
||||
&mut core.NVIC,
|
||||
peripherals.USB,
|
||||
&mut clocks,
|
||||
&mut peripherals.PM,
|
||||
(
|
||||
pins.d0.into_pad(&mut pins.port),
|
||||
pins.d1.into_pad(&mut pins.port),
|
||||
),
|
||||
pins.usb_dm,
|
||||
pins.usb_dp,
|
||||
&mut blip,
|
||||
);
|
||||
|
||||
let mut matrix = [[false; 2]; 2];
|
||||
|
||||
// Flash the LED in a spin loop to demonstrate that USB is
|
||||
// entirely interrupt driven.
|
||||
loop {
|
||||
//match uart.read() {
|
||||
// Ok(word) => uart.write(word).unwrap(),
|
||||
// Err(nb::Error::WouldBlock) => {}
|
||||
// Err(_) => panic!("Something went wrong when reading from UART"),
|
||||
//}
|
||||
let mut switched_buttons = RingBuffer::<(usize, usize, bool), 4>::new();
|
||||
|
||||
let button = button_in.is_low().unwrap();
|
||||
|
||||
if button && !button_last {
|
||||
red_led.set_high().unwrap();
|
||||
|
||||
bluetooth.set_serialized_name("MyDude123").unwrap();
|
||||
|
||||
delay.delay_ms(200u8);
|
||||
red_led.set_low().unwrap();
|
||||
}
|
||||
|
||||
button_last = button;
|
||||
for (i, row) in rows.iter_mut().enumerate() {
|
||||
row.set_low().ok();
|
||||
for (j, col) in cols.iter().enumerate() {
|
||||
let state = col.is_low().unwrap_or(false);
|
||||
if matrix[i][j] != state {
|
||||
matrix[i][j] = state;
|
||||
switched_buttons.push_back((i, j, state)).ok();
|
||||
}
|
||||
}
|
||||
row.set_high().ok();
|
||||
}
|
||||
|
||||
if matrix.iter().flatten().any(|&f| f) {
|
||||
red_led.set_high().ok();
|
||||
} else {
|
||||
red_led.set_low().ok();
|
||||
}
|
||||
|
||||
while let Some((i, j, pressed)) = switched_buttons.pop_front() {
|
||||
let mut buf = ByteStr::<255>::new();
|
||||
write!(
|
||||
&mut buf,
|
||||
"button [{}, {}] {}",
|
||||
i,
|
||||
j,
|
||||
if pressed { "pressed" } else { "released" }
|
||||
)
|
||||
.ok();
|
||||
usb.println(&buf);
|
||||
}
|
||||
|
||||
/*
|
||||
n += buf.write(b"buttons: ").unwrap_or(0);
|
||||
for &pressed in matrix.iter().flatten() {
|
||||
if pressed {
|
||||
n += buf.write("DOWN").unwrap_or(0);
|
||||
} else {
|
||||
n += buf.write("UP").unwrap_or(0);
|
||||
}
|
||||
n += buf.write(" ").unwrap_or(0);
|
||||
}
|
||||
*/
|
||||
|
||||
delay.delay_ms(50u16);
|
||||
usb.poll();
|
||||
|
||||
//usb.println(b"woop");
|
||||
}
|
||||
}
|
||||
|
||||
#[interrupt]
|
||||
fn USB() {
|
||||
usb_read();
|
||||
}
|
||||
|
||||
@ -3,9 +3,10 @@ use core::panic::PanicInfo;
|
||||
use hal::{
|
||||
clock::GenericClockController,
|
||||
gpio::{Pa10, Pa11, PfC},
|
||||
pac::Peripherals,
|
||||
prelude::*,
|
||||
sercom::{PadPin, Sercom0Pad2, Sercom0Pad3, UART0},
|
||||
time, CorePeripherals, Peripherals,
|
||||
time,
|
||||
};
|
||||
|
||||
#[panic_handler]
|
||||
@ -15,7 +16,6 @@ fn panic(info: &PanicInfo) -> ! {
|
||||
let mut red_led = pins.d13.into_open_drain_output(&mut pins.port);
|
||||
red_led.set_high().ok();
|
||||
|
||||
let mut core = unsafe { CorePeripherals::steal() };
|
||||
let mut clocks = GenericClockController::with_internal_32kosc(
|
||||
peripherals.GCLK,
|
||||
&mut peripherals.PM,
|
||||
@ -28,7 +28,6 @@ fn panic(info: &PanicInfo) -> ! {
|
||||
&clocks.sercom0_core(&glck0).unwrap(),
|
||||
time::Hertz(115200),
|
||||
peripherals.SERCOM0,
|
||||
&mut core.NVIC,
|
||||
&mut peripherals.PM,
|
||||
(
|
||||
pins.d0.into_pad(&mut pins.port),
|
||||
|
||||
61
src/ring_buffer.rs
Normal file
61
src/ring_buffer.rs
Normal file
@ -0,0 +1,61 @@
|
||||
pub struct RingBuffer<T, const N: usize> {
|
||||
buffer: [T; N],
|
||||
start: usize,
|
||||
end: usize,
|
||||
}
|
||||
|
||||
impl<const N: usize> RingBuffer<u8, N> {
|
||||
pub const fn new_u8() -> Self {
|
||||
RingBuffer {
|
||||
buffer: [0; N],
|
||||
start: 0,
|
||||
end: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, const N: usize> RingBuffer<T, N>
|
||||
where
|
||||
T: Default + Copy,
|
||||
{
|
||||
pub fn new() -> Self {
|
||||
RingBuffer {
|
||||
buffer: [Default::default(); N],
|
||||
start: 0,
|
||||
end: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, const N: usize> RingBuffer<T, N>
|
||||
where
|
||||
T: Copy,
|
||||
{
|
||||
pub fn push_back(&mut self, element: T) -> Result<(), T> {
|
||||
let next_end = (self.end + 1) % N;
|
||||
|
||||
if next_end == self.start {
|
||||
return Err(element);
|
||||
}
|
||||
|
||||
self.buffer[self.end] = element;
|
||||
self.end = next_end;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn pop_front(&mut self) -> Option<T> {
|
||||
if self.is_empty() {
|
||||
return None;
|
||||
}
|
||||
|
||||
let element = self.buffer[self.start];
|
||||
self.start = (self.start + 1) % N;
|
||||
|
||||
Some(element)
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.start == self.end
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,15 @@
|
||||
use core::fmt::Write;
|
||||
use hal::{
|
||||
clock::Sercom0CoreClock,
|
||||
//target_device::{NVIC, PM, SERCOM0},
|
||||
pac::{PM, SERCOM0},
|
||||
sercom::{RxpoTxpo, UART0Padout, UART0},
|
||||
target_device::{NVIC, PM, SERCOM0},
|
||||
time::Hertz,
|
||||
//prelude::_embedded_hal_serial_Read as Read,
|
||||
//prelude::_embedded_hal_serial_Write as WriteHal,
|
||||
};
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum BaudRate {
|
||||
BR2400,
|
||||
@ -46,7 +48,6 @@ impl<RX, TX> RN4020<RX, TX> {
|
||||
clock: &Sercom0CoreClock,
|
||||
baud_rate: BaudRate,
|
||||
sercom: SERCOM0,
|
||||
nvic: &mut NVIC,
|
||||
pm: &mut PM,
|
||||
padout: T,
|
||||
) -> Self
|
||||
@ -55,7 +56,7 @@ impl<RX, TX> RN4020<RX, TX> {
|
||||
UART0Padout<RX, TX, (), ()>: RxpoTxpo,
|
||||
{
|
||||
let mut bl = RN4020 {
|
||||
link: UART0::new(clock, baud_rate, sercom, nvic, pm, padout),
|
||||
link: UART0::new(clock, baud_rate, sercom, pm, padout),
|
||||
};
|
||||
bl.set_baud_rate(baud_rate).unwrap();
|
||||
bl
|
||||
@ -69,6 +70,7 @@ impl<RX, TX> RN4020<RX, TX> {
|
||||
/// with unique numbering.
|
||||
///
|
||||
/// Will panic if provided with an invalid string.
|
||||
#[allow(dead_code)]
|
||||
pub fn set_serialized_name(&mut self, name: &str) -> Result<(), ()> {
|
||||
assert!(name.len() <= 15);
|
||||
assert!(name.is_ascii());
|
||||
|
||||
261
src/usb_shell.rs
Normal file
261
src/usb_shell.rs
Normal file
@ -0,0 +1,261 @@
|
||||
mod cmds;
|
||||
|
||||
use crate::ring_buffer::RingBuffer;
|
||||
use crate::util::cell::RacyCell;
|
||||
use core::mem::MaybeUninit;
|
||||
use core::str::from_utf8;
|
||||
use core::sync::atomic::AtomicBool;
|
||||
use core::sync::atomic::Ordering;
|
||||
use cortex_m::peripheral::NVIC;
|
||||
use hal::clock::GenericClockController;
|
||||
use hal::gpio::{
|
||||
v2::{PA24, PA25},
|
||||
Pin,
|
||||
};
|
||||
use hal::pac::{interrupt, PM, USB};
|
||||
use hal::usb::UsbBus;
|
||||
use usb_device::bus::UsbBusAllocator;
|
||||
use usb_device::prelude::*;
|
||||
use usbd_serial::{SerialPort, USB_CLASS_CDC};
|
||||
|
||||
pub struct UsbShell {
|
||||
line_buf: [u8; 255],
|
||||
buf_len: usize,
|
||||
}
|
||||
|
||||
static USB_READY: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
static mut USB_BUS: Option<UsbDevice<UsbBus>> = None;
|
||||
static mut USB_SERIAL: Option<SerialPort<UsbBus>> = None;
|
||||
|
||||
static INPUT_BUFFER: RacyCell<RingBuffer<u8, 255>> = RacyCell::new(RingBuffer::new_u8());
|
||||
|
||||
const PROMPT: &[u8] = b"[neowatch]# ";
|
||||
|
||||
pub fn init<F: FnMut()>(
|
||||
nvic: &mut NVIC,
|
||||
usb: USB,
|
||||
clocks: &mut GenericClockController,
|
||||
pm: &mut PM,
|
||||
usb_dm: Pin<PA24, hal::gpio::v2::Input<hal::gpio::v2::Floating>>,
|
||||
usb_dp: Pin<PA25, hal::gpio::v2::Input<hal::gpio::v2::Floating>>,
|
||||
f: &mut F,
|
||||
) -> UsbShell {
|
||||
if USB_READY.load(Ordering::SeqCst) {
|
||||
panic!("usb::init called more than once");
|
||||
}
|
||||
|
||||
let bus_allocator = unsafe {
|
||||
static USB_ALLOCATOR: RacyCell<MaybeUninit<UsbBusAllocator<UsbBus>>> =
|
||||
RacyCell::new(MaybeUninit::uninit());
|
||||
|
||||
let allocator = &mut *USB_ALLOCATOR.get();
|
||||
*allocator = MaybeUninit::new(hal::usb_allocator(usb, clocks, pm, usb_dm, usb_dp));
|
||||
&mut *allocator.as_mut_ptr()
|
||||
};
|
||||
f();
|
||||
|
||||
unsafe {
|
||||
USB_SERIAL = Some(SerialPort::new(bus_allocator));
|
||||
USB_BUS = Some(
|
||||
UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x16c0, 0x27dd))
|
||||
.manufacturer("Fake company")
|
||||
.product("Serial port")
|
||||
.serial_number("TEST")
|
||||
.device_class(USB_CLASS_CDC)
|
||||
.build(),
|
||||
);
|
||||
}
|
||||
|
||||
f();
|
||||
|
||||
USB_READY.store(true, Ordering::SeqCst);
|
||||
f();
|
||||
|
||||
unsafe {
|
||||
nvic.set_priority(interrupt::USB, 1);
|
||||
f();
|
||||
NVIC::unmask(interrupt::USB);
|
||||
f();
|
||||
}
|
||||
|
||||
UsbShell {
|
||||
buf_len: 0,
|
||||
line_buf: [0; 255],
|
||||
}
|
||||
}
|
||||
|
||||
impl UsbShell {
|
||||
/// Output a line to the USB serial
|
||||
pub fn println(&mut self, s: &[u8]) {
|
||||
internal::usb_mutex(|_bus, serial| {
|
||||
internal::println(serial, self, s).ok();
|
||||
});
|
||||
}
|
||||
|
||||
/// Call periodically to consume input
|
||||
pub fn poll(&mut self) {
|
||||
internal::usb_mutex(|_bus, serial| {
|
||||
let input_buffer = unsafe { &mut *INPUT_BUFFER.get() };
|
||||
while let Some(input) = input_buffer.pop_front() {
|
||||
internal::handle_input(self, serial, input).ok();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Call from USB interrupt handler
|
||||
pub fn usb_read() {
|
||||
// make sure that the usb state was initialized properly
|
||||
if !USB_READY.load(Ordering::SeqCst) {
|
||||
return;
|
||||
}
|
||||
|
||||
fn f(bus: &mut UsbDevice<UsbBus>, serial: &mut SerialPort<UsbBus>) {
|
||||
bus.poll(&mut [serial]);
|
||||
let mut buf = [0u8; 64];
|
||||
|
||||
if let Ok(count) = serial.read(&mut buf) {
|
||||
for &c in buf.iter().take(count) {
|
||||
let input_buffer = unsafe { &mut *INPUT_BUFFER.get() };
|
||||
if let Err(_) = input_buffer.push_back(c) {
|
||||
//internal::println(serial, b"error: input buffer full").ok();
|
||||
}
|
||||
}
|
||||
|
||||
crate::wait_delay::wakeup();
|
||||
};
|
||||
}
|
||||
|
||||
// SAFETY: mutual exclusion is guaranteed if this function is called from an interrupt handler
|
||||
unsafe { internal::usb_with_state(f) };
|
||||
}
|
||||
|
||||
mod internal {
|
||||
use super::*;
|
||||
|
||||
const NEWLINE: &[u8] = b"\r\n";
|
||||
|
||||
/// Acquire USB state and execute function
|
||||
///
|
||||
/// User must guarantee mutual exclusion
|
||||
pub(super) unsafe fn usb_with_state<F>(f: F)
|
||||
where
|
||||
F: FnOnce(&mut UsbDevice<UsbBus>, &mut SerialPort<UsbBus>),
|
||||
{
|
||||
USB_BUS
|
||||
.as_mut()
|
||||
.zip(USB_SERIAL.as_mut())
|
||||
.map(|(bus, serial)| f(bus, serial));
|
||||
}
|
||||
|
||||
/// Acquire USB state and execute function with interrupts disabled
|
||||
pub(super) fn usb_mutex<F>(f: F)
|
||||
where
|
||||
F: FnOnce(&mut UsbDevice<UsbBus>, &mut SerialPort<UsbBus>),
|
||||
{
|
||||
// enter critical section
|
||||
NVIC::mask(interrupt::USB);
|
||||
|
||||
// SAFETY: interrupts are disabled. should be good.
|
||||
unsafe { usb_with_state(f) };
|
||||
|
||||
// exit critical section
|
||||
unsafe { NVIC::unmask(interrupt::USB) };
|
||||
}
|
||||
|
||||
pub(super) fn clear_char(serial: &mut SerialPort<UsbBus>) -> Result<(), UsbError> {
|
||||
serial.write(&[08, b' ', 08])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn clear_prompt(
|
||||
serial: &mut SerialPort<UsbBus>,
|
||||
state: &UsbShell,
|
||||
) -> Result<(), UsbError> {
|
||||
for _ in 0..(state.buf_len + PROMPT.len()) {
|
||||
// FIXME: This is not utf-8 compatible. It should decrease
|
||||
// buf_len by the size of the last unicode scalar.
|
||||
clear_char(serial)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn show_prompt(
|
||||
serial: &mut SerialPort<UsbBus>,
|
||||
state: &UsbShell,
|
||||
) -> Result<(), UsbError> {
|
||||
serial.write(PROMPT)?;
|
||||
serial.write(&state.line_buf[..state.buf_len])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn println(
|
||||
serial: &mut SerialPort<UsbBus>,
|
||||
state: &UsbShell,
|
||||
s: &[u8],
|
||||
) -> Result<(), UsbError> {
|
||||
clear_prompt(serial, state)?;
|
||||
serial.write(s)?;
|
||||
serial.write(NEWLINE)?;
|
||||
show_prompt(serial, state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn handle_input(
|
||||
state: &mut UsbShell,
|
||||
serial: &mut SerialPort<UsbBus>,
|
||||
input: u8,
|
||||
) -> Result<(), UsbError> {
|
||||
match input {
|
||||
b'\t' => {}
|
||||
127 | 08 /* del or backspace */ => {
|
||||
if state.buf_len > 0 {
|
||||
// FIXME: This is not utf-8 compatible. It should decrease
|
||||
// buf_len by the size of the last unicode scalar.
|
||||
state.buf_len -= 1;
|
||||
clear_char(serial)?;
|
||||
}
|
||||
}
|
||||
b'\n' | b'\r' => {
|
||||
if state.buf_len > 0 {
|
||||
serial.write(NEWLINE)?;
|
||||
match from_utf8(&state.line_buf[..state.buf_len]) {
|
||||
Ok(s) => {
|
||||
let mut args = s.split(" ");
|
||||
let arg0 = args.next().unwrap_or("");
|
||||
|
||||
match arg0 {
|
||||
"help" => cmds::help::exec(args, serial),
|
||||
"echo" => cmds::echo::exec(args, serial),
|
||||
_ => {
|
||||
serial.write(b"Unknown command: ")?;
|
||||
serial.write(arg0.as_bytes())?;
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
serial.write(b"ERROR: not valid utf-8")?;
|
||||
}
|
||||
}
|
||||
}
|
||||
state.buf_len = 0;
|
||||
serial.write(NEWLINE)?;
|
||||
show_prompt(serial, state)?;
|
||||
}
|
||||
_ => {
|
||||
if state.buf_len >= state.line_buf.len() {
|
||||
state.buf_len = 0;
|
||||
serial
|
||||
.write(b"\r\nERROR: line buffer size exceeded\r\n")?;
|
||||
}
|
||||
|
||||
state.line_buf[state.buf_len] = input;
|
||||
state.buf_len += 1;
|
||||
serial.write(&[input])?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
27
src/usb_shell/cmds/echo.rs
Normal file
27
src/usb_shell/cmds/echo.rs
Normal file
@ -0,0 +1,27 @@
|
||||
use hal::usb::UsbBus;
|
||||
use usbd_serial::SerialPort;
|
||||
|
||||
/// Echo
|
||||
pub fn exec<'a, I: Iterator<Item = &'a str>>(args: I, serial: &mut SerialPort<UsbBus>) {
|
||||
for arg in args {
|
||||
// inspect bytes
|
||||
//for &byte in arg.as_bytes() {
|
||||
// let mut decimal = [0u8; 3];
|
||||
// decimal[2] = byte % 10;
|
||||
// decimal[1] = byte % 100 / 10;
|
||||
// decimal[0] = byte / 100;
|
||||
|
||||
// serial.write(&[byte]).unwrap();
|
||||
// serial.write(b" has dec code ").unwrap();
|
||||
// for &digit in &decimal {
|
||||
// let c =
|
||||
// [b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9'][digit as usize];
|
||||
// serial.write(&[c]).unwrap();
|
||||
// }
|
||||
// serial.write(b"\r\n").unwrap();
|
||||
//}
|
||||
|
||||
serial.write(arg.as_bytes()).unwrap();
|
||||
serial.write(b" ").unwrap();
|
||||
}
|
||||
}
|
||||
13
src/usb_shell/cmds/help.rs
Normal file
13
src/usb_shell/cmds/help.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use hal::usb::UsbBus;
|
||||
use usbd_serial::SerialPort;
|
||||
|
||||
/// Help
|
||||
pub fn exec<'a, I: Iterator<Item = &'a str>>(_args: I, serial: &mut SerialPort<UsbBus>) {
|
||||
serial
|
||||
.write(
|
||||
b"available commands:\r\n\
|
||||
- help\r\n\
|
||||
- echo",
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
2
src/usb_shell/cmds/mod.rs
Normal file
2
src/usb_shell/cmds/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod echo;
|
||||
pub mod help;
|
||||
15
src/util/cell.rs
Normal file
15
src/util/cell.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use core::cell::UnsafeCell;
|
||||
|
||||
pub struct RacyCell<T>(pub UnsafeCell<T>);
|
||||
|
||||
unsafe impl<T> Sync for RacyCell<T> {}
|
||||
|
||||
impl<T> RacyCell<T> {
|
||||
pub const fn new(inner: T) -> Self {
|
||||
RacyCell(UnsafeCell::new(inner))
|
||||
}
|
||||
|
||||
pub fn get(&self) -> *mut T {
|
||||
self.0.get()
|
||||
}
|
||||
}
|
||||
41
src/util/mod.rs
Normal file
41
src/util/mod.rs
Normal file
@ -0,0 +1,41 @@
|
||||
pub mod cell;
|
||||
|
||||
use core::fmt::{self, Write};
|
||||
use core::ops::Deref;
|
||||
|
||||
pub struct ByteStr<const N: usize> {
|
||||
bytes: [u8; N],
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl<const N: usize> ByteStr<N> {
|
||||
pub fn new() -> Self {
|
||||
ByteStr {
|
||||
bytes: [0; N],
|
||||
len: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<const N: usize> Deref for ByteStr<N> {
|
||||
type Target = [u8];
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.bytes[..self.len]
|
||||
}
|
||||
}
|
||||
|
||||
impl<const N: usize> Write for ByteStr<N> {
|
||||
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||
let b = s.as_bytes();
|
||||
|
||||
if (self.bytes.len() - self.len) < b.len() {
|
||||
return Err(fmt::Error);
|
||||
}
|
||||
|
||||
self.bytes[self.len..self.len + b.len()].copy_from_slice(b);
|
||||
self.len += b.len();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
98
src/wait_delay.rs
Normal file
98
src/wait_delay.rs
Normal file
@ -0,0 +1,98 @@
|
||||
//! Delay module for waking the system up
|
||||
|
||||
use core::sync::atomic::{AtomicBool, Ordering};
|
||||
use cortex_m::peripheral::syst::SystClkSource;
|
||||
use cortex_m::peripheral::SYST;
|
||||
use embedded_hal::blocking::delay::{DelayMs, DelayUs};
|
||||
use itsybitsy_m0::clock::GenericClockController;
|
||||
use itsybitsy_m0::time::Hertz;
|
||||
|
||||
static SLEEPING: AtomicBool = AtomicBool::new(false);
|
||||
|
||||
pub fn wakeup() {
|
||||
SLEEPING.store(false, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// System timer (SysTick) as a delay provider
|
||||
pub struct WaitDelay {
|
||||
sysclock: Hertz,
|
||||
syst: SYST,
|
||||
}
|
||||
|
||||
impl WaitDelay {
|
||||
/// Configures the system timer (SysTick) as a delay provider
|
||||
pub fn new(mut syst: SYST, clocks: &mut GenericClockController) -> Self {
|
||||
syst.set_clock_source(SystClkSource::Core);
|
||||
|
||||
WaitDelay {
|
||||
syst,
|
||||
sysclock: clocks.gclk0().into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Releases the system timer (SysTick) resource
|
||||
#[allow(dead_code)]
|
||||
pub fn free(self) -> SYST {
|
||||
self.syst
|
||||
}
|
||||
}
|
||||
|
||||
impl DelayMs<u32> for WaitDelay {
|
||||
fn delay_ms(&mut self, ms: u32) {
|
||||
self.delay_us(ms * 1_000);
|
||||
}
|
||||
}
|
||||
|
||||
impl DelayMs<u16> for WaitDelay {
|
||||
fn delay_ms(&mut self, ms: u16) {
|
||||
self.delay_ms(ms as u32);
|
||||
}
|
||||
}
|
||||
|
||||
impl DelayMs<u8> for WaitDelay {
|
||||
fn delay_ms(&mut self, ms: u8) {
|
||||
self.delay_ms(ms as u32);
|
||||
}
|
||||
}
|
||||
|
||||
impl DelayUs<u32> for WaitDelay {
|
||||
fn delay_us(&mut self, us: u32) {
|
||||
// The SysTick Reload Value register supports values between 1 and 0x00FFFFFF.
|
||||
const MAX_RVR: u32 = 0x00FF_FFFF;
|
||||
|
||||
let mut total_rvr = us * (self.sysclock.0 / 1_000_000);
|
||||
|
||||
SLEEPING.store(true, Ordering::SeqCst);
|
||||
|
||||
while total_rvr != 0 && SLEEPING.load(Ordering::SeqCst) {
|
||||
let current_rvr = if total_rvr <= MAX_RVR {
|
||||
total_rvr
|
||||
} else {
|
||||
MAX_RVR
|
||||
};
|
||||
|
||||
self.syst.set_reload(current_rvr);
|
||||
self.syst.clear_current();
|
||||
self.syst.enable_counter();
|
||||
|
||||
// Update the tracking variable while we are waiting...
|
||||
total_rvr -= current_rvr;
|
||||
|
||||
while !self.syst.has_wrapped() && SLEEPING.load(Ordering::SeqCst) {}
|
||||
|
||||
self.syst.disable_counter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DelayUs<u16> for WaitDelay {
|
||||
fn delay_us(&mut self, us: u16) {
|
||||
self.delay_us(us as u32)
|
||||
}
|
||||
}
|
||||
|
||||
impl DelayUs<u8> for WaitDelay {
|
||||
fn delay_us(&mut self, us: u8) {
|
||||
self.delay_us(us as u32)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user