Skip to content

Commit

Permalink
style, depth
Browse files Browse the repository at this point in the history
* clippy lints on comments and default
* fixed tree depth
  • Loading branch information
jordens committed Feb 1, 2024
1 parent 186daf3 commit af194a7
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 51 deletions.
5 changes: 3 additions & 2 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-run --chip STM32H743ZITx --speed 30000"
runner = "probe-rs run --chip STM32H743ZITx --log-file /dev/null"
# runner = "gdb-multiarch -q -x openocd.gdb"
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=--nmagic",
"-C", "target-cpu=cortex-m7",
#"-C", "target-feature=+fp-armv8d16",
]

[build]
target = "thumbv7em-none-eabihf"
target = "thumbv7em-none-eabihf"
24 changes: 13 additions & 11 deletions src/hardware/dac.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/// Thermostat DAC driver
///
/// This file contains the driver for the 4 Thermostat DAC output channels.
/// To convert a 18 bit word into an analog current Thermostat uses a DAC to
/// convert the word into a voltage and a subsequent TEC driver IC that produces
/// a current proportional to the DAC voltage.
///
/// The 4 channel DAC ICs share an SPI bus and are addressed using individual "sync"
/// signals, similar to a chip select signal.
/// DAC datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5680.pdf
/// TEC driver datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1968-MAX1969.pdf
//! Thermostat DAC driver
//!
//! This file contains the driver for the 4 Thermostat DAC output channels.
//! To convert a 18 bit word into an analog current Thermostat uses a DAC to
//! convert the word into a voltage and a subsequent TEC driver IC that produces
//! a current proportional to the DAC voltage.
//!
//! The 4 channel DAC ICs share an SPI bus and are addressed using individual "sync"
//! signals, similar to a chip select signal.
//! DAC datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD5680.pdf
//! TEC driver datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1968-MAX1969.pdf
//!
use super::hal::{
gpio::{self, gpioc},
hal::blocking::spi::Write,
Expand Down
9 changes: 5 additions & 4 deletions src/hardware/pwm.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/// Thermostat TEC driver IC voltage/current limits PWM driver.
///
/// The Thermostat TEC driver ICs feature current limits controlled by an analog voltage input.
/// This voltage is controlled by the MCU using low-pass filtered PWM outputs.
//! Thermostat TEC driver IC voltage/current limits PWM driver.
//!
//! The Thermostat TEC driver ICs feature current limits controlled by an analog voltage input.
//! This voltage is controlled by the MCU using low-pass filtered PWM outputs.
//!
use super::{
dac::{R_SENSE, VREF_TEC},
hal::{
Expand Down
10 changes: 5 additions & 5 deletions src/hardware/system_timer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// System timer used for non-RTIC compatibility
///
/// # Design
/// `Clock` is implemented using the RTIC `app::monotonics::now()` default `Monotonic`.
/// That `Monotonic` must tick at 1 kHz.
//! System timer used for non-RTIC compatibility
//!
//! # Design
//! `Clock` is implemented using the RTIC `app::monotonics::now()` default `Monotonic`.
//! That `Monotonic` must tick at 1 kHz.
use minimq::embedded_time::{clock::Error, fraction::Fraction, Clock, Instant};

#[derive(Copy, Clone, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct Settings {
///
/// # Value
/// See [output_channel::OutputChannel]
#[tree(depth(5))]
#[tree(depth(4))]
output_channel: [output_channel::OutputChannel; 4],

/// Alarm settings.
Expand All @@ -63,7 +63,7 @@ pub struct Settings {
///
/// # Value
/// See [Alarm]
#[tree(depth(3))]
#[tree(depth(5))]
alarm: Alarm,
}

Expand Down
16 changes: 8 additions & 8 deletions src/net/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// Stabilizer network management module
///
/// # Design
/// The stabilizer network architecture supports numerous layers to permit transmission of
/// 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
/// related to Stabilizer networking operations.
//! Stabilizer network management module
//!
//! # Design
//! The stabilizer network architecture supports numerous layers to permit transmission of
//! 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
//! related to Stabilizer networking operations.
pub use heapless;
pub use miniconf;
pub use serde;
Expand Down Expand Up @@ -252,6 +252,6 @@ pub struct Alarm {
///
/// # Value
/// [f32, f32]
#[tree(depth(2))]
#[tree(depth(4))]
pub temperature_limits: [[Option<[f32; 2]>; 4]; 4],
}
10 changes: 5 additions & 5 deletions src/net/network_processor.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// Task to process network hardware.
///
/// # Design
/// 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.
//! Task to process network hardware.
//!
//! # Design
//! 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.
use super::{NetworkReference, UpdateState};
use crate::hardware::EthernetPhy;

Expand Down
26 changes: 13 additions & 13 deletions src/net/telemetry.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/// Thermostat Telemetry Capabilities
///
/// # Design
/// Telemetry is reported regularly using an MQTT client. All telemetry is reported in SI units
/// using standard JSON format.
///
/// In order to report ADC/DAC codes generated during the DSP routines, a telemetry buffer is
/// employed to track the latest codes. Converting these codes to SI units would result in
/// repetitive and unnecessary calculations within the DSP routine, slowing it down and limiting
/// sampling frequency. Instead, the raw codes are stored and the telemetry is generated as
/// required immediately before transmission. This ensures that any slower computation required
/// for unit conversion can be off-loaded to lower priority tasks.
//! Thermostat Telemetry Capabilities
//!
//! # Design
//! Telemetry is reported regularly using an MQTT client. All telemetry is reported in SI units
//! using standard JSON format.
//!
//! In order to report ADC/DAC codes generated during the DSP routines, a telemetry buffer is
//! employed to track the latest codes. Converting these codes to SI units would result in
//! repetitive and unnecessary calculations within the DSP routine, slowing it down and limiting
//! sampling frequency. Instead, the raw codes are stored and the telemetry is generated as
//! required immediately before transmission. This ensures that any slower computation required
//! for unit conversion can be off-loaded to lower priority tasks.
use heapless::String;
use serde::Serialize;

Expand Down Expand Up @@ -55,8 +55,8 @@ impl<T: Serialize> TelemetryClient<T> {
Self {
mqtt,
prefix: String::from(prefix),
metadata,
meta_published: false,
metadata,
_telemetry: core::marker::PhantomData,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/output_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct OutputChannel {
///
/// # Value
/// f32
#[tree(depth(3))]
#[tree(depth(2))]
pub weights: [[Option<f32>; 4]; 4],
}

Expand Down

0 comments on commit af194a7

Please sign in to comment.