45 lines
554 B
C
45 lines
554 B
C
|
/*
|
||
|
* rtc.h
|
||
|
*
|
||
|
* Created on: Oct 16, 2024
|
||
|
* Author: true
|
||
|
*/
|
||
|
|
||
|
#ifndef USER_SRC_RTC_H_
|
||
|
#define USER_SRC_RTC_H_
|
||
|
|
||
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
|
||
|
|
||
|
#define RTC_INIT_DR BKP_DR1
|
||
|
#define RTC_STATE_DR BKP_DR2
|
||
|
|
||
|
|
||
|
|
||
|
enum RTCState {
|
||
|
RTC_STATE_UNINITIALIZED = 0,
|
||
|
RTC_STATE_CLOCK_NOT_SET,
|
||
|
RTC_STATE_OK = 0x7f
|
||
|
};
|
||
|
|
||
|
typedef struct RTClock {
|
||
|
uint16_t year;
|
||
|
uint8_t mon;
|
||
|
uint8_t day;
|
||
|
uint8_t h;
|
||
|
uint8_t m;
|
||
|
uint8_t s;
|
||
|
} RTClock;
|
||
|
|
||
|
|
||
|
|
||
|
int8_t rtc_init();
|
||
|
|
||
|
int8_t rtc_set_clock(struct RTClock *c);
|
||
|
|
||
|
|
||
|
|
||
|
#endif /* USER_SRC_RTC_H_ */
|