style: implement a couple clippy suggestions [nfc]
This commit is contained in:
parent
f70612f1be
commit
f14f0e2ed1
|
@ -120,9 +120,9 @@ where
|
||||||
RST: OutputPin,
|
RST: OutputPin,
|
||||||
{
|
{
|
||||||
let mut ad9959 = Ad9959 {
|
let mut ad9959 = Ad9959 {
|
||||||
interface: interface,
|
interface,
|
||||||
io_update: io_update,
|
io_update,
|
||||||
delay: delay,
|
delay,
|
||||||
reference_clock_frequency: clock_frequency,
|
reference_clock_frequency: clock_frequency,
|
||||||
system_clock_multiplier: 1,
|
system_clock_multiplier: 1,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use embedded_hal;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
|
@ -45,7 +44,7 @@ where
|
||||||
/// * `a0` - An output connected to the A0 input of the amplifier.
|
/// * `a0` - An output connected to the A0 input of the amplifier.
|
||||||
/// * `a1` - An output connected to the A1 input of the amplifier.
|
/// * `a1` - An output connected to the A1 input of the amplifier.
|
||||||
pub fn new(a0: A0, a1: A1) -> Self {
|
pub fn new(a0: A0, a1: A1) -> Self {
|
||||||
let mut afe = Self { a0: a0, a1: a1 };
|
let mut afe = Self { a0, a1 };
|
||||||
|
|
||||||
afe.set_gain(Gain::G1);
|
afe.set_gain(Gain::G1);
|
||||||
|
|
||||||
|
|
23
src/main.rs
23
src/main.rs
|
@ -28,8 +28,6 @@ extern crate panic_halt;
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
||||||
// use core::sync::atomic::{AtomicU32, AtomicBool, Ordering};
|
// use core::sync::atomic::{AtomicU32, AtomicBool, Ordering};
|
||||||
use asm_delay;
|
|
||||||
use cortex_m;
|
|
||||||
use cortex_m_rt::exception;
|
use cortex_m_rt::exception;
|
||||||
use rtic::cyccnt::{Instant, U32Ext};
|
use rtic::cyccnt::{Instant, U32Ext};
|
||||||
use stm32h7xx_hal as hal;
|
use stm32h7xx_hal as hal;
|
||||||
|
@ -331,13 +329,12 @@ const APP: () = {
|
||||||
.frame_size(16)
|
.frame_size(16)
|
||||||
.swap_mosi_miso();
|
.swap_mosi_miso();
|
||||||
|
|
||||||
let spi = dp.SPI4.spi(
|
dp.SPI4.spi(
|
||||||
(spi_sck, spi_miso, hal::spi::NoMosi),
|
(spi_sck, spi_miso, hal::spi::NoMosi),
|
||||||
config,
|
config,
|
||||||
50.mhz(),
|
50.mhz(),
|
||||||
&clocks,
|
&clocks,
|
||||||
);
|
)
|
||||||
spi
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let dac2_spi = {
|
let dac2_spi = {
|
||||||
|
@ -361,14 +358,12 @@ const APP: () = {
|
||||||
.frame_size(16)
|
.frame_size(16)
|
||||||
.swap_mosi_miso();
|
.swap_mosi_miso();
|
||||||
|
|
||||||
let spi = dp.SPI5.spi(
|
dp.SPI5.spi(
|
||||||
(spi_sck, spi_miso, hal::spi::NoMosi),
|
(spi_sck, spi_miso, hal::spi::NoMosi),
|
||||||
config,
|
config,
|
||||||
50.mhz(),
|
50.mhz(),
|
||||||
&clocks,
|
&clocks,
|
||||||
);
|
)
|
||||||
|
|
||||||
spi
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut fp_led_0 = gpiod.pd5.into_push_pull_output();
|
let mut fp_led_0 = gpiod.pd5.into_push_pull_output();
|
||||||
|
@ -635,16 +630,16 @@ const APP: () = {
|
||||||
dac1: dac1_spi,
|
dac1: dac1_spi,
|
||||||
adc2: adc2_spi,
|
adc2: adc2_spi,
|
||||||
dac2: dac2_spi,
|
dac2: dac2_spi,
|
||||||
afe1: afe1,
|
afe1,
|
||||||
afe2: afe2,
|
afe2,
|
||||||
|
|
||||||
timer: timer2,
|
timer: timer2,
|
||||||
pounder: pounder_devices,
|
pounder: pounder_devices,
|
||||||
|
|
||||||
eeprom_i2c: eeprom_i2c,
|
eeprom_i2c,
|
||||||
net_interface: network_interface,
|
net_interface: network_interface,
|
||||||
eth_mac: eth_mac,
|
eth_mac,
|
||||||
mac_addr: mac_addr,
|
mac_addr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
use ad9959;
|
|
||||||
use mcp23017;
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
mod attenuators;
|
mod attenuators;
|
||||||
|
@ -106,7 +103,7 @@ impl QspiInterface {
|
||||||
qspi.configure_mode(hal::qspi::QspiMode::FourBit)
|
qspi.configure_mode(hal::qspi::QspiMode::FourBit)
|
||||||
.map_err(|_| Error::Qspi)?;
|
.map_err(|_| Error::Qspi)?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
qspi: qspi,
|
qspi,
|
||||||
mode: ad9959::Mode::SingleBitTwoWire,
|
mode: ad9959::Mode::SingleBitTwoWire,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -396,8 +393,8 @@ where
|
||||||
let power = self.measure_power(channel)?;
|
let power = self.measure_power(channel)?;
|
||||||
|
|
||||||
Ok(InputChannelState {
|
Ok(InputChannelState {
|
||||||
attenuation: attenuation,
|
attenuation,
|
||||||
power: power,
|
power,
|
||||||
mixer: channel_state,
|
mixer: channel_state,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -458,7 +455,7 @@ where
|
||||||
let attenuation = self.get_attenuation(channel)?;
|
let attenuation = self.get_attenuation(channel)?;
|
||||||
|
|
||||||
Ok(OutputChannelState {
|
Ok(OutputChannelState {
|
||||||
attenuation: attenuation,
|
attenuation,
|
||||||
channel: channel_state,
|
channel: channel_state,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ impl Response {
|
||||||
/// * `message` - The message denoting the status.
|
/// * `message` - The message denoting the status.
|
||||||
pub fn custom<'a>(code: i32, message: &'a str) -> Self {
|
pub fn custom<'a>(code: i32, message: &'a str) -> Self {
|
||||||
let mut res = Self {
|
let mut res = Self {
|
||||||
code: code,
|
code,
|
||||||
attribute: String::from(""),
|
attribute: String::from(""),
|
||||||
value: String::from(message),
|
value: String::from(message),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue