1 #ifndef _BFLB_RTC_H 2 #define _BFLB_RTC_H 3 4 #include "bflb_core.h" 5 6 /** @addtogroup LHAL 7 * @{ 8 */ 9 10 /** @addtogroup RTC 11 * @{ 12 */ 13 14 #define BFLB_RTC_SEC2TIME(s) (s * 32768) 15 #define BFLB_RTC_TIME2SEC(time) (time / 32768) 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 /** 22 * @brief clear and disable rtc. 23 * 24 * @param [in] dev device handle 25 */ 26 void bflb_rtc_disable(struct bflb_device_s *dev); 27 28 /** 29 * @brief Set rtc alarming time. 30 * 31 * @param [in] dev device handle 32 * @param [in] time alarming time, unit is (1/32768 s) 33 */ 34 void bflb_rtc_set_time(struct bflb_device_s *dev, uint64_t time); 35 36 /** 37 * @brief Get rtc current time. 38 * 39 * @param [in] dev device handle 40 * @return current rtc running time 41 */ 42 uint64_t bflb_rtc_get_time(struct bflb_device_s *dev); 43 44 #ifdef __cplusplus 45 } 46 #endif 47 48 /** 49 * @} 50 */ 51 52 /** 53 * @} 54 */ 55 56 #endif