remove unused dependencies
This commit is contained in:
parent
76b9be6d93
commit
31332d220e
34
Cargo.lock
generated
34
Cargo.lock
generated
@ -200,6 +200,17 @@ dependencies = [
|
||||
"cortex-m 0.7.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derivative"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_miniconf"
|
||||
version = "0.1.0"
|
||||
@ -537,6 +548,27 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066"
|
||||
dependencies = [
|
||||
"derivative",
|
||||
"num_enum_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum_derive"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "panic-semihosting"
|
||||
version = "0.5.6"
|
||||
@ -752,13 +784,13 @@ dependencies = [
|
||||
"dsp",
|
||||
"embedded-hal",
|
||||
"enum-iterator",
|
||||
"generic-array 0.14.4",
|
||||
"heapless 0.6.1",
|
||||
"log",
|
||||
"mcp23017",
|
||||
"miniconf",
|
||||
"minimq",
|
||||
"nb 1.0.0",
|
||||
"num_enum",
|
||||
"panic-semihosting",
|
||||
"paste",
|
||||
"serde",
|
||||
|
@ -39,11 +39,10 @@ cortex-m-rtic = "0.5.6"
|
||||
embedded-hal = "0.2.4"
|
||||
nb = "1.0.0"
|
||||
asm-delay = "0.9.0"
|
||||
enum-iterator = "0.6.0"
|
||||
num_enum = { version = "0.5.1", default-features = false }
|
||||
paste = "1"
|
||||
dsp = { path = "dsp" }
|
||||
ad9959 = { path = "ad9959" }
|
||||
generic-array = "0.14"
|
||||
miniconf = "0.1.0"
|
||||
shared-bus = {version = "0.2.2", features = ["cortex-m"] }
|
||||
serde-json-core = "0.3"
|
||||
|
@ -2,11 +2,12 @@ use miniconf::Miniconf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use core::convert::TryFrom;
|
||||
use enum_iterator::IntoEnumIterator;
|
||||
use num_enum::TryFromPrimitive;
|
||||
|
||||
#[derive(
|
||||
Copy, Clone, Debug, Serialize, Deserialize, IntoEnumIterator, Miniconf,
|
||||
Copy, Clone, Debug, Serialize, Deserialize, TryFromPrimitive, Miniconf,
|
||||
)]
|
||||
#[repr(u8)]
|
||||
pub enum Gain {
|
||||
G1 = 0b00,
|
||||
G2 = 0b01,
|
||||
@ -32,20 +33,6 @@ impl Gain {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<u8> for Gain {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(value: u8) -> Result<Self, Self::Error> {
|
||||
for gain in Gain::into_enum_iter() {
|
||||
if value == gain as u8 {
|
||||
return Ok(gain);
|
||||
}
|
||||
}
|
||||
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<A0, A1> ProgrammableGainAmplifier<A0, A1>
|
||||
where
|
||||
A0: embedded_hal::digital::v2::StatefulOutputPin,
|
||||
@ -82,7 +69,7 @@ where
|
||||
}
|
||||
|
||||
/// Get the programmed gain of the analog front-end.
|
||||
pub fn get_gain(&self) -> Result<Gain, ()> {
|
||||
pub fn get_gain(&self) -> Gain {
|
||||
let mut code: u8 = 0;
|
||||
if self.a0.is_set_high().unwrap() {
|
||||
code |= 0b1;
|
||||
@ -91,6 +78,7 @@ where
|
||||
code |= 0b10;
|
||||
}
|
||||
|
||||
Gain::try_from(code)
|
||||
// NOTE(unwrap): All possibilities covered.
|
||||
Gain::try_from(code).unwrap()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user