diff --git a/src/keret-controller/src/domain/application_service.rs b/src/keret-controller/src/domain/application_service.rs index 69f3482..091784e 100644 --- a/src/keret-controller/src/domain/application_service.rs +++ b/src/keret-controller/src/domain/application_service.rs @@ -49,7 +49,7 @@ where /// run the next cycle of the main logic loop, returning the new state pub(crate) fn next_cycle(&mut self, mode: &AppMode) -> AppMode { let next = self - .calculate_next_state(&mode) + .calculate_next_state(mode) .unwrap_or_else(handle_runtime_error); self.show_mode(&next); diff --git a/src/keret-controller/src/domain/model/duration.rs b/src/keret-controller/src/domain/model/duration.rs index e0319dc..7efef48 100644 --- a/src/keret-controller/src/domain/model/duration.rs +++ b/src/keret-controller/src/domain/model/duration.rs @@ -9,9 +9,9 @@ impl From for Duration { } } -impl Into for Duration { +impl From for u64 { #[inline(always)] - fn into(self) -> u64 { - self.0 + fn from(val: Duration) -> Self { + val.0 } } diff --git a/src/keret-controller/src/domain/model/instant.rs b/src/keret-controller/src/domain/model/instant.rs index 8768252..644b1ac 100644 --- a/src/keret-controller/src/domain/model/instant.rs +++ b/src/keret-controller/src/domain/model/instant.rs @@ -26,10 +26,10 @@ impl From for Instant { } // extract the u64 timestamp from the instant -impl Into for &Instant { +impl From<&Instant> for u64 { #[inline(always)] - fn into(self) -> u64 { - self.0 + fn from(val: &Instant) -> Self { + val.0 } } diff --git a/src/keret-controller/src/domain/model/mod.rs b/src/keret-controller/src/domain/model/mod.rs index a695cfe..14e08aa 100644 --- a/src/keret-controller/src/domain/model/mod.rs +++ b/src/keret-controller/src/domain/model/mod.rs @@ -60,9 +60,9 @@ impl From for TrackResult { } // extract the duration as u64 -impl Into for TrackResult { +impl From for u64 { #[inline] - fn into(self) -> u64 { - self.0.into() + fn from(val: TrackResult) -> Self { + val.0.into() } } diff --git a/src/keret-controller/src/main.rs b/src/keret-controller/src/main.rs index baf8bf4..00b9f56 100644 --- a/src/keret-controller/src/main.rs +++ b/src/keret-controller/src/main.rs @@ -13,6 +13,8 @@ mod infrastructure; /// convenience type alias to make code shorter/more readable /// meant for those static values which exist once and used from interrupts and inside domain layer type Singleton = Mutex>>; +type AppService<'a> = + ApplicationService<'a, RunningTimer, Display, InputControls, SerialBus>; use crate::{ domain::{model::AppMode, port::Display as _, ApplicationService}, @@ -80,12 +82,7 @@ fn main() -> ! { } /// initialize the board, creating all helper objects and put those necessary in the Mutexes -fn initialize_app_service<'a>( - board: Board, -) -> ( - ApplicationService<'a, RunningTimer, Display, InputControls, SerialBus>, - Timer, -) { +fn initialize_app_service<'a>(board: Board) -> (AppService<'a>, Timer) { let mut display = Display::new(board.TIMER1, board.display_pins); display.show_mode(&AppMode::Idle);