初始提交
This commit is contained in:
98
export/inc/bsp/iot_rtc_api.h
Executable file
98
export/inc/bsp/iot_rtc_api.h
Executable file
@@ -0,0 +1,98 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef IOT_RTC_API_H
|
||||
#define IOT_RTC_API_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup RTC_APIs RTC APIs
|
||||
* @brief WQ30x1 RTC API
|
||||
*/
|
||||
|
||||
typedef struct iot_time_tm
|
||||
{
|
||||
uint16_t tm_year; /*year, need when set*/
|
||||
uint8_t tm_mon; /*month, need when set*/
|
||||
uint8_t tm_mday; /*day in the month, need when set*/
|
||||
uint8_t tm_hour; /*hour, need when set*/
|
||||
uint8_t tm_min; /*minute, need when set*/
|
||||
uint8_t tm_sec; /*second, need when set*/
|
||||
} iot_time_tm_t;
|
||||
|
||||
/** @addtogroup RTC_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief iot_rtc_set(iot_time_tm_t *tm) - set RTC data
|
||||
* @param tm: time zone param
|
||||
*
|
||||
*/
|
||||
void iot_rtc_set(iot_time_tm_t *tm);
|
||||
|
||||
/**
|
||||
* @brief iot_rtc_get(iot_time_tm_t *tm) - get current RTC data
|
||||
* @param tm: time zone param
|
||||
*/
|
||||
void iot_rtc_get(iot_time_tm_t *tm);
|
||||
|
||||
/**
|
||||
* @brief iot_rtc_delta_calc - time delta calc between tm1 and tm2.
|
||||
* @param tm1: time param.
|
||||
* @param tm2: time param.
|
||||
* @retval: delta time, uint is 1s. delta = tm2 - tm1.
|
||||
*/
|
||||
int64_t iot_rtc_delta_calc(iot_time_tm_t *tm1, iot_time_tm_t *tm2);
|
||||
|
||||
/**
|
||||
* @brief iot_rtc_delta_add - add time delta to tm.
|
||||
* @param delta_time: delta time, uint is 1s.
|
||||
* @param tm: time param.
|
||||
*/
|
||||
void iot_rtc_delta_add(int64_t delta_time, iot_time_tm_t *tm);
|
||||
|
||||
/**
|
||||
* @brief iot_is_rtc_data_revised - the rtc data whether is revised.
|
||||
* @retval: 0 - isn't revised, 1 - is revised.
|
||||
*/
|
||||
uint32_t iot_rtc_data_is_revised();
|
||||
|
||||
/**
|
||||
* @brief iot_time_valid() - check if time is valid
|
||||
* @param tm: pointer to time to be checked
|
||||
* @retval: 1 - valid, 0 - invalid
|
||||
*/
|
||||
uint8_t iot_time_valid(iot_time_tm_t *tm);
|
||||
|
||||
/**
|
||||
* @brief iot_time_ymdhms_valid() - check if time ymdhms is valid. valid range
|
||||
* is 1970-1-1-0:0:0 - 2099-12-31-23:59:59.
|
||||
* @param tm: pointer to time to be checked
|
||||
* @retval: 1 - valid, 0 - invalid
|
||||
*/
|
||||
uint8_t iot_time_ymdhms_valid(iot_time_tm_t *time);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //IOT_RTC_API_H
|
||||
Reference in New Issue
Block a user