dual-iir: use InputPin re-export, rename digital_input

This commit is contained in:
Robert Jördens 2021-04-15 13:47:10 +02:00
parent 2bfed7b669
commit 8cc06d39c4
3 changed files with 10 additions and 11 deletions

View File

@ -2,10 +2,6 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use stm32h7xx_hal as hal;
pub use embedded_hal::digital::v2::InputPin;
use stabilizer::hardware; use stabilizer::hardware;
use miniconf::{minimq, Miniconf, MqttInterface}; use miniconf::{minimq, Miniconf, MqttInterface};
@ -14,7 +10,7 @@ use serde::Deserialize;
use dsp::iir; use dsp::iir;
use hardware::{ use hardware::{
Adc0Input, Adc1Input, AfeGain, CycleCounter, Dac0Output, Dac1Output, Adc0Input, Adc1Input, AfeGain, CycleCounter, Dac0Output, Dac1Output,
DigitalInput1, NetworkStack, AFE0, AFE1, DigitalInput1, InputPin, NetworkStack, AFE0, AFE1,
}; };
const SCALE: f32 = i16::MAX as _; const SCALE: f32 = i16::MAX as _;
@ -45,7 +41,7 @@ impl Default for Settings {
const APP: () = { const APP: () = {
struct Resources { struct Resources {
afes: (AFE0, AFE1), afes: (AFE0, AFE1),
di1: DigitalInput1, digital_input1: DigitalInput1,
adcs: (Adc0Input, Adc1Input), adcs: (Adc0Input, Adc1Input),
dacs: (Dac0Output, Dac1Output), dacs: (Dac0Output, Dac1Output),
mqtt_interface: mqtt_interface:
@ -99,7 +95,7 @@ const APP: () = {
adcs: stabilizer.adcs, adcs: stabilizer.adcs,
dacs: stabilizer.dacs, dacs: stabilizer.dacs,
clock: stabilizer.cycle_counter, clock: stabilizer.cycle_counter,
di1: stabilizer.digital_inputs.1, digital_input1: stabilizer.digital_inputs.1,
settings: Settings::default(), settings: Settings::default(),
} }
} }
@ -120,7 +116,7 @@ const APP: () = {
/// ///
/// Because the ADC and DAC operate at the same rate, these two constraints actually implement /// Because the ADC and DAC operate at the same rate, these two constraints actually implement
/// the same time bounds, meeting one also means the other is also met. /// the same time bounds, meeting one also means the other is also met.
#[task(binds=DMA1_STR4, resources=[adcs, di1, dacs, iir_state, settings], priority=2)] #[task(binds=DMA1_STR4, resources=[adcs, digital_input1, dacs, iir_state, settings], priority=2)]
fn process(c: process::Context) { fn process(c: process::Context) {
let adc_samples = [ let adc_samples = [
c.resources.adcs.0.acquire_buffer(), c.resources.adcs.0.acquire_buffer(),
@ -133,7 +129,7 @@ const APP: () = {
]; ];
let hold = c.resources.settings.force_hold let hold = c.resources.settings.force_hold
|| (c.resources.di1.is_high().unwrap() || (c.resources.digital_input1.is_high().unwrap()
&& c.resources.settings.allow_hold); && c.resources.settings.allow_hold);
for channel in 0..adc_samples.len() { for channel in 0..adc_samples.len() {
@ -204,7 +200,7 @@ const APP: () = {
#[task(binds = ETH, priority = 1)] #[task(binds = ETH, priority = 1)]
fn eth(_: eth::Context) { fn eth(_: eth::Context) {
unsafe { hal::ethernet::interrupt_handler() } unsafe { stm32h7xx_hal::ethernet::interrupt_handler() }
} }
#[task(binds = SPI2, priority = 3)] #[task(binds = SPI2, priority = 3)]

View File

@ -9,7 +9,7 @@ use stm32h7xx_hal::{
use smoltcp_nal::smoltcp; use smoltcp_nal::smoltcp;
pub 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,

View File

@ -1,6 +1,9 @@
///! Module for all hardware-specific setup of Stabilizer ///! Module for all hardware-specific setup of Stabilizer
use stm32h7xx_hal as hal; use stm32h7xx_hal as hal;
// Re-export for the DigitalInputs below:
pub use embedded_hal::digital::v2::InputPin;
#[cfg(feature = "semihosting")] #[cfg(feature = "semihosting")]
use panic_semihosting as _; use panic_semihosting as _;