stm32f1xx_HBL/drv/rtc.h
Steins7 3e3d4d2bff Implement RTC module's basic functionnalities
FUnctions need a cleanup and some details need be ironned, like the
clock management since the whole backup domain must be reset to
configure them
2024-07-27 16:41:36 +02:00

44 lines
860 B
C

/** @file rtc.h
* Module handling the Real-Time Clock (RTC).
*
*/
#ifndef _RTC_H_
#define _RTC_H_
//--includes--------------------------------------------------------------------
#include "stdint.h"
//--type definitions------------------------------------------------------------
enum RtcClockSrc {
RTC_CLOCK_SRC_LSE = 0x0,
RTC_CLOCK_SRC_LSI = 0x1,
RTC_CLOCK_SRC_HSE = 0x2,
};
enum RtcIrq {
RTC_IRQ_NONE = 0,
RTC_IRQ_SECOND = 0x1 << 0,
RTC_IRQ_ALARM = 0x1 << 1,
RTC_IRQ_OVERFLOW = 0x1 << 2,
};
typedef void (*RtcCallback)(enum RtcIrq src);
//--functions-------------------------------------------------------------------
void rtc_configure(uint32_t period_ms, enum RtcClockSrc clock_src,
enum RtcIrq irq_mask, uint32_t alarm_tick, RtcCallback callback);
void rtc_reset(void);
uint32_t stk_read_s(void);
#endif //_RTC_H_