Files
stc32g128k/App/clock.h

37 lines
1.2 KiB
C
Raw Permalink Normal View History

#ifndef __CLOCK_H__
#define __CLOCK_H__
#include "config.h"
// 全局软时钟变量声明
extern u8 current_hour;
extern u8 current_min;
extern u8 current_sec;
extern u8 current_day; // 日 (1~31)
extern u8 current_month; // 月 (1~12)
extern u8 current_year; // 年 (0~99代表 2000~2099不处理世纪)
extern u8 current_weekday; // 星期 (0=周日, 1=周一, ..., 6=周六)
extern volatile u8 clock_updated;
extern volatile bit second_tick_flag; // 整秒滴答标志位,每次 current_sec 递增时置 1供主循环转换为事件
/**
* @brief ( 1ms )
*/
void Clock_IncMS(void);
/**
* @brief ( 2 )
* @param year (0~99 2000~2099)
* @param month (1~12)
*/
u8 Days_In_Month(u8 year, u8 month);
/**
* @brief current_weekday
* @details Zeller RTC
* ()
*/
void Clock_RecalcWeekday(void);
#endif // __CLOCK_H__