From 1b3b121a2d77e923f1b297950675fead66253903 Mon Sep 17 00:00:00 2001 From: topquark12 Date: Sun, 23 Oct 2022 16:59:15 +0800 Subject: [PATCH] cleanup --- src/device/boot.rs | 2 +- src/device/log_setup.rs | 2 ++ src/laser_diode/current_sources.rs | 4 ++-- src/main.rs | 6 +----- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/device/boot.rs b/src/device/boot.rs index 1a15821..6133c01 100644 --- a/src/device/boot.rs +++ b/src/device/boot.rs @@ -48,7 +48,7 @@ pub fn bootup(mut core_perif: CorePeripherals, perif: Peripherals) -> Independen let mut laser = CurrentSource { phy: current_source_phy, - setting: CurrentSourceSettingsConstruct { + setting: CurrentSourceSettings { output_current: 0.0, }, }; diff --git a/src/device/log_setup.rs b/src/device/log_setup.rs index 59d3c51..54a896c 100644 --- a/src/device/log_setup.rs +++ b/src/device/log_setup.rs @@ -9,7 +9,9 @@ pub fn init_log() { #[cfg(feature = "RTT")] pub fn init_log() { use super::rtt_logger; + use rtt_target::rtt_init_print; static RTT_LOGGER: rtt_logger::Logger = rtt_logger::Logger; + rtt_init_print!(); let _ = log::set_logger(&RTT_LOGGER); log::set_max_level(log::LevelFilter::Debug); } diff --git a/src/laser_diode/current_sources.rs b/src/laser_diode/current_sources.rs index 5db5fc4..143de88 100644 --- a/src/laser_diode/current_sources.rs +++ b/src/laser_diode/current_sources.rs @@ -21,12 +21,12 @@ pub struct CurrentSourcePhyConstruct { pub current_source_ldo_en: C::CurrentSourceLdoEn, pub current_source_short: C::CurrentSourceShort, } -pub struct CurrentSourceSettingsConstruct { +pub struct CurrentSourceSettings { pub output_current: f32, } pub struct CurrentSource { pub phy: CurrentSourcePhyConstruct, - pub setting: CurrentSourceSettingsConstruct, + pub setting: CurrentSourceSettings, } pub struct CurrentSourcePhyCh0; diff --git a/src/main.rs b/src/main.rs index 6bf2920..7ffde0b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use device::{boot::bootup, log_setup, sys_timer}; #[cfg(feature = "RTT")] use { core::panic::PanicInfo, - rtt_target::{rprintln, rtt_init_print}, + rtt_target::rprintln, }; #[cfg(feature = "RTT")] #[panic_handler] @@ -28,10 +28,6 @@ use panic_halt as _; #[entry] fn main() -> ! { - // RTT does not rely on any peripherals, can be set up immidiately - #[cfg(feature = "RTT")] - rtt_init_print!(); - log_setup::init_log(); info!("Kirdy init");