Initial commit
This commit is contained in:
10
.cargo/config
Normal file
10
.cargo/config
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# samd21 is a Cortex-M0 and thus thumbv6m
|
||||||
|
|
||||||
|
[build]
|
||||||
|
target = "thumbv6m-none-eabi"
|
||||||
|
|
||||||
|
[target.thumbv6m-none-eabi]
|
||||||
|
runner = 'arm-none-eabi-gdb'
|
||||||
|
rustflags = [
|
||||||
|
"-C", "link-arg=-Tlink.x",
|
||||||
|
]
|
||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/target
|
||||||
|
**/*.rs.bk
|
||||||
418
Cargo.lock
generated
Normal file
418
Cargo.lock
generated
Normal file
@ -0,0 +1,418 @@
|
|||||||
|
# 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"
|
||||||
|
|
||||||
|
[[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 = "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.5.0"
|
||||||
|
source = "git+https://github.com/atsamd-rs/atsamd#d1872cf259bbaf5ec65a477ac2d6b93eb5afbd7a"
|
||||||
|
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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "atsamd21g18a"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "git+https://github.com/atsamd-rs/atsamd#d1872cf259bbaf5ec65a477ac2d6b93eb5afbd7a"
|
||||||
|
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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bare-metal"
|
||||||
|
version = "0.2.4"
|
||||||
|
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 = "cortex-m"
|
||||||
|
version = "0.5.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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-graphics"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itsybitsy_m0"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "git+https://github.com/atsamd-rs/atsamd#d1872cf259bbaf5ec65a477ac2d6b93eb5afbd7a"
|
||||||
|
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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.2.1"
|
||||||
|
source = "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 = "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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nom"
|
||||||
|
version = "4.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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.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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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.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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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.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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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 = "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 = "ssd1306"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "stable_deref_trait"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[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.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)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinybmp"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinytga"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.10.0"
|
||||||
|
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 = "vcell"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.1.5"
|
||||||
|
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.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[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"
|
||||||
40
Cargo.toml
Normal file
40
Cargo.toml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[package]
|
||||||
|
name = "neowatch"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Joakim Hulthe <joakim@hulthe.net>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
panic = "abort"
|
||||||
|
lto = false
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
panic = "abort"
|
||||||
|
lto = false
|
||||||
|
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
cortex-m = "~0.6"
|
||||||
|
cortex-m-rt = "~0.6"
|
||||||
|
nb = "~0.1"
|
||||||
|
ssd1306 = "~0.2"
|
||||||
|
embedded-graphics = "^0.4.0"
|
||||||
|
embedded-hal = "=0.2.3"
|
||||||
|
|
||||||
|
[dependencies.itsybitsy_m0]
|
||||||
|
version = "~0.3"
|
||||||
|
git = "https://github.com/atsamd-rs/atsamd"
|
||||||
|
features = [
|
||||||
|
"rt",
|
||||||
|
"unproven",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependencies.atsamd-hal]
|
||||||
|
version = "~0.5"
|
||||||
|
git = "https://github.com/atsamd-rs/atsamd"
|
||||||
|
features = [
|
||||||
|
"samd21g18a",
|
||||||
|
"samd21g18a-rt",
|
||||||
|
"unproven",
|
||||||
|
]
|
||||||
|
|
||||||
41
Makefile.toml
Normal file
41
Makefile.toml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
[tasks.build]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["build"]
|
||||||
|
|
||||||
|
[tasks.objcopy]
|
||||||
|
command = "arm-none-eabi-objcopy"
|
||||||
|
args = [
|
||||||
|
"-O", "binary",
|
||||||
|
"target/thumbv6m-none-eabi/debug/neowatch",
|
||||||
|
"target/thumbv6m-none-eabi/debug/neowatch.bin",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tasks.set_tty]
|
||||||
|
command = "stty"
|
||||||
|
args = [
|
||||||
|
"-F", "/dev/ttyACM0",
|
||||||
|
"ospeed", "1200",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tasks.upload]
|
||||||
|
command = "bossac"
|
||||||
|
args = [
|
||||||
|
"--info",
|
||||||
|
"--debug",
|
||||||
|
"--port=/dev/ttyACM0",
|
||||||
|
"--force_usb_port=true",
|
||||||
|
"--erase",
|
||||||
|
"--write",
|
||||||
|
"--verify",
|
||||||
|
"target/thumbv6m-none-eabi/debug/neowatch.bin",
|
||||||
|
"--reset",
|
||||||
|
]
|
||||||
|
dependencies = ["build"]
|
||||||
|
#dependencies = ["set_tty", "build"]
|
||||||
|
|
||||||
|
[tasks.test]
|
||||||
|
disabled = true
|
||||||
|
|
||||||
|
[tasks.default]
|
||||||
|
dependencies = ["upload"]
|
||||||
|
|
||||||
16
build.rs
Normal file
16
build.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
use std::env;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
fn main() {
|
||||||
|
if env::var_os("CARGO_FEATURE_RT").is_some() {
|
||||||
|
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||||
|
File::create(out.join("memory.x"))
|
||||||
|
.unwrap()
|
||||||
|
.write_all(include_bytes!("memory.x"))
|
||||||
|
.unwrap();
|
||||||
|
println!("cargo:rustc-link-search={}", out.display());
|
||||||
|
println!("cargo:rerun-if-changed=memory.x");
|
||||||
|
}
|
||||||
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
}
|
||||||
8
memory.x
Normal file
8
memory.x
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
/* Leave 8k for the default bootloader on the ItsyBitsy M0 */
|
||||||
|
FLASH (rx) : ORIGIN = 0x00000000 + 8K, LENGTH = 256K - 8K
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
|
||||||
|
}
|
||||||
|
_stack_start = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
||||||
76
src/main.rs
Normal file
76
src/main.rs
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[entry]
|
||||||
|
fn main() -> ! {
|
||||||
|
let mut peripherals = Peripherals::take().unwrap();
|
||||||
|
let mut core = CorePeripherals::take().unwrap();
|
||||||
|
let mut clocks = GenericClockController::with_internal_32kosc(
|
||||||
|
peripherals.GCLK,
|
||||||
|
&mut peripherals.PM,
|
||||||
|
&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 button_in = pins.d12.into_pull_up_input(&mut pins.port);
|
||||||
|
let mut button_last: bool = false;
|
||||||
|
|
||||||
|
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 core.NVIC,
|
||||||
|
&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;
|
||||||
|
}
|
||||||
|
}
|
||||||
53
src/panic.rs
Normal file
53
src/panic.rs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
use core::fmt::Write;
|
||||||
|
use core::panic::PanicInfo;
|
||||||
|
use hal::{
|
||||||
|
clock::GenericClockController,
|
||||||
|
gpio::{Pa10, Pa11, PfC},
|
||||||
|
prelude::*,
|
||||||
|
sercom::{PadPin, Sercom0Pad2, Sercom0Pad3, UART0},
|
||||||
|
time, CorePeripherals, Peripherals,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
|
let mut peripherals = unsafe { Peripherals::steal() };
|
||||||
|
let mut pins = hal::Pins::new(peripherals.PORT);
|
||||||
|
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,
|
||||||
|
&mut peripherals.SYSCTRL,
|
||||||
|
&mut peripherals.NVMCTRL,
|
||||||
|
);
|
||||||
|
let glck0 = clocks.gclk0();
|
||||||
|
|
||||||
|
let mut uart: UART0<Sercom0Pad3<Pa11<PfC>>, Sercom0Pad2<Pa10<PfC>>, (), ()> = UART0::new(
|
||||||
|
&clocks.sercom0_core(&glck0).unwrap(),
|
||||||
|
time::Hertz(115200),
|
||||||
|
peripherals.SERCOM0,
|
||||||
|
&mut core.NVIC,
|
||||||
|
&mut peripherals.PM,
|
||||||
|
(
|
||||||
|
pins.d0.into_pad(&mut pins.port),
|
||||||
|
pins.d1.into_pad(&mut pins.port),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
loop {
|
||||||
|
uart.write_str("## PANIC ##\r\n").ok();
|
||||||
|
if let Some(location) = info.location() {
|
||||||
|
writeln!(
|
||||||
|
uart,
|
||||||
|
"Panic occured in file {}\r\nAt location {}\r\n",
|
||||||
|
location.file(),
|
||||||
|
location.line(),
|
||||||
|
)
|
||||||
|
.ok();
|
||||||
|
} else {
|
||||||
|
uart.write_str("No location info available...\r\n").ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
110
src/rn4020/mod.rs
Normal file
110
src/rn4020/mod.rs
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
use core::fmt::Write;
|
||||||
|
use hal::{
|
||||||
|
clock::Sercom0CoreClock,
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
pub enum BaudRate {
|
||||||
|
BR2400,
|
||||||
|
BR9600,
|
||||||
|
BR19200,
|
||||||
|
BR38400,
|
||||||
|
BR115200,
|
||||||
|
BR230400,
|
||||||
|
BR460800,
|
||||||
|
BR921600,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Into<Hertz> for BaudRate {
|
||||||
|
fn into(self) -> Hertz {
|
||||||
|
match self {
|
||||||
|
BaudRate::BR2400 => Hertz(2400),
|
||||||
|
BaudRate::BR9600 => Hertz(9600),
|
||||||
|
BaudRate::BR19200 => Hertz(19200),
|
||||||
|
BaudRate::BR38400 => Hertz(38400),
|
||||||
|
BaudRate::BR115200 => Hertz(115200),
|
||||||
|
BaudRate::BR230400 => Hertz(230400),
|
||||||
|
BaudRate::BR460800 => Hertz(460800),
|
||||||
|
BaudRate::BR921600 => Hertz(921600),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct RN4020<RX, TX> {
|
||||||
|
/// The reader/writer to the RN4020
|
||||||
|
link: UART0<RX, TX, (), ()>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<RX, TX> RN4020<RX, TX> {
|
||||||
|
/// Create a new
|
||||||
|
pub fn new<T>(
|
||||||
|
clock: &Sercom0CoreClock,
|
||||||
|
baud_rate: BaudRate,
|
||||||
|
sercom: SERCOM0,
|
||||||
|
nvic: &mut NVIC,
|
||||||
|
pm: &mut PM,
|
||||||
|
padout: T,
|
||||||
|
) -> Self
|
||||||
|
where
|
||||||
|
T: Into<UART0Padout<RX, TX, (), ()>>,
|
||||||
|
UART0Padout<RX, TX, (), ()>: RxpoTxpo,
|
||||||
|
{
|
||||||
|
let mut bl = RN4020 {
|
||||||
|
link: UART0::new(clock, baud_rate, sercom, nvic, pm, padout),
|
||||||
|
};
|
||||||
|
bl.set_baud_rate(baud_rate).unwrap();
|
||||||
|
bl
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This command sets the serialized Bluetooth-friendly name of the device.
|
||||||
|
///
|
||||||
|
/// `name` is up to 15 alphanumeric characters.
|
||||||
|
/// This command automatically appends the last 2 bytes of the Bluetooth MAC
|
||||||
|
/// address to the name, which is useful for generating a custom name
|
||||||
|
/// with unique numbering.
|
||||||
|
///
|
||||||
|
/// Will panic if provided with an invalid string.
|
||||||
|
pub fn set_serialized_name(&mut self, name: &str) -> Result<(), ()> {
|
||||||
|
assert!(name.len() <= 15);
|
||||||
|
assert!(name.is_ascii());
|
||||||
|
|
||||||
|
self.link.write_str("S-,").map_err(|_| ())?;
|
||||||
|
|
||||||
|
for c in name.chars() {
|
||||||
|
assert!(c.is_alphanumeric());
|
||||||
|
self.link.write_char(c).map_err(|_| ())?;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.link.write_char('\n').map_err(|_| ())?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This command sets the baud rate of the UART communication.
|
||||||
|
fn set_baud_rate(&mut self, rate: BaudRate) -> Result<(), ()> {
|
||||||
|
// The input parameter is a single digit number in the range of 0 to 7,
|
||||||
|
// representing a baud rate from 2400 to 921K, as shown in Table 2 - 5.
|
||||||
|
// When the baud rate is set to 2400, there is no need to wake the
|
||||||
|
// RN4020 module by pulling WAKE_SW high for UART communication.
|
||||||
|
|
||||||
|
// TODO: Figure out how to change UART settings and make this method public
|
||||||
|
|
||||||
|
let cmd = match rate {
|
||||||
|
BaudRate::BR2400 => "SB,0\n",
|
||||||
|
BaudRate::BR9600 => "SB,1\n",
|
||||||
|
BaudRate::BR19200 => "SB,2\n",
|
||||||
|
BaudRate::BR38400 => "SB,3\n",
|
||||||
|
BaudRate::BR115200 => "SB,4\n",
|
||||||
|
BaudRate::BR230400 => "SB,5\n",
|
||||||
|
BaudRate::BR460800 => "SB,6\n",
|
||||||
|
BaudRate::BR921600 => "SB,7\n",
|
||||||
|
};
|
||||||
|
self.link.write_str(cmd).map_err(|_| ())?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user