~ruther/simple-clock

ref: 9a82d5eec0c6de36140bb72311230a4a12d7a9ae simple-clock/source/src/clock_state.rs -rw-r--r-- 486 bytes
9a82d5ee — František Boháček chore(src): move source to source/ folder 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use stm32f1xx_hal::time::MonoTimer;

use crate::calendar::Calendar;

pub struct ClockState {
    calendar: Calendar,
    timer: MonoTimer,
}

impl ClockState {
    pub fn new(calendar: Calendar, timer: MonoTimer) -> Self {
        Self { calendar, timer }
    }

    pub fn timer(&self) -> MonoTimer {
        self.timer
    }

    pub fn calendar(&self) -> &Calendar {
        &self.calendar
    }

    pub fn second_elapsed(&mut self) {
        self.calendar.second_elapsed()
    }
}
Do not follow this link