56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
|
|
/*
|
|||
|
|
* rtc.h
|
|||
|
|
*
|
|||
|
|
* Created on: Jul 29, 2025
|
|||
|
|
* Author: cc
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#ifndef MCU_DRIVER_INC_RTC_H_
|
|||
|
|
#define MCU_DRIVER_INC_RTC_H_
|
|||
|
|
|
|||
|
|
#include <stdint.h>
|
|||
|
|
#include "ch564.h"
|
|||
|
|
|
|||
|
|
typedef struct{
|
|||
|
|
uint8_t second;
|
|||
|
|
uint8_t minute;
|
|||
|
|
uint8_t hour;
|
|||
|
|
uint8_t week;
|
|||
|
|
uint8_t day;
|
|||
|
|
uint8_t month;
|
|||
|
|
uint8_t year;
|
|||
|
|
}S_RTC;
|
|||
|
|
|
|||
|
|
typedef struct{
|
|||
|
|
uint32_t hour;
|
|||
|
|
uint16_t minute;
|
|||
|
|
uint16_t second;
|
|||
|
|
}G_CORE_RTC;
|
|||
|
|
|
|||
|
|
typedef struct{
|
|||
|
|
uint8_t time_select; //<2F><>ǰʱ<C7B0><CAB1>ѡ<EFBFBD><D1A1> 0x00:<3A><>ǰδѡ<CEB4><D1A1><EFBFBD><EFBFBD>0x01: ѡ<>ض<F1B1BEB5>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x02:Ӳ<><D3B2>CSIO RTCʱ<43><CAB1>
|
|||
|
|
uint8_t csio_rtc_cnt; //CSIO RTCʱ<43>Ӽ<EFBFBD><D3BC><EFBFBD>
|
|||
|
|
|
|||
|
|
int16_t timezone; //ʱ<><CAB1>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD>
|
|||
|
|
uint32_t Mcu_GetTime_tick;
|
|||
|
|
}TIME_INFO_T;
|
|||
|
|
|
|||
|
|
extern S_RTC RTC_Raw_Data;
|
|||
|
|
extern S_RTC MCU_RTC_Data;
|
|||
|
|
extern S_RTC Net_RTC_Data;
|
|||
|
|
extern TIME_INFO_T g_time_info;
|
|||
|
|
extern uint32_t Log_Time_ms;
|
|||
|
|
|
|||
|
|
void RTC_Init(void);
|
|||
|
|
uint8_t HEX_Conversion_To_DEC(uint8_t c_num);
|
|||
|
|
uint8_t DEV_Conversion_To_HEX(uint8_t c_num);
|
|||
|
|
uint32_t RTC_Conversion_To_Unix(S_RTC *rtc_time);
|
|||
|
|
void Unix_Conversion_To_RTC(S_RTC *rtc_time,uint32_t utc_tick);
|
|||
|
|
uint8_t RTC_ReadDate(S_RTC *psRTC);
|
|||
|
|
uint8_t RTC_WriteDate(S_RTC SetRTC);
|
|||
|
|
void RTC_TASK(void);
|
|||
|
|
uint8_t RTC_TimeDate_Correct_Figure(uint8_t data);
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endif /* MCU_DRIVER_INC_RTC_H_ */
|