Merge remote-tracking branch 'origin/master' into rj/itcm

* origin/master:
  deps: fix rtt-logger->rtt-target, cleanup, bump cortex-m
  build(deps): bump embedded-hal from 0.2.4 to 0.2.5
  Bump rtt-target from 0.2.2 to 0.3.1
  Bump serde from 1.0.125 to 1.0.126
  remove unused dependencies
  remove unused dependencies
This commit is contained in:
Robert Jördens 2021-05-14 08:18:33 +02:00
commit bd8b3cd6f3
6 changed files with 61 additions and 50 deletions

67
Cargo.lock generated
View File

@ -183,6 +183,17 @@ dependencies = [
"syn",
]
[[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"
@ -198,7 +209,6 @@ name = "dsp"
version = "0.1.0"
dependencies = [
"easybench",
"libm",
"miniconf",
"ndarray",
"num",
@ -223,9 +233,9 @@ dependencies = [
[[package]]
name = "embedded-hal"
version = "0.2.4"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa998ce59ec9765d15216393af37a58961ddcefb14c753b4816ba2191d865fcb"
checksum = "db184d3fa27bc7a2344250394c0264144dfe0bc81a4401801dcb964b8dd172ad"
dependencies = [
"nb 0.1.3",
"void",
@ -357,12 +367,6 @@ version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
[[package]]
name = "libm"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
[[package]]
name = "log"
version = "0.4.14"
@ -520,6 +524,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 = "paste"
version = "1.0.5"
@ -615,9 +640,8 @@ dependencies = [
[[package]]
name = "rtt-logger"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d082d3a20a5d4f69ad509720de1777fe5aa2092ea1af51b254ff79113d46d2ea"
version = "0.1.1"
source = "git+https://github.com/quartiq/rtt-logger.git?rev=70b0eb5#70b0eb587fa43902aaf58296fe866418a1f4e920"
dependencies = [
"log",
"rtt-target",
@ -625,11 +649,11 @@ dependencies = [
[[package]]
name = "rtt-target"
version = "0.2.2"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0869b4c5b6a6d8c5583fc473f9eb3423a170f77626b8c8a7fb18eddcda5770e2"
checksum = "065d6058bb1204f51a562a67209e1817cf714759d5cf845aa45c75fa7b0b9d9b"
dependencies = [
"cortex-m 0.6.7",
"cortex-m 0.7.2",
"ufmt-write",
]
@ -665,9 +689,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.125"
version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
dependencies = [
"serde_derive",
]
@ -685,9 +709,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.125"
version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
dependencies = [
"proc-macro2",
"quote",
@ -733,19 +757,18 @@ dependencies = [
"ad9959",
"asm-delay",
"cc",
"cortex-m 0.6.7",
"cortex-m 0.7.2",
"cortex-m-rt",
"cortex-m-rtic",
"dsp",
"embedded-hal",
"enum-iterator",
"generic-array 0.14.4",
"heapless 0.6.1",
"log",
"mcp23017",
"miniconf",
"minimq",
"nb 1.0.0",
"num_enum",
"paste",
"rtt-logger",
"rtt-target",

View File

@ -28,26 +28,28 @@ default-target = "thumbv7em-none-eabihf"
members = ["ad9959", "dsp"]
[dependencies]
cortex-m = { version = "0.6", features = ["const-fn"] }
cortex-m = { version = "0.7" }
cortex-m-rt = { version = "0.6", features = ["device"] }
log = { version = "0.4", features = ["max_level_trace", "release_max_level_info"] }
rtt-target = { version = "0.2.1", features = ["cortex-m"] }
rtt-logger = { version = "0.1" }
rtt-target = { version = "0.3", features = ["cortex-m"] }
serde = { version = "1.0", features = ["derive"], default-features = false }
heapless = { version = "0.6", features = ["serde"] }
cortex-m-rtic = "0.5.6"
embedded-hal = "0.2.4"
embedded-hal = "0.2.5"
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"
[dependencies.rtt-logger]
git = "https://github.com/quartiq/rtt-logger.git"
rev = "70b0eb5"
[dependencies.mcp23017]
git = "https://github.com/mrd0ll4r/mcp23017.git"
rev = "61933f857a"
@ -76,7 +78,6 @@ git = "https://github.com/quartiq/minimq.git"
rev = "d2ec3e8"
[features]
bkpt = [ ]
nightly = ["cortex-m/inline-asm", "dsp/nightly"]
pounder_v1_1 = [ ]

View File

@ -7,5 +7,5 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
embedded-hal = {version = "0.2.3", features = ["unproven"]}
embedded-hal = {version = "0.2.5", features = ["unproven"]}
bit_field = "0.10.0"

View File

@ -5,7 +5,6 @@ authors = ["Robert Jördens <rj@quartiq.de>"]
edition = "2018"
[dependencies]
libm = "0.2.1"
serde = { version = "1.0", features = ["derive"], default-features = false }
num = { version = "0.4.0", default-features = false }
miniconf = "0.1"

View File

@ -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()
}
}

View File

@ -153,7 +153,7 @@ pub fn setup(
use rtt_logger::RTTLogger;
static LOGGER: RTTLogger = RTTLogger::new(log::LevelFilter::Info);
rtt_target::rtt_init_print!(NoBlockSkip, 1024);
rtt_target::rtt_init_print!();
log::set_logger(&LOGGER)
.map(|()| log::set_max_level(log::LevelFilter::Trace))
.unwrap();