Merge #362
362: rj/visibility cleanup r=jordens a=jordens - dsp: reduce num dependency - clean up item visibility Co-authored-by: Robert Jördens <rj@quartiq.de>
This commit is contained in:
commit
57524c7740
38
Cargo.lock
generated
38
Cargo.lock
generated
@ -214,7 +214,7 @@ dependencies = [
|
|||||||
"easybench",
|
"easybench",
|
||||||
"miniconf",
|
"miniconf",
|
||||||
"ndarray",
|
"ndarray",
|
||||||
"num",
|
"num-complex",
|
||||||
"rand",
|
"rand",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@ -472,19 +472,6 @@ version = "0.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1bcece43b12349917e096cddfa66107277f123e6c96a5aea78711dc601a47152"
|
checksum = "1bcece43b12349917e096cddfa66107277f123e6c96a5aea78711dc601a47152"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606"
|
|
||||||
dependencies = [
|
|
||||||
"num-complex",
|
|
||||||
"num-integer",
|
|
||||||
"num-iter",
|
|
||||||
"num-rational",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-complex"
|
name = "num-complex"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@ -492,6 +479,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
|
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -504,28 +492,6 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-iter"
|
|
||||||
version = "0.1.42"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-rational"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0", features = ["derive"], default-features = false }
|
serde = { version = "1.0", features = ["derive"], default-features = false }
|
||||||
num = { version = "0.4.0", default-features = false }
|
num-complex = { version = "0.4.0", features = ["serde"], default-features = false }
|
||||||
miniconf = "0.1"
|
miniconf = "0.1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
pub use num::Complex;
|
pub use num_complex::Complex;
|
||||||
|
|
||||||
use super::{atan2, cossin};
|
use super::{atan2, cossin};
|
||||||
|
|
||||||
|
@ -4,19 +4,27 @@
|
|||||||
|
|
||||||
use core::sync::atomic::{fence, Ordering};
|
use core::sync::atomic::{fence, Ordering};
|
||||||
|
|
||||||
use stabilizer::{flatten_closures, hardware, net};
|
|
||||||
|
|
||||||
use miniconf::Miniconf;
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
use dsp::iir;
|
use dsp::iir;
|
||||||
use hardware::{
|
use stabilizer::{
|
||||||
Adc0Input, Adc1Input, AdcCode, AfeGain, Dac0Output, Dac1Output, DacCode,
|
flatten_closures,
|
||||||
DigitalInput0, DigitalInput1, InputPin, SystemTimer, AFE0, AFE1,
|
hardware::{
|
||||||
|
self,
|
||||||
|
adc::{Adc0Input, Adc1Input, AdcCode},
|
||||||
|
afe::Gain,
|
||||||
|
dac::{Dac0Output, Dac1Output, DacCode},
|
||||||
|
embedded_hal::digital::v2::InputPin,
|
||||||
|
hal,
|
||||||
|
system_timer::SystemTimer,
|
||||||
|
DigitalInput0, DigitalInput1, AFE0, AFE1,
|
||||||
|
},
|
||||||
|
net::{
|
||||||
|
miniconf::Miniconf,
|
||||||
|
serde::Deserialize,
|
||||||
|
telemetry::{Telemetry, TelemetryBuffer},
|
||||||
|
NetworkState, NetworkUsers,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use net::{NetworkState, NetworkUsers, Telemetry, TelemetryBuffer};
|
|
||||||
|
|
||||||
const SCALE: f32 = i16::MAX as _;
|
const SCALE: f32 = i16::MAX as _;
|
||||||
|
|
||||||
// The number of cascaded IIR biquads per channel. Select 1 or 2!
|
// The number of cascaded IIR biquads per channel. Select 1 or 2!
|
||||||
@ -24,7 +32,7 @@ const IIR_CASCADE_LENGTH: usize = 1;
|
|||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Miniconf)]
|
#[derive(Clone, Copy, Debug, Deserialize, Miniconf)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
afe: [AfeGain; 2],
|
afe: [Gain; 2],
|
||||||
iir_ch: [[iir::IIR; IIR_CASCADE_LENGTH]; 2],
|
iir_ch: [[iir::IIR; IIR_CASCADE_LENGTH]; 2],
|
||||||
allow_hold: bool,
|
allow_hold: bool,
|
||||||
force_hold: bool,
|
force_hold: bool,
|
||||||
@ -35,7 +43,7 @@ impl Default for Settings {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
// Analog frontend programmable gain amplifier gains (G1, G2, G5, G10)
|
// Analog frontend programmable gain amplifier gains (G1, G2, G5, G10)
|
||||||
afe: [AfeGain::G1, AfeGain::G1],
|
afe: [Gain::G1, Gain::G1],
|
||||||
// IIR filter tap gains are an array `[b0, b1, b2, a1, a2]` such that the
|
// IIR filter tap gains are an array `[b0, b1, b2, a1, a2]` such that the
|
||||||
// new output is computed as `y0 = a1*y1 + a2*y2 + b0*x0 + b1*x1 + b2*x2`.
|
// new output is computed as `y0 = a1*y1 + a2*y2 + b0*x0 + b1*x1 + b2*x2`.
|
||||||
// The array is `iir_state[channel-index][cascade-index][coeff-index]`.
|
// The array is `iir_state[channel-index][cascade-index][coeff-index]`.
|
||||||
@ -52,7 +60,7 @@ impl Default for Settings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rtic::app(device = stm32h7xx_hal::stm32, peripherals = true, monotonic = stabilizer::hardware::SystemTimer)]
|
#[rtic::app(device = stabilizer::hardware::hal::stm32, peripherals = true, monotonic = stabilizer::hardware::system_timer::SystemTimer)]
|
||||||
const APP: () = {
|
const APP: () = {
|
||||||
struct Resources {
|
struct Resources {
|
||||||
afes: (AFE0, AFE1),
|
afes: (AFE0, AFE1),
|
||||||
@ -71,7 +79,8 @@ const APP: () = {
|
|||||||
#[init(spawn=[telemetry, settings_update])]
|
#[init(spawn=[telemetry, settings_update])]
|
||||||
fn init(c: init::Context) -> init::LateResources {
|
fn init(c: init::Context) -> init::LateResources {
|
||||||
// Configure the microcontroller
|
// Configure the microcontroller
|
||||||
let (mut stabilizer, _pounder) = hardware::setup(c.core, c.device);
|
let (mut stabilizer, _pounder) =
|
||||||
|
hardware::setup::setup(c.core, c.device);
|
||||||
|
|
||||||
let network = NetworkUsers::new(
|
let network = NetworkUsers::new(
|
||||||
stabilizer.net.stack,
|
stabilizer.net.stack,
|
||||||
@ -100,7 +109,7 @@ const APP: () = {
|
|||||||
dacs: stabilizer.dacs,
|
dacs: stabilizer.dacs,
|
||||||
network,
|
network,
|
||||||
digital_inputs: stabilizer.digital_inputs,
|
digital_inputs: stabilizer.digital_inputs,
|
||||||
telemetry: net::TelemetryBuffer::default(),
|
telemetry: TelemetryBuffer::default(),
|
||||||
settings: Settings::default(),
|
settings: Settings::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,7 +242,7 @@ const APP: () = {
|
|||||||
|
|
||||||
#[task(binds = ETH, priority = 1)]
|
#[task(binds = ETH, priority = 1)]
|
||||||
fn eth(_: eth::Context) {
|
fn eth(_: eth::Context) {
|
||||||
unsafe { stm32h7xx_hal::ethernet::interrupt_handler() }
|
unsafe { hal::ethernet::interrupt_handler() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task(binds = SPI2, priority = 3)]
|
#[task(binds = SPI2, priority = 3)]
|
||||||
|
@ -4,23 +4,29 @@
|
|||||||
|
|
||||||
use core::sync::atomic::{fence, Ordering};
|
use core::sync::atomic::{fence, Ordering};
|
||||||
|
|
||||||
use embedded_hal::digital::v2::InputPin;
|
|
||||||
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
use dsp::{Accu, Complex, ComplexExt, Lockin, RPLL};
|
use dsp::{Accu, Complex, ComplexExt, Lockin, RPLL};
|
||||||
|
use stabilizer::{
|
||||||
use stabilizer::{flatten_closures, hardware, net};
|
flatten_closures,
|
||||||
|
hardware::{
|
||||||
use hardware::{
|
self,
|
||||||
design_parameters, setup, Adc0Input, Adc1Input, AdcCode, AfeGain,
|
adc::{Adc0Input, Adc1Input, AdcCode},
|
||||||
Dac0Output, Dac1Output, DacCode, DigitalInput0, DigitalInput1,
|
afe::Gain,
|
||||||
InputStamper, SystemTimer, AFE0, AFE1,
|
dac::{Dac0Output, Dac1Output, DacCode},
|
||||||
|
design_parameters,
|
||||||
|
embedded_hal::digital::v2::InputPin,
|
||||||
|
hal,
|
||||||
|
input_stamper::InputStamper,
|
||||||
|
system_timer::SystemTimer,
|
||||||
|
DigitalInput0, DigitalInput1, AFE0, AFE1,
|
||||||
|
},
|
||||||
|
net::{
|
||||||
|
miniconf::Miniconf,
|
||||||
|
serde::Deserialize,
|
||||||
|
telemetry::{Telemetry, TelemetryBuffer},
|
||||||
|
NetworkState, NetworkUsers,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
use miniconf::Miniconf;
|
|
||||||
use net::{NetworkState, NetworkUsers, Telemetry, TelemetryBuffer};
|
|
||||||
|
|
||||||
// A constant sinusoid to send on the DAC output.
|
// A constant sinusoid to send on the DAC output.
|
||||||
// Full-scale gives a +/- 10.24V amplitude waveform. Scale it down to give +/- 1V.
|
// Full-scale gives a +/- 10.24V amplitude waveform. Scale it down to give +/- 1V.
|
||||||
const ONE: i16 = ((1.0 / 10.24) * i16::MAX as f32) as _;
|
const ONE: i16 = ((1.0 / 10.24) * i16::MAX as f32) as _;
|
||||||
@ -47,7 +53,7 @@ enum LockinMode {
|
|||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Deserialize, Miniconf)]
|
#[derive(Copy, Clone, Debug, Deserialize, Miniconf)]
|
||||||
pub struct Settings {
|
pub struct Settings {
|
||||||
afe: [AfeGain; 2],
|
afe: [Gain; 2],
|
||||||
lockin_mode: LockinMode,
|
lockin_mode: LockinMode,
|
||||||
|
|
||||||
pll_tc: [u8; 2],
|
pll_tc: [u8; 2],
|
||||||
@ -63,7 +69,7 @@ pub struct Settings {
|
|||||||
impl Default for Settings {
|
impl Default for Settings {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
afe: [AfeGain::G1; 2],
|
afe: [Gain::G1; 2],
|
||||||
|
|
||||||
lockin_mode: LockinMode::External,
|
lockin_mode: LockinMode::External,
|
||||||
|
|
||||||
@ -80,7 +86,7 @@ impl Default for Settings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rtic::app(device = stm32h7xx_hal::stm32, peripherals = true, monotonic = stabilizer::hardware::SystemTimer)]
|
#[rtic::app(device = stabilizer::hardware::hal::stm32, peripherals = true, monotonic = stabilizer::hardware::system_timer::SystemTimer)]
|
||||||
const APP: () = {
|
const APP: () = {
|
||||||
struct Resources {
|
struct Resources {
|
||||||
afes: (AFE0, AFE1),
|
afes: (AFE0, AFE1),
|
||||||
@ -99,7 +105,8 @@ const APP: () = {
|
|||||||
#[init(spawn=[settings_update, telemetry])]
|
#[init(spawn=[settings_update, telemetry])]
|
||||||
fn init(c: init::Context) -> init::LateResources {
|
fn init(c: init::Context) -> init::LateResources {
|
||||||
// Configure the microcontroller
|
// Configure the microcontroller
|
||||||
let (mut stabilizer, _pounder) = setup(c.core, c.device);
|
let (mut stabilizer, _pounder) =
|
||||||
|
hardware::setup::setup(c.core, c.device);
|
||||||
|
|
||||||
let network = NetworkUsers::new(
|
let network = NetworkUsers::new(
|
||||||
stabilizer.net.stack,
|
stabilizer.net.stack,
|
||||||
@ -142,7 +149,7 @@ const APP: () = {
|
|||||||
network,
|
network,
|
||||||
digital_inputs: stabilizer.digital_inputs,
|
digital_inputs: stabilizer.digital_inputs,
|
||||||
timestamper: stabilizer.timestamper,
|
timestamper: stabilizer.timestamper,
|
||||||
telemetry: net::TelemetryBuffer::default(),
|
telemetry: TelemetryBuffer::default(),
|
||||||
|
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
@ -308,27 +315,7 @@ const APP: () = {
|
|||||||
|
|
||||||
#[task(binds = ETH, priority = 1)]
|
#[task(binds = ETH, priority = 1)]
|
||||||
fn eth(_: eth::Context) {
|
fn eth(_: eth::Context) {
|
||||||
unsafe { stm32h7xx_hal::ethernet::interrupt_handler() }
|
unsafe { hal::ethernet::interrupt_handler() }
|
||||||
}
|
|
||||||
|
|
||||||
#[task(binds = SPI2, priority = 3)]
|
|
||||||
fn spi2(_: spi2::Context) {
|
|
||||||
panic!("ADC0 SPI error");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[task(binds = SPI3, priority = 3)]
|
|
||||||
fn spi3(_: spi3::Context) {
|
|
||||||
panic!("ADC1 SPI error");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[task(binds = SPI4, priority = 3)]
|
|
||||||
fn spi4(_: spi4::Context) {
|
|
||||||
panic!("DAC0 SPI error");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[task(binds = SPI5, priority = 3)]
|
|
||||||
fn spi5(_: spi5::Context) {
|
|
||||||
panic!("DAC1 SPI error");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -1,28 +1,19 @@
|
|||||||
|
pub use embedded_hal;
|
||||||
///! Module for all hardware-specific setup of Stabilizer
|
///! Module for all hardware-specific setup of Stabilizer
|
||||||
use stm32h7xx_hal as hal;
|
pub use stm32h7xx_hal as hal;
|
||||||
|
|
||||||
// Re-export for the DigitalInputs below:
|
pub mod adc;
|
||||||
pub use embedded_hal::digital::v2::InputPin;
|
pub mod afe;
|
||||||
|
pub mod cycle_counter;
|
||||||
mod adc;
|
pub mod dac;
|
||||||
mod afe;
|
|
||||||
mod configuration;
|
|
||||||
mod cycle_counter;
|
|
||||||
mod dac;
|
|
||||||
pub mod design_parameters;
|
pub mod design_parameters;
|
||||||
mod digital_input_stamper;
|
pub mod input_stamper;
|
||||||
mod eeprom;
|
|
||||||
pub mod pounder;
|
pub mod pounder;
|
||||||
mod system_timer;
|
pub mod setup;
|
||||||
mod timers;
|
pub mod system_timer;
|
||||||
|
|
||||||
pub use adc::{Adc0Input, Adc1Input, AdcCode};
|
mod eeprom;
|
||||||
pub use afe::Gain as AfeGain;
|
mod timers;
|
||||||
pub use cycle_counter::CycleCounter;
|
|
||||||
pub use dac::{Dac0Output, Dac1Output, DacCode};
|
|
||||||
pub use digital_input_stamper::InputStamper;
|
|
||||||
pub use pounder::DdsOutput;
|
|
||||||
pub use system_timer::SystemTimer;
|
|
||||||
|
|
||||||
// Type alias for the analog front-end (AFE) for ADC0.
|
// Type alias for the analog front-end (AFE) for ADC0.
|
||||||
pub type AFE0 = afe::ProgrammableGainAmplifier<
|
pub type AFE0 = afe::ProgrammableGainAmplifier<
|
||||||
@ -52,8 +43,6 @@ pub type NetworkStack = smoltcp_nal::NetworkStack<
|
|||||||
|
|
||||||
pub type EthernetPhy = hal::ethernet::phy::LAN8742A<hal::ethernet::EthernetMAC>;
|
pub type EthernetPhy = hal::ethernet::phy::LAN8742A<hal::ethernet::EthernetMAC>;
|
||||||
|
|
||||||
pub use configuration::{setup, PounderDevices, StabilizerDevices};
|
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &core::panic::PanicInfo) -> ! {
|
fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
|
@ -1,22 +1,15 @@
|
|||||||
|
use super::hal;
|
||||||
|
use embedded_hal::{adc::OneShot, blocking::spi::Transfer};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod attenuators;
|
pub mod attenuators;
|
||||||
mod dds_output;
|
pub mod dds_output;
|
||||||
pub mod hrtimer;
|
pub mod hrtimer;
|
||||||
mod rf_power;
|
pub mod rf_power;
|
||||||
|
|
||||||
#[cfg(feature = "pounder_v1_1")]
|
#[cfg(feature = "pounder_v1_1")]
|
||||||
pub mod timestamp;
|
pub mod timestamp;
|
||||||
|
|
||||||
pub use dds_output::DdsOutput;
|
|
||||||
|
|
||||||
use super::hal;
|
|
||||||
|
|
||||||
use attenuators::AttenuatorInterface;
|
|
||||||
use rf_power::PowerMeasurementInterface;
|
|
||||||
|
|
||||||
use embedded_hal::{adc::OneShot, blocking::spi::Transfer};
|
|
||||||
|
|
||||||
pub enum GpioPin {
|
pub enum GpioPin {
|
||||||
Led4Green = 0,
|
Led4Green = 0,
|
||||||
Led5Red = 1,
|
Led5Red = 1,
|
||||||
@ -329,7 +322,7 @@ impl PounderDevices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AttenuatorInterface for PounderDevices {
|
impl attenuators::AttenuatorInterface for PounderDevices {
|
||||||
/// Reset all of the attenuators to a power-on default state.
|
/// Reset all of the attenuators to a power-on default state.
|
||||||
fn reset_attenuators(&mut self) -> Result<(), Error> {
|
fn reset_attenuators(&mut self) -> Result<(), Error> {
|
||||||
self.mcp23017
|
self.mcp23017
|
||||||
@ -376,7 +369,7 @@ impl AttenuatorInterface for PounderDevices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PowerMeasurementInterface for PounderDevices {
|
impl rf_power::PowerMeasurementInterface for PounderDevices {
|
||||||
/// Sample an ADC channel.
|
/// Sample an ADC channel.
|
||||||
///
|
///
|
||||||
/// Args:
|
/// Args:
|
||||||
|
@ -15,9 +15,10 @@ use smoltcp_nal::smoltcp;
|
|||||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
adc, afe, cycle_counter::CycleCounter, dac, design_parameters,
|
adc, afe, cycle_counter::CycleCounter, dac, design_parameters, eeprom,
|
||||||
digital_input_stamper, eeprom, pounder, system_timer, timers, DdsOutput,
|
input_stamper::InputStamper, pounder, pounder::dds_output::DdsOutput,
|
||||||
DigitalInput0, DigitalInput1, EthernetPhy, NetworkStack, AFE0, AFE1,
|
system_timer, timers, DigitalInput0, DigitalInput1, EthernetPhy,
|
||||||
|
NetworkStack, AFE0, AFE1,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct NetStorage {
|
pub struct NetStorage {
|
||||||
@ -84,7 +85,7 @@ pub struct StabilizerDevices {
|
|||||||
pub afes: (AFE0, AFE1),
|
pub afes: (AFE0, AFE1),
|
||||||
pub adcs: (adc::Adc0Input, adc::Adc1Input),
|
pub adcs: (adc::Adc0Input, adc::Adc1Input),
|
||||||
pub dacs: (dac::Dac0Output, dac::Dac1Output),
|
pub dacs: (dac::Dac0Output, dac::Dac1Output),
|
||||||
pub timestamper: digital_input_stamper::InputStamper,
|
pub timestamper: InputStamper,
|
||||||
pub adc_dac_timer: timers::SamplingTimer,
|
pub adc_dac_timer: timers::SamplingTimer,
|
||||||
pub timestamp_timer: timers::TimestampTimer,
|
pub timestamp_timer: timers::TimestampTimer,
|
||||||
pub net: NetworkDevices,
|
pub net: NetworkDevices,
|
||||||
@ -509,10 +510,7 @@ pub fn setup(
|
|||||||
|
|
||||||
let input_stamper = {
|
let input_stamper = {
|
||||||
let trigger = gpioa.pa3.into_alternate_af2();
|
let trigger = gpioa.pa3.into_alternate_af2();
|
||||||
digital_input_stamper::InputStamper::new(
|
InputStamper::new(trigger, timestamp_timer_channels.ch4)
|
||||||
trigger,
|
|
||||||
timestamp_timer_channels.ch4,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let digital_inputs = {
|
let digital_inputs = {
|
@ -5,26 +5,28 @@
|
|||||||
///! telemetry (via MQTT), configuration of run-time settings (via MQTT + Miniconf), and live data
|
///! telemetry (via MQTT), configuration of run-time settings (via MQTT + Miniconf), and live data
|
||||||
///! streaming over raw UDP/TCP sockets. This module encompasses the main processing routines
|
///! streaming over raw UDP/TCP sockets. This module encompasses the main processing routines
|
||||||
///! related to Stabilizer networking operations.
|
///! related to Stabilizer networking operations.
|
||||||
|
pub use heapless;
|
||||||
|
pub use miniconf;
|
||||||
|
pub use serde;
|
||||||
|
|
||||||
|
pub mod messages;
|
||||||
|
pub mod miniconf_client;
|
||||||
|
pub mod network_processor;
|
||||||
|
pub mod shared;
|
||||||
|
pub mod telemetry;
|
||||||
|
|
||||||
|
use crate::hardware::{cycle_counter::CycleCounter, EthernetPhy, NetworkStack};
|
||||||
|
use messages::{MqttMessage, SettingsResponse};
|
||||||
|
use miniconf_client::MiniconfClient;
|
||||||
|
use network_processor::NetworkProcessor;
|
||||||
|
use shared::NetworkManager;
|
||||||
|
use telemetry::TelemetryClient;
|
||||||
|
|
||||||
|
use core::fmt::Write;
|
||||||
use heapless::String;
|
use heapless::String;
|
||||||
use miniconf::Miniconf;
|
use miniconf::Miniconf;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use core::fmt::Write;
|
|
||||||
|
|
||||||
mod messages;
|
|
||||||
mod miniconf_client;
|
|
||||||
mod network_processor;
|
|
||||||
mod shared;
|
|
||||||
mod telemetry;
|
|
||||||
|
|
||||||
use crate::hardware::{CycleCounter, EthernetPhy, NetworkStack};
|
|
||||||
use messages::{MqttMessage, SettingsResponse};
|
|
||||||
|
|
||||||
pub use miniconf_client::MiniconfClient;
|
|
||||||
pub use network_processor::NetworkProcessor;
|
|
||||||
pub use shared::NetworkManager;
|
|
||||||
pub use telemetry::{Telemetry, TelemetryBuffer, TelemetryClient};
|
|
||||||
|
|
||||||
pub type NetworkReference = shared::NetworkStackProxy<'static, NetworkStack>;
|
pub type NetworkReference = shared::NetworkStackProxy<'static, NetworkStack>;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq)]
|
#[derive(Copy, Clone, PartialEq)]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
///! The network processir is a small taks to regularly process incoming data over ethernet, handle
|
///! The network processir is a small taks to regularly process incoming data over ethernet, handle
|
||||||
///! the ethernet PHY state, and reset the network as appropriate.
|
///! the ethernet PHY state, and reset the network as appropriate.
|
||||||
use super::{NetworkReference, UpdateState};
|
use super::{NetworkReference, UpdateState};
|
||||||
use crate::hardware::{CycleCounter, EthernetPhy};
|
use crate::hardware::{cycle_counter::CycleCounter, EthernetPhy};
|
||||||
|
|
||||||
/// Processor for managing network hardware.
|
/// Processor for managing network hardware.
|
||||||
pub struct NetworkProcessor {
|
pub struct NetworkProcessor {
|
||||||
|
@ -16,7 +16,7 @@ use serde::Serialize;
|
|||||||
|
|
||||||
use super::NetworkReference;
|
use super::NetworkReference;
|
||||||
use crate::hardware::{
|
use crate::hardware::{
|
||||||
design_parameters::MQTT_BROKER, AdcCode, AfeGain, DacCode,
|
adc::AdcCode, afe::Gain, dac::DacCode, design_parameters::MQTT_BROKER,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The telemetry client for reporting telemetry data over MQTT.
|
/// The telemetry client for reporting telemetry data over MQTT.
|
||||||
@ -73,7 +73,7 @@ impl TelemetryBuffer {
|
|||||||
///
|
///
|
||||||
/// # Returns
|
/// # Returns
|
||||||
/// The finalized telemetry structure that can be serialized and reported.
|
/// The finalized telemetry structure that can be serialized and reported.
|
||||||
pub fn finalize(self, afe0: AfeGain, afe1: AfeGain) -> Telemetry {
|
pub fn finalize(self, afe0: Gain, afe1: Gain) -> Telemetry {
|
||||||
let in0_volts = Into::<f32>::into(self.adcs[0]) / afe0.as_multiplier();
|
let in0_volts = Into::<f32>::into(self.adcs[0]) / afe0.as_multiplier();
|
||||||
let in1_volts = Into::<f32>::into(self.adcs[1]) / afe1.as_multiplier();
|
let in1_volts = Into::<f32>::into(self.adcs[1]) / afe1.as_multiplier();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user