-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrtc_stm32.h
51 lines (39 loc) · 793 Bytes
/
rtc_stm32.h
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* rtc.h
*
* Created on: 27 Feb 2019
* Author: Stefan Jaritz
*/
#ifndef DRV_RTC_STM32_H_
#define DRV_RTC_STM32_H_
#include <zephyr/types.h>
#define RTC_NAME "STM32_RTC"
typedef struct rtc_time {
u8_t hours;
u8_t minutes;
u8_t seconds;
} rtc_time_t;
typedef struct rtc_date {
u8_t day;
u8_t weekday;
u8_t month;
u8_t year;
} rtc_date_t;
typedef struct rtc_raw_ts {
u32_t d;
u32_t t;
u16_t ss;
} rtc_raw_ts_t;
typedef struct rtc_ts {
rtc_date_t d;
rtc_time_t t;
unsigned int ms;
} rtc_ts_t;
rtc_ts_t rtc_ts_fromRaw(rtc_raw_ts_t * ts);
void rtc_setTime (rtc_ts_t st);
void rtc_getTimestamp (rtc_raw_ts_t * ts);
typedef struct rtc_api_s {
void (* getTimestamp) (rtc_raw_ts_t * ts);
void (* setTime) (rtc_ts_t st);
} rtc_api_t;
#endif /* DRV_RTC_STM32_H_ */