~ruther/simple-clock

ref: bdc971945a94b31cf9958ea50d1d379db829fbc0 simple-clock/source/src/clock_state.rs -rw-r--r-- 486 bytes
bdc97194 — Rutherther chore: add MIT LICENSE 1 year, 10 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