Merge branch 'master' into feature/digital-input-stamp

This commit is contained in:
Ryan Summers 2020-12-07 16:14:16 +01:00
commit bdd3322dcb
3 changed files with 19 additions and 22 deletions

20
Cargo.lock generated
View File

@ -178,9 +178,9 @@ dependencies = [
[[package]]
name = "cortex-m-semihosting"
version = "0.3.5"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "113ef0ecffee2b62b58f9380f4469099b30e9f9cbee2804771b4203ba1762cfa"
checksum = "6bffa6c1454368a6aa4811ae60964c38e6996d397ff8095a8b9211b1c1f749bc"
dependencies = [
"cortex-m",
]
@ -390,9 +390,9 @@ checksum = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f"
[[package]]
name = "rtic-core"
version = "0.3.0"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab51fe832317e805f869b3d859f91aadf855c2c3da51f9b84bc645c201597158"
checksum = "8bd58a6949de8ff797a346a28d9f13f7b8f54fa61bb5e3cb0985a4efb497a5ef"
[[package]]
name = "rtic-syntax"
@ -431,9 +431,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.117"
version = "1.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a"
checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800"
dependencies = [
"serde_derive",
]
@ -450,9 +450,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.117"
version = "1.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df"
dependencies = [
"proc-macro2",
"quote",
@ -534,9 +534,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.48"
version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
checksum = "8833e20724c24de12bbaba5ad230ea61c3eafb05b881c7c9d3cfe8638b187e68"
dependencies = [
"proc-macro2",
"quote",

View File

@ -18,7 +18,6 @@ exclude = [
]
[badges]
travis-ci = { repository = "quartiq/stabilizer", branch = "master" }
maintenance = { status = "experimental" }
[package.metadata.docs.rs]
@ -42,6 +41,7 @@ asm-delay = "0.9.0"
enum-iterator = "0.6.0"
paste = "1"
dsp = { path = "dsp" }
ad9959 = { path = "ad9959" }
[dependencies.mcp23017]
git = "https://github.com/mrd0ll4r/mcp23017.git"
@ -51,9 +51,6 @@ version = "0.6"
features = ["ethernet", "proto-ipv4", "socket-tcp", "proto-ipv6"]
default-features = false
[dependencies.ad9959]
path = "ad9959"
[dependencies.stm32h7xx-hal]
features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"]
git = "https://github.com/stm32-rs/stm32h7xx-hal"

View File

@ -18,14 +18,14 @@ pub fn overflowing_sub(y: i32, x: i32) -> (i32, i8) {
/// Overflow unwrapper.
///
/// This is unwrapping as in the phase unwrapping context, not unwrapping as
/// in the `Result`/`Option` context.
/// This is unwrapping as in the phase and overflow unwrapping context, not
/// unwrapping as in the `Result`/`Option` context.
#[derive(Copy, Clone, Default, Deserialize, Serialize)]
pub struct Unwrapper {
// last input
x: i32,
// last wraps
v: i32,
w: i32,
}
impl Unwrapper {
@ -35,13 +35,13 @@ impl Unwrapper {
/// * `x`: New sample
///
/// Returns:
/// A tuple containing the (wrapped) difference `x - x_old` and the signed
/// number of wraps accumulated by `x`.
/// A tuple containing the (wrapped) difference `x - x_old` and the
/// signed number of wraps accumulated by the new sample.
pub fn update(&mut self, x: i32) -> (i32, i32) {
let (dx, v) = overflowing_sub(x, self.x);
let (dx, dw) = overflowing_sub(x, self.x);
self.x = x;
self.v = self.v.saturating_add(v as i32);
(dx, self.v)
self.w = self.w.wrapping_add(dw as i32);
(dx, self.w)
}
}