Merge branch 'master' into new-pac
* master: python configuration tool json command interface use serde-json-core [wip] README: try SVG again add Nix build files png README: diagram and photo
This commit is contained in:
commit
d6b37e6c0e
248
Cargo.lock
generated
248
Cargo.lock
generated
@ -30,30 +30,14 @@ name = "bitflags"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "built"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.7"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -90,10 +74,10 @@ name = "cortex-m-rt-macros"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.12 (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.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -104,6 +88,14 @@ dependencies = [
|
||||
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.11.1"
|
||||
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 = "generic-array"
|
||||
version = "0.12.0"
|
||||
@ -113,52 +105,30 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.7.5"
|
||||
name = "hash32"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.5"
|
||||
name = "heapless"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"generic-array 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hash32 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.53"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.7.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
name = "lexical-core"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -166,7 +136,7 @@ name = "log"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -174,11 +144,6 @@ name = "managed"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "panic-abort"
|
||||
version = "0.3.1"
|
||||
@ -193,19 +158,9 @@ dependencies = [
|
||||
"cortex-m-semihosting 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.4.28"
|
||||
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)",
|
||||
@ -216,7 +171,7 @@ name = "quote"
|
||||
version = "0.6.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -245,11 +200,6 @@ name = "rand_core"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
@ -258,6 +208,11 @@ dependencies = [
|
||||
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
@ -273,13 +228,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.90"
|
||||
version = "1.0.91"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "0.6.9"
|
||||
name = "serde-json-core"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"heapless 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lexical-core 0.4.0",
|
||||
"serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.91"
|
||||
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.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smoltcp"
|
||||
@ -295,13 +267,15 @@ dependencies = [
|
||||
name = "stabilizer"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m-log 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cortex-m-rt 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapless 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"panic-semihosting 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde-json-core 0.0.1",
|
||||
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"stm32h7 0.7.0",
|
||||
]
|
||||
@ -311,6 +285,11 @@ name = "stable_deref_trait"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "stm32h7"
|
||||
version = "0.7.0"
|
||||
@ -323,78 +302,29 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.33"
|
||||
version = "0.15.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.12 (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 = "time"
|
||||
version = "0.1.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.90 (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-bidi"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"smallvec 0.6.9 (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 = "url"
|
||||
version = "1.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"percent-encoding 1.0.1 (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 = "vcpkg"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "volatile-register"
|
||||
version = "0.2.0"
|
||||
@ -403,77 +333,43 @@ dependencies = [
|
||||
"vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "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 as-slice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "293dac66b274fab06f95e7efb05ec439a6b70136081ea522d270bc351ae5bb27"
|
||||
"checksum bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a3caf393d93b2d453e80638d0674597020cef3382ada454faacd43d1a55a735a"
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61f5aae2fa15b68fbcf0cbab64e659a55d10e9bacc55d3470ef77ae73030d755"
|
||||
"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"
|
||||
"checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83"
|
||||
"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4"
|
||||
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
|
||||
"checksum cortex-m 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3c18719fdc57db65668bfc977db9a0fa1a41d718c5d9cd4f652c9d4b0e0956a"
|
||||
"checksum cortex-m-log 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "584a62cf37ddd834b8bfc21317bf3396915844298bf346dd1f4ca0572180ac7f"
|
||||
"checksum cortex-m-rt 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7e1ccc9052352415ec4e3f762f4541098d012016f9354a1a5b2dede39b67f426"
|
||||
"checksum cortex-m-rt-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d7ae692573e0acccb1579fef1abf5a5bf1d2f3f0149a22b16870ec9309aee25f"
|
||||
"checksum cortex-m-semihosting 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "165f3f86f4d1031351a6c9dc8d5a3f8fae2050f9dd6ef925e3d675c232cc0e46"
|
||||
"checksum generic-array 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8107dafa78c80c848b71b60133954b4a58609a3a1a5f9af037ecc7f67280f369"
|
||||
"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592"
|
||||
"checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71"
|
||||
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
|
||||
"checksum libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)" = "ec350a9417dfd244dc9a6c4a71e13895a4db6b92f0b106f07ebbc3f3bc580cee"
|
||||
"checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1"
|
||||
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
|
||||
"checksum hash32 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12d790435639c06a7b798af9e1e331ae245b7ef915b92f70a39b4cf8c00686af"
|
||||
"checksum heapless 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e1ae80bbc62401ae8096976857172507cadbd2200f36670e5144634360a05959"
|
||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||
"checksum managed 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6"
|
||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
"checksum panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2c14a66511ed17b6a8b4256b868d7fd207836d891db15eea5195dbcaf87e630f"
|
||||
"checksum panic-semihosting 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "97cfb37c1d3b5f0cc18bf14485018cccd13bdd24f7b5bfd456c1d8760afef824"
|
||||
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
||||
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
|
||||
"checksum proc-macro2 0.4.28 (registry+https://github.com/rust-lang/crates.io-index)" = "ba92c84f814b3f9a44c5cfca7d2ad77fa10710867d2bbb1b3d175ab5f47daa12"
|
||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||
"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
|
||||
"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.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"
|
||||
"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f"
|
||||
"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 serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4"
|
||||
"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"
|
||||
"checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd"
|
||||
"checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f"
|
||||
"checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
"checksum syn 0.15.33 (registry+https://github.com/rust-lang/crates.io-index)" = "ec52cd796e5f01d0067225a5392e70084acc4c0013fa71d55166d38a8b307836"
|
||||
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
||||
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
||||
"checksum static_assertions 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c19be23126415861cb3a23e501d34a708f7f9b2183c5252d690941c2e69199d5"
|
||||
"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe"
|
||||
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
||||
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||
"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
|
||||
"checksum vcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45c297f0afb6928cd08ab1ff9d95e99392595ea25ae1b5ecf822ff8764e57a0d"
|
||||
"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d"
|
||||
"checksum volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286"
|
||||
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
10
Cargo.toml
10
Cargo.toml
@ -33,6 +33,13 @@ cortex-m-log = { version = "0.5", features = ["log-integration"] }
|
||||
log = "0.4"
|
||||
panic-abort = "0.3"
|
||||
panic-semihosting = { version = "0.5.2", optional = true }
|
||||
serde-json-core = { version = "0.0" }
|
||||
serde = { version = "1.0", features = ["derive"], default-features = false }
|
||||
heapless = { version = "0.4" }
|
||||
|
||||
[patch.crates-io]
|
||||
serde-json-core = { path = "../serde-json-core" }
|
||||
lexical-core = { path = "../rust-lexical/lexical-core" }
|
||||
|
||||
[dependencies.stm32h7]
|
||||
path = "../stm32-rs/stm32h7"
|
||||
@ -49,9 +56,6 @@ default-features = false
|
||||
semihosting = ["panic-semihosting", "cortex-m-log/semihosting"]
|
||||
bkpt = [ ]
|
||||
|
||||
[build-dependencies]
|
||||
built = "0.3"
|
||||
|
||||
[profile.dev]
|
||||
codegen-units = 1
|
||||
incremental = false
|
||||
|
@ -1,5 +1,9 @@
|
||||
# Stabilizer Firmware
|
||||
|
||||
![Flow diagram](stabilizer_pid.svg)
|
||||
|
||||
![Hardware](https://github.com/sinara-hw/Stabilizer/wiki/Stabilizer_v1.0_top_small.jpg)
|
||||
|
||||
## Features
|
||||
|
||||
* dual channel
|
||||
|
19
build.rs
19
build.rs
@ -1,19 +0,0 @@
|
||||
extern crate built;
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// Gather build information
|
||||
built::write_built_file().expect("Failed to acquire build-time information");
|
||||
|
||||
// Put the linker script somewhere the linker can find it
|
||||
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());
|
||||
}
|
32
default.nix
Normal file
32
default.nix
Normal file
@ -0,0 +1,32 @@
|
||||
{ # Use master branch of the overlay by default
|
||||
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
|
||||
rustManifest ? builtins.fetchurl "https://static.rust-lang.org/dist/channel-rust-nightly.toml"
|
||||
}:
|
||||
|
||||
let
|
||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
||||
in
|
||||
with pkgs;
|
||||
let
|
||||
rustPlatform = recurseIntoAttrs (callPackage ./nix/rustPlatform.nix {
|
||||
inherit rustManifest;
|
||||
});
|
||||
stabilizer = callPackage ./nix/stabilizer.nix { inherit rustPlatform; };
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "stabilizer-dist";
|
||||
buildInputs = [ stabilizer ];
|
||||
src = ./.;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase =
|
||||
let
|
||||
firmwareBinary = "$out/lib/stabilizer.elf";
|
||||
in ''
|
||||
mkdir -p $out/bin $out/lib $out/nix-support
|
||||
|
||||
ln -s ${stabilizer}/lib/stabilizer ${firmwareBinary}
|
||||
|
||||
echo file binary-dist ${firmwareBinary} >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
}
|
11552
nix/channel-rust-nightly.toml
Normal file
11552
nix/channel-rust-nightly.toml
Normal file
File diff suppressed because it is too large
Load Diff
49
nix/fetchcargo.nix
Normal file
49
nix/fetchcargo.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{ stdenv, cacert, git, cargo, cargo-vendor }:
|
||||
{ name, src, sha256 }:
|
||||
let
|
||||
# `src` restricted to the two files that define dependencies
|
||||
cargoOnlySrc = stdenv.mkDerivation {
|
||||
name = "${name}-cargo";
|
||||
inherit src;
|
||||
phases = "installPhase";
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp ${src}/Cargo.{toml,lock} $out/
|
||||
mkdir $out/src
|
||||
touch $out/src/main.rs
|
||||
'';
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "${name}-vendor";
|
||||
nativeBuildInputs = [ cacert git cargo cargo-vendor ];
|
||||
src = cargoOnlySrc;
|
||||
|
||||
phases = "unpackPhase patchPhase installPhase";
|
||||
|
||||
installPhase = ''
|
||||
if [[ ! -f Cargo.lock ]]; then
|
||||
echo
|
||||
echo "ERROR: The Cargo.lock file doesn't exist"
|
||||
echo
|
||||
echo "Cargo.lock is needed to make sure that cargoSha256 doesn't change"
|
||||
echo "when the registry is updated."
|
||||
echo
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
|
||||
cargo vendor
|
||||
|
||||
cp -ar vendor $out
|
||||
'';
|
||||
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = sha256;
|
||||
|
||||
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
|
||||
preferLocalBuild = true;
|
||||
}
|
23
nix/rustPlatform.nix
Normal file
23
nix/rustPlatform.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{ recurseIntoAttrs, stdenv, lib,
|
||||
makeRustPlatform,
|
||||
fetchurl, patchelf,
|
||||
rustManifest ? ./channel-rust-nightly.toml
|
||||
}:
|
||||
|
||||
let
|
||||
targets = [
|
||||
"thumbv7em-none-eabihf"
|
||||
];
|
||||
rustChannel =
|
||||
lib.rustLib.fromManifestFile rustManifest {
|
||||
inherit stdenv fetchurl patchelf;
|
||||
};
|
||||
rust =
|
||||
rustChannel.rust.override {
|
||||
inherit targets;
|
||||
};
|
||||
in
|
||||
makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
}
|
45
nix/stabilizer.nix
Normal file
45
nix/stabilizer.nix
Normal file
@ -0,0 +1,45 @@
|
||||
{ stdenv, rustPlatform, cacert, git, cargo-vendor }:
|
||||
|
||||
with rustPlatform;
|
||||
let
|
||||
sha256 = "1m4cxf6c4lh28xv4iagp20ni97cya1f12yg58q0m733qahk8gncb";
|
||||
fetchcargo = import ./fetchcargo.nix {
|
||||
inherit stdenv cacert git cargo-vendor;
|
||||
inherit (rust) cargo;
|
||||
};
|
||||
stabilizerDeps = fetchcargo {
|
||||
name = "stabilizer";
|
||||
src = ../.;
|
||||
inherit sha256;
|
||||
};
|
||||
in
|
||||
|
||||
buildRustPackage rec {
|
||||
name = "stabilizer";
|
||||
version = "0.0.0";
|
||||
|
||||
src = ../.;
|
||||
cargoSha256 = sha256;
|
||||
|
||||
buildInputs = [ stabilizerDeps ];
|
||||
patchPhase = ''
|
||||
cat >> .cargo/config <<EOF
|
||||
[source.crates-io]
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source.vendored-sources]
|
||||
directory = "${stabilizerDeps}"
|
||||
EOF
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
cargo build --release
|
||||
'';
|
||||
|
||||
doCheck = false;
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
cp target/thumbv7em-none-eabihf/release/stabilizer $out/lib/
|
||||
'';
|
||||
}
|
15
release.nix
Normal file
15
release.nix
Normal file
@ -0,0 +1,15 @@
|
||||
# For running on Hydra
|
||||
{ pkgs ? import <nixpkgs> {},
|
||||
rustManifest ? ./nix/channel-rust-nightly.toml
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
let
|
||||
stabilizer = callPackage ./default.nix {
|
||||
inherit rustManifest;
|
||||
mozillaOverlay = import <mozillaOverlay>;
|
||||
};
|
||||
in
|
||||
{
|
||||
build = lib.hydraJob stabilizer;
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
use core::ops::{Add, Mul};
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use core::f32;
|
||||
|
||||
pub type IIRState = [f32; 5];
|
||||
|
||||
#[derive(Copy,Clone)]
|
||||
#[derive(Copy,Clone,Deserialize,Serialize)]
|
||||
pub struct IIR {
|
||||
pub ba: IIRState,
|
||||
pub y_offset: f32,
|
||||
|
100
src/main.rs
100
src/main.rs
@ -14,14 +14,18 @@ extern crate log;
|
||||
|
||||
use core::ptr;
|
||||
use core::cell::RefCell;
|
||||
use core::fmt::Write;
|
||||
use core::sync::atomic::{AtomicU32, AtomicBool, Ordering};
|
||||
use core::fmt::Write;
|
||||
use cortex_m_rt::{entry, exception};
|
||||
use stm32h7::stm32h7x3::{self as stm32, Peripherals, CorePeripherals, interrupt};
|
||||
use cortex_m::interrupt::Mutex;
|
||||
use heapless::{String, Vec, consts::*};
|
||||
|
||||
use smoltcp as net;
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde_json_core::{ser::to_string, de::from_slice};
|
||||
|
||||
mod eth;
|
||||
|
||||
mod iir;
|
||||
@ -50,7 +54,7 @@ fn init_log() {
|
||||
// Pull in build information (from `built` crate)
|
||||
mod build_info {
|
||||
#![allow(dead_code)]
|
||||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||
// include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||
}
|
||||
|
||||
fn pwr_setup(pwr: &stm32::PWR) {
|
||||
@ -625,6 +629,7 @@ fn main() -> ! {
|
||||
let mut socket_set_entries: [_; 8] = Default::default();
|
||||
let mut sockets = net::socket::SocketSet::new(&mut socket_set_entries[..]);
|
||||
create_socket!(sockets, tcp_rx_storage0, tcp_tx_storage0, tcp_handle0);
|
||||
create_socket!(sockets, tcp_rx_storage0, tcp_tx_storage0, tcp_handle1);
|
||||
|
||||
unsafe { eth::enable_interrupt(&dp.ETHERNET_DMA); }
|
||||
unsafe { cp.NVIC.set_priority(stm32::Interrupt::ETH, 196); } // mid prio
|
||||
@ -645,16 +650,28 @@ fn main() -> ! {
|
||||
{
|
||||
let socket = &mut *sockets.get::<net::socket::TcpSocket>(tcp_handle0);
|
||||
if !(socket.is_open() || socket.is_listening()) {
|
||||
socket.listen(80).unwrap_or_else(|e| warn!("TCP listen error: {:?}", e));
|
||||
socket.listen(1234).unwrap_or_else(|e| warn!("TCP listen error: {:?}", e));
|
||||
} else if last != time && socket.can_send() {
|
||||
last = time;
|
||||
let (x0, y0, x1, y1) = unsafe {
|
||||
(IIR_STATE[0][0], IIR_STATE[0][2], IIR_STATE[1][0], IIR_STATE[1][2]) };
|
||||
writeln!(socket, "t={} x0={:.1} y0={:.1} x1={:.1} y1={:.1}",
|
||||
time, x0, y0, x1, y1)
|
||||
.unwrap_or_else(|e| warn!("TCP send error: {:?}", e));
|
||||
let s = unsafe { Status{
|
||||
t: time,
|
||||
x0: IIR_STATE[0][0],
|
||||
y0: IIR_STATE[0][2],
|
||||
x1: IIR_STATE[1][0],
|
||||
y1: IIR_STATE[1][2],
|
||||
}};
|
||||
send_response(socket, &s);
|
||||
}
|
||||
}
|
||||
{
|
||||
let socket = &mut *sockets.get::<net::socket::TcpSocket>(tcp_handle1);
|
||||
if !(socket.is_open() || socket.is_listening()) {
|
||||
socket.listen(1235).unwrap_or_else(|e| warn!("TCP listen error: {:?}", e));
|
||||
} else {
|
||||
handle_command(socket);
|
||||
}
|
||||
}
|
||||
|
||||
if !match iface.poll(&mut sockets, net::time::Instant::from_millis(time as i64)) {
|
||||
Ok(changed) => changed,
|
||||
Err(net::Error::Unrecognized) => true,
|
||||
@ -665,6 +682,73 @@ fn main() -> ! {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize,Serialize)]
|
||||
struct Request {
|
||||
channel: i8,
|
||||
iir: IIR,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct Response<'a> {
|
||||
code: i32,
|
||||
message: &'a str,
|
||||
}
|
||||
|
||||
fn send_response<T: Serialize>(socket: &mut net::socket::TcpSocket, msg: &T) {
|
||||
let mut u: String<U128> = to_string(msg).unwrap();
|
||||
u.push('\n').unwrap();
|
||||
socket.write_str(&u).unwrap();
|
||||
}
|
||||
|
||||
fn handle_command(socket: &mut net::socket::TcpSocket) {
|
||||
let mut data: Vec<u8, U256> = Vec::new();
|
||||
let mut discard: bool = false;
|
||||
while socket.can_recv() {
|
||||
if socket.recv(|buf| {
|
||||
let (len, found) = match buf.iter().position(|&c| c as char == '\n') {
|
||||
Some(end) => (end + 1, true),
|
||||
None => (buf.len(), false),
|
||||
};
|
||||
if data.len() + len >= data.capacity() {
|
||||
discard = true;
|
||||
data.clear();
|
||||
} else if !discard && len > 0 {
|
||||
data.extend_from_slice(&buf[..len - 1]).unwrap();
|
||||
}
|
||||
(len, found)
|
||||
}).unwrap() {
|
||||
let resp = if discard {
|
||||
discard = false;
|
||||
Response{ code: 500, message: "command buffer overflow" }
|
||||
} else {
|
||||
match from_slice::<Request>(&data) {
|
||||
Ok(request) => {
|
||||
cortex_m::interrupt::free(|_| {
|
||||
unsafe { IIR_CH[request.channel as usize] = request.iir; };
|
||||
});
|
||||
Response{ code: 200, message: "ok" }
|
||||
},
|
||||
Err(err) => {
|
||||
warn!("parse error {}", err);
|
||||
Response{ code: 550, message: "parse error" }
|
||||
},
|
||||
}
|
||||
};
|
||||
send_response(socket, &resp);
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct Status {
|
||||
t: u32,
|
||||
x0: f32,
|
||||
y0: f32,
|
||||
x1: f32,
|
||||
y1: f32
|
||||
}
|
||||
|
||||
const SCALE: f32 = ((1 << 15) - 1) as f32;
|
||||
static mut IIR_STATE: [IIRState; 2] = [[0.; 5]; 2];
|
||||
static mut IIR_CH: [IIR; 2] = [
|
||||
|
104
stabilizer.py
Normal file
104
stabilizer.py
Normal file
@ -0,0 +1,104 @@
|
||||
import json
|
||||
import asyncio
|
||||
from collections import OrderedDict
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class StabilizerError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class StabilizerConfig:
|
||||
async def connect(self, host, port=1235):
|
||||
self.reader, self.writer = await asyncio.open_connection(host, port)
|
||||
|
||||
async def set(self, channel, iir):
|
||||
up = OrderedDict([("channel", channel), ("iir", iir.as_dict())])
|
||||
s = json.dumps(up, separators=(",", ":"))
|
||||
assert "\n" not in s
|
||||
logger.debug("send %s", s)
|
||||
self.writer.write(s.encode() + b"\n")
|
||||
r = (await self.reader.readline()).decode()
|
||||
logger.debug("recv %s", r)
|
||||
ret = json.loads(r, object_pairs_hook=OrderedDict)
|
||||
if ret["code"] != 200:
|
||||
raise StabilizerError(ret)
|
||||
return ret
|
||||
|
||||
|
||||
class IIR:
|
||||
t_update = 2e-6
|
||||
|
||||
def __init__(self):
|
||||
self.ba = np.zeros(5, np.float32)
|
||||
self.y_offset = 0.
|
||||
self.y_min = -float(1 << 15)
|
||||
self.y_max = float(1 << 15) - 1
|
||||
|
||||
def as_dict(self):
|
||||
iir = OrderedDict()
|
||||
iir["ba"] = [float(_) for _ in self.ba]
|
||||
iir["y_offset"] = self.y_offset
|
||||
iir["y_min"] = self.y_min
|
||||
iir["y_max"] = self.y_max
|
||||
return iir
|
||||
|
||||
def configure_pi(self, kp, ki, g=0.):
|
||||
ki = np.copysign(ki, kp)*self.t_update*2
|
||||
g = np.copysign(g, kp)
|
||||
eps = np.finfo(np.float32).eps
|
||||
if abs(ki) < eps:
|
||||
a1, b0, b1 = 0., kp, 0.
|
||||
else:
|
||||
if abs(g) < eps:
|
||||
c = 1.
|
||||
else:
|
||||
c = 1./(1. + ki/g)
|
||||
a1 = 2*c - 1.
|
||||
b0 = ki*c + kp
|
||||
b1 = ki*c - a1*kp
|
||||
if abs(b0 + b1) < eps:
|
||||
raise ValueError("low integrator gain and/or gain limit")
|
||||
self.ba[0] = b0
|
||||
self.ba[1] = b1
|
||||
self.ba[2] = 0.
|
||||
self.ba[3] = a1
|
||||
self.ba[4] = 0.
|
||||
|
||||
def set_x_offset(self, o):
|
||||
b = self.ba[:3].sum()
|
||||
self.y_offset = b*o
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument("-s", "--stabilizer", default="10.0.16.99")
|
||||
p.add_argument("-c", "--channel", default=0, type=int,
|
||||
help="Stabilizer channel to configure")
|
||||
p.add_argument("-o", "--offset", default=0., type=float,
|
||||
help="X offset, in ADC LSB")
|
||||
p.add_argument("-p", "--proportional-gain", default=1., type=float,
|
||||
help="Proportional gain, in DAC LSB/ADC LSB")
|
||||
p.add_argument("-i", "--integral-gain", default=0., type=float,
|
||||
help="Integral gain, in DAC LSB/(ADC LSB*s)")
|
||||
|
||||
args = p.parse_args()
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
# loop.set_debug(True)
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
async def main():
|
||||
i = IIR()
|
||||
i.configure_pi(args.proportional_gain, args.integral_gain)
|
||||
i.set_x_offset(args.offset)
|
||||
s = StabilizerConfig()
|
||||
await s.connect(args.stabilizer)
|
||||
r = await s.set(0, i)
|
||||
|
||||
loop.run_until_complete(main())
|
BIN
stabilizer_pid.png
Normal file
BIN
stabilizer_pid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
2
stabilizer_pid.svg
Normal file
2
stabilizer_pid.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 21 KiB |
Loading…
Reference in New Issue
Block a user