hpw421初始版本
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/*!
|
||||
* \file rtc.h
|
||||
*
|
||||
* \brief Target rtc implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __RTC_H__
|
||||
#define __RTC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
|
||||
#include "xc6xxx.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Global Variables
|
||||
-------------------------------------------------------------------------------------*/
|
||||
extern volatile uint32_t Utc_TotalSec;
|
||||
// Test val
|
||||
extern uint8_t Sec_Flag;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
------------------------------------------- -----------------------------------------*/
|
||||
void rtc_sec_handler(void);
|
||||
void RTC_Config( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RTC_H__ */
|
||||
@@ -0,0 +1,86 @@
|
||||
/*!
|
||||
* \file time_conv.h
|
||||
*
|
||||
* \brief Target time convert implementation
|
||||
*
|
||||
* \copyright Revised BSD License, see section \ref LICENSE.
|
||||
*
|
||||
* \code
|
||||
*
|
||||
* _ __ _ ________ _
|
||||
* | |/ /(_)___ / ____/ /_ (_)___
|
||||
* | // / __ \/ / / __ \/ / __ \
|
||||
* / |/ / / / / /___/ / / / / /_/ /
|
||||
* /_/|_/_/_/ /_/\____/_/ /_/_/ .___/
|
||||
* /_/
|
||||
* (C) 2022-2025 XinChip
|
||||
*
|
||||
* \endcode
|
||||
*
|
||||
* \author ( XinChip ) Alex-J
|
||||
*
|
||||
* \author ( XinChip )
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TIME_CONV_H__
|
||||
#define __TIME_CONV_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------------
|
||||
INCLUDE HEADE FILES
|
||||
------------------------------------------------------------------------------------*/
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "rtc.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
------------------------------------------- -----------------------------------------*/
|
||||
#define YEAR_BASE 2000U
|
||||
#define TIME_ZONE (8)
|
||||
|
||||
#define M_JAN 1U
|
||||
#define M_FEB 2U
|
||||
#define M_MAR 3U
|
||||
#define M_APR 4U
|
||||
#define M_MAY 5U
|
||||
#define M_JUN 6U
|
||||
#define M_JUL 7U
|
||||
#define M_AUG 8U
|
||||
#define M_SEP 9U
|
||||
#define M_OCT 10U
|
||||
#define M_NOV 11U
|
||||
#define M_DEC 12U
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Typedef
|
||||
-------------------------------------------------------------------------------------*/
|
||||
typedef struct tm Utc_Date_t;
|
||||
typedef struct
|
||||
{
|
||||
uint8_t year;
|
||||
uint8_t month;
|
||||
uint8_t day;
|
||||
uint8_t hour;
|
||||
uint8_t min;
|
||||
uint8_t sec;
|
||||
uint8_t week;
|
||||
} DateTime_t;
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Exported Functions
|
||||
------------------------------------------- -----------------------------------------*/
|
||||
DateTime_t UTC_SecToDate( uint32_t utc_sec );
|
||||
DateTime_t UTC_DateToZoneDate(int8_t zone_num, uint16_t year_base, uint8_t u_year, uint8_t u_month,
|
||||
uint8_t u_day, uint8_t u_hour, uint8_t u_min, uint8_t u_sec, uint8_t u_week);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TIME_CONV_H__ */
|
||||
Reference in New Issue
Block a user