/**
  ******************************************************************************
  * @file    RTC_CFG.h
  * @author  SINOMCU-AE
  * @brief   Header file of RTC_CFG.c file.
  *    
  *          This file describes the CRC macro definitions used:
  *    Micro define user LSI or LSE,RTC init date and time 
  *    RTC init RTC_ASYNCH_PREDIV,RTC_SYNCH_PREDIV
  * 
  ******************************************************************************
  * @attention 
  *                           DISCLAIMER
  * The present firmware which is for guidance only aims at providing customers
  * with coding information regarding their products in order for them to save
  * time. As a result, SinoMCU shall not be held liable for any direct,indirect
  * or consequential damages with respect to any claims arising from the content 
  * of such firmware and/or the use made by customers of the coding information 
  * contained herein in connection with their products.
  *
  * <h2><center>&copy; Copyright (c) 2021 sinomcu All rights reserved.</center></h2>
  *
  ******************************************************************************
  */

#ifndef __RTC_CFG_H
#define __RTC_CFG_H

#include "ms32f0xx.h"

#define RTC_USER_LSE            1           // 1:use LSE,0:use LSI

#define RTC_INIT_IDF_VAL        0xAA55      // RTC had init
// 23:58:45
#define RTC_INIT_HOURS          0x23
#define RTC_INIT_MINUTES        0x58
#define RTC_INIT_SECONDS        0x45
// 2021-12-10
#define RTC_INIT_WEEKDAY        MS32_RTC_WEEKDAY_FRIDAY
#define RTC_INIT_DAY            0x10
#define RTC_INIT_MONTH          MS32_RTC_MONTH_DECEMBER
#define RTC_INIT_YEAR           0x21

// ck_apre=LSxFreq/(ASYNC prediv + 1) ,LSI:40K,LSE:32.768K
// ck_spre=ck_apre/(SYNC prediv + 1) 
#if(defined(RTC_USER_LSE) && RTC_USER_LSE) 
#define RTC_ASYNCH_PREDIV       0x7F
#define RTC_SYNCH_PREDIV        0xFF
#else
#define RTC_ASYNCH_PREDIV       0x7F
#define RTC_SYNCH_PREDIV        0x137
#endif


void rtc_config(void);

#endif /* __RTC_CFG_H */ 

/******************************** END OF FILE *********************************/
