diff options
author | Brian Cully <bjc@kublai.com> | 2019-09-09 20:15:21 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-09-09 20:45:08 -0400 |
commit | c1422f40d1ec9f77cc72c9425e67e97150bb2f52 (patch) | |
tree | c1756087df282369ba856b1c384ef061af12f63e /usb | |
parent | fdd4cfd1eb4995c192184aaa6ff073cee50852cb (diff) | |
download | bleusb-c1422f40d1ec9f77cc72c9425e67e97150bb2f52.tar.gz bleusb-c1422f40d1ec9f77cc72c9425e67e97150bb2f52.zip |
Convert to workspace.
Diffstat (limited to 'usb')
-rw-r--r-- | usb/.cargo/config | 4 | ||||
-rw-r--r-- | usb/.gdbinit | 4 | ||||
-rw-r--r-- | usb/Cargo.lock | 425 | ||||
-rw-r--r-- | usb/Cargo.toml | 22 | ||||
-rw-r--r-- | usb/Makefile | 10 | ||||
-rw-r--r-- | usb/openocd.conf | 14 | ||||
-rw-r--r-- | usb/src/dotstar.rs | 2 | ||||
-rw-r--r-- | usb/src/logger.rs | 10 | ||||
-rw-r--r-- | usb/src/main.rs | 54 | ||||
-rw-r--r-- | usb/src/rtc.rs | 3 |
10 files changed, 72 insertions, 476 deletions
diff --git a/usb/.cargo/config b/usb/.cargo/config index 9a30220..b10f29d 100644 --- a/usb/.cargo/config +++ b/usb/.cargo/config @@ -1,6 +1,2 @@ [build] target = "thumbv6m-none-eabi" - -[target.thumbv6m-none-eabi] -rustflags = ["-C", "link-arg=-Tlink.x"] -runner = "gdb-multiarch" diff --git a/usb/.gdbinit b/usb/.gdbinit index 2782abd..937b91c 100644 --- a/usb/.gdbinit +++ b/usb/.gdbinit @@ -1,3 +1,7 @@ +define hook-quit + set confirm off +end + # print demangled symbols by default set print asm-demangle on diff --git a/usb/Cargo.lock b/usb/Cargo.lock deleted file mode 100644 index 8bf4a7d..0000000 --- a/usb/Cargo.lock +++ /dev/null @@ -1,425 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "aligned" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "apa102-spi" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "embedded-hal 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smart-leds-trait 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "as-slice" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -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)", -] - -[[package]] -name = "atsamd-hal" -version = "0.6.0" -dependencies = [ - "atsamd21e18a 0.5.0", - "bitfield 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m 0.6.1 (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.2 (registry+https://github.com/rust-lang/crates.io-index)", - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atsamd-usb-host" -version = "0.1.0" -dependencies = [ - "atsamd-hal 0.6.0", - "embedded-hal 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "starb 0.2.0", - "usb-host 0.1.1", -] - -[[package]] -name = "atsamd21e18a" -version = "0.5.0" -dependencies = [ - "bare-metal 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m 0.6.1 (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.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bitfield" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bootkbd" -version = "0.2.0" -dependencies = [ - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "usb-host 0.1.1", -] - -[[package]] -name = "cfg-if" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "clint" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cortex-m 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cortex-m" -version = "0.6.1" -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.5 (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-rt" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -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)", -] - -[[package]] -name = "cortex-m-rt-macros" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -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)", -] - -[[package]] -name = "embedded-hal" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -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)", -] - -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nb" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "paste" -version = "0.1.6" -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.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (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.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "1.0.2" -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)", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[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)", -] - -[[package]] -name = "rand_core" -version = "0.3.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)", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rgb" -version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "smart-leds" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "smart-leds-trait 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "smart-leds-trait" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rgb 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stable_deref_trait" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "starb" -version = "0.2.0" - -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -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.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "trinket_m0" -version = "0.4.0" -dependencies = [ - "atsamd-hal 0.6.0", - "cortex-m 0.6.1 (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)", -] - -[[package]] -name = "typenum" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "usb" -version = "0.1.0" -dependencies = [ - "apa102-spi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "atsamd-usb-host 0.1.0", - "bootkbd 0.2.0", - "clint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cortex-m 0.6.1 (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)", - "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smart-leds 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smart-leds-trait 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "starb 0.2.0", - "trinket_m0 0.4.0", - "usb-host 0.1.1", -] - -[[package]] -name = "usb-host" -version = "0.1.1" - -[[package]] -name = "vcell" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "volatile-register" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "vcell 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum aligned 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a316c7ea8e1e9ece54862c992def5a7ac14de9f5832b69d71760680efeeefa" -"checksum apa102-spi 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7db64ad01f91b1e4266786453db12b65aced7247bed5c6292ee77a7361f9718b" -"checksum as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "293dac66b274fab06f95e7efb05ec439a6b70136081ea522d270bc351ae5bb27" -"checksum bare-metal 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -"checksum bitfield 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" -"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum clint 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf426ed438e61a9c2b9619fa8fda2ded21767e4fef8c13e5fc781b33487e9ec8" -"checksum cortex-m 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "145da2fc379bbd378ed425e75e1748214add9bbd800d4d5b77abb54ca423dbca" -"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-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 log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -"checksum nb 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b1411551beb3c11dedfb0a90a0fa256b47d28b9ec2cdff34c25a2fa59e45dbdc" -"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.2 (registry+https://github.com/rust-lang/crates.io-index)" = "175a40b9cf564ce9bf050654633dbf339978706b8ead1a907bb970b63185dd95" -"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"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 rgb 0.8.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2089e4031214d129e201f8c3c8c2fe97cd7322478a0d1cdf78e7029b0042efdb" -"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 smart-leds 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab0a30e934e60850bfc020d4c2727cc8a3635371f6af2cb3f55f36f0134ed080" -"checksum smart-leds-trait 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef18e60d41a6fde19e640cd7590c03fb27aa23146bf60e4da85028d7410cee7" -"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.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" -"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" -"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.2 (registry+https://github.com/rust-lang/crates.io-index)" = "876e32dcadfe563a4289e994f7cb391197f362b6315dc45e8ba4aa6f564a4b3c" -"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" diff --git a/usb/Cargo.toml b/usb/Cargo.toml index 3a12676..fb6712c 100644 --- a/usb/Cargo.toml +++ b/usb/Cargo.toml @@ -9,9 +9,8 @@ repository = "https://github.com/bjc/bleusb.git" [dependencies] embedded-hal = "0.2" -trinket_m0 = "0.4" log = "0.4" -starb = "0.2" +starb = "0.3" clint = "0.2" nb = "0.1" cortex-m = "0.6" @@ -21,19 +20,12 @@ smart-leds = "0.2" apa102-spi = "0.2" usb-host = "0.1" bootkbd = "0.2" -#atsamd-usb-host = { git = "https://github.com/bjc/atsamd-usb-host.git", rev = "385efdf53fa3fe38591f22d01edf75d3087c2326" } atsamd-usb-host = { path = "../../usbh/atsamd-usb-host" } - -[patch.crates-io] -#atsamd-hal = { git = "https://github.com/atsamd-rs/atsamd.git", rev = "ce2c2f426" } -#bootkbd = { git = "https://github.com/bjc/bootkbd.git", rev = "49827fce5adbaf636b893919f31c0dbd97bb3eb4" } -#usb-host = { git = "https://github.com/bjc/usb-host.git", rev = "b0be48424e81384de3280b5a5ac521d694b82e15" } -#trinket_m0 = { git = "https://github.com/atsamd-rs/atsamd.git", rev = "53f8d846e40715c8592d171d9a57b66ee303207a" } -atsamd-hal = { path = "../../usbh/atsamd/hal" } -trinket_m0 = { path = "../../usbh/atsamd/boards/trinket_m0" } -bootkbd = { path = "../../usbh/bootkbd" } -usb-host = { path = "../../usbh/usb-host" } -starb = { path = "../../usbh/starb" } +#atsamd-usb-host = { git = "https://github.com/bjc/atsamd-usb-host.git", rev = "52d36ba" } +trinket_m0 = {version = "0.5", optional = true } +feather_m0 = {version = "0.5", optional = true } [features] -default = ["atsamd-usb-host/samd21e18a"] +default = ["trinket-m0"] +trinket-m0 = ["trinket_m0", "atsamd-usb-host/samd21e18a"] +feather-m0 = ["feather_m0", "atsamd-usb-host/samd21g18a"] diff --git a/usb/Makefile b/usb/Makefile index 6d420d1..e673fc4 100644 --- a/usb/Makefile +++ b/usb/Makefile @@ -30,10 +30,18 @@ test: cargo test cargo-build: - cargo rustc $(CARGOFLAGS) -- -C link-arg=-Tlink.x + cargo build #rustc $(CARGOFLAGS) -- -C link-arg=-Tlink.x $(OUTDIR)/$(APP): cargo-build + # stlink_swim + # hla_jtag + # hla_swd + # swd + # aice_jtag + # jtag + + flash: $(APP).bin feather-cmd r sleep 2 diff --git a/usb/openocd.conf b/usb/openocd.conf index 586c517..d1557f7 100644 --- a/usb/openocd.conf +++ b/usb/openocd.conf @@ -2,10 +2,18 @@ gdb_port 3334 telnet_port 4445 tcl_port 6667 -source [find interface/stlink-v2.cfg] -set TRANSPORT stlink_jtag +source [find interface/stlink.cfg] +transport select hla_swd + +set CHIPNAME at91samd21e18a set CPUTAPID 0x0bc11477 source [find target/at91samdXX.cfg] adapter_khz 3750 -reset_config srst_only srst_nogate +#adapter_khz 300 +adapter_nsrst_delay 100 +adapter_nsrst_assert_width 100 +reset_config srst_nogate + +init +reset halt diff --git a/usb/src/dotstar.rs b/usb/src/dotstar.rs index 8e930d0..c7eed7d 100644 --- a/usb/src/dotstar.rs +++ b/usb/src/dotstar.rs @@ -1,9 +1,9 @@ use trinket_m0::{ clock::GenericClockController, gpio::{self, Floating, Input}, + pac::{PM, SERCOM1}, prelude::*, sercom::{self, PadPin, SPIMaster1}, - PM, SERCOM1, }; use apa102_spi::Apa102; diff --git a/usb/src/logger.rs b/usb/src/logger.rs index 9fbba77..7357c22 100644 --- a/usb/src/logger.rs +++ b/usb/src/logger.rs @@ -1,14 +1,14 @@ +use crate::hal::{ + gpio::{Pa6, Pa7, PfD}, + sercom::{Sercom0Pad2, Sercom0Pad3, UART0}, +}; use crate::rtc; -use starb::{Reader, RingBuffer, Writer}; use core::cell::UnsafeCell; use core::fmt::{self, Write}; use embedded_hal::{digital::v2::OutputPin, serial}; use log::{Metadata, Record}; -use trinket_m0::{ - gpio::{Pa6, Pa7, PfD}, - sercom::{Sercom0Pad2, Sercom0Pad3, UART0}, -}; +use starb::{Reader, RingBuffer, Writer}; static mut UART0: usize = 0; diff --git a/usb/src/main.rs b/usb/src/main.rs index 523d275..42cdf55 100644 --- a/usb/src/main.rs +++ b/usb/src/main.rs @@ -3,6 +3,12 @@ #![no_std] #![no_main] +#[cfg(feature = "feather-m0")] +use feather_m0 as hal; +#[cfg(feature = "trinket-m0")] +use trinket_m0 as hal; + +#[cfg(feature = "trinket-m0")] mod dotstar; mod logger; mod macros; @@ -13,21 +19,24 @@ use bootkbd::BootKeyboard; use clint::HandlerArray; use core::mem; use core::panic::PanicInfo; -use cortex_m::{asm::wfi, peripheral::NVIC}; +use cortex_m::{ + asm::wfi, + peripheral::{Peripherals as CorePeripherals, NVIC}, +}; use cortex_m_rt::{entry, exception, ExceptionFrame}; use embedded_hal::{blocking::i2c::Write, digital::v2::OutputPin}; -use log::{info, LevelFilter}; -use smart_leds::colors; -use smart_leds_trait::SmartLedsWrite; -use trinket_m0::{ - self as hal, +use hal::{ clock::GenericClockController, gpio::{OpenDrain, Output, Pa10, Pa6, Pa7, PfD}, + pac::{interrupt, Interrupt, Peripherals}, sercom, - target_device::{interrupt, Interrupt}, time::*, - CorePeripherals, Peripherals, }; +use log::{info, LevelFilter}; +#[cfg(feature = "trinket-m0")] +use smart_leds::colors; +#[cfg(feature = "trinket-m0")] +use smart_leds_trait::SmartLedsWrite; use usb_host::Driver; // A very unsafe copy of an LED to turn on when things go really, really wrong. @@ -77,19 +86,22 @@ fn main() -> ! { red_led.set_low().expect("turning off red LED"); unsafe { LED = mem::transmute(&red_led) } - let mut dotstar = dotstar::new( - dp.SERCOM1, - pins.swdio, - pins.dotstar_di, - pins.dotstar_ci, - &mut pins.port, - &mut dp.PM, - &mut clocks, - ); - let black = [colors::BLACK]; - dotstar - .write(black.iter().cloned()) - .expect("turning off dotstar"); + #[cfg(feature = "trinket-m0")] + { + let mut dotstar = dotstar::new( + dp.SERCOM1, + pins.swdio, + pins.dotstar_di, + pins.dotstar_ci, + &mut pins.port, + &mut dp.PM, + &mut clocks, + ); + let black = [colors::BLACK]; + dotstar + .write(black.iter().cloned()) + .expect("turning off dotstar"); + } // We do the transmute because, while all the underlying data is // static, we're unable to get a referecence to the UART or LED diff --git a/usb/src/rtc.rs b/usb/src/rtc.rs index fa7b347..dc4259f 100644 --- a/usb/src/rtc.rs +++ b/usb/src/rtc.rs @@ -1,6 +1,7 @@ +use crate::hal::{clock::GenericClockController, pac::RTC}; + use core::sync::atomic::{AtomicUsize, Ordering}; use log; -use trinket_m0::{clock::GenericClockController, RTC}; struct Clock(AtomicUsize); impl Clock { |