#include "stdint.h" #include "FreeRTOS.h" #include "task.h" typedef struct { volatile uint8_t hour; volatile uint8_t min; volatile uint8_t sec; volatile uint16_t w_year; volatile uint8_t w_month; volatile uint8_t w_date; volatile uint8_t week; } _calendar_obj; extern _calendar_obj calendar; extern uint8_t const table_week[12]; extern const uint8_t mon_table[12]; /********************************************************************* * @fn RTC_NVIC_Config * * @brief Initializes RTC Int. * * @return none */ void RTC_NVIC_Config (void); /********************************************************************* * @fn Is_Leap_Year * * @brief Judging whether it is a leap year. * * @param year * * @return 1 - Yes * 0 - No */ uint8_t Is_Leap_Year (u16 year); /********************************************************************* * @fn RTC_Set * * @brief Set Time. * * @param Struct of _calendar_obj * * @return 1 - error * 0 - success */ uint8_t RTC_Set (u16 syear, uint8_t smon, uint8_t sday, uint8_t hour, uint8_t min, uint8_t sec) ; /********************************************************************* * @fn RTC_Alarm_Set * * @brief Set Alarm Time. * * @param Struct of _calendar_obj * * @return 1 - error * 0 - success */ uint8_t RTC_Alarm_Set (u16 syear, uint8_t smon, uint8_t sday, uint8_t hour, uint8_t min, uint8_t sec) ; /********************************************************************* * @fn RTC_Get_Week * * @brief Get the current day of the week. * * @param year/month/day * * @return week */ uint8_t RTC_Get_Week (u16 year, uint8_t month, uint8_t day) ; /********************************************************************* * @fn RTC_Get * * @brief Get current time. * * @return 1 - error * 0 - success */ uint8_t RTC_Get (void) ; /********************************************************************* * @fn RTC_Init * * @brief Initializes RTC collection. * * @return 1 - Init Fail * 0 - Init Success */ uint8_t RTC_Init (void);