~ruther/simple-clock

ref: 5917425c1b5ee867a22ee38dc598a89239674425 simple-clock/source/src/clock_state.rs -rw-r--r-- 486 bytes
5917425c — František Boháček chore: move .gitignore to root 1 year, 11 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