summaryrefslogtreecommitdiff
path: root/bsp/bouffalo_lab/libraries/bl_mcu_sdk/drivers/lhal/include/bflb_rtc.h
blob: 1a510c9acdbf09f47aef243543aefe212e0303bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef _BFLB_RTC_H
#define _BFLB_RTC_H

#include "bflb_core.h"

/** @addtogroup LHAL
  * @{
  */

/** @addtogroup RTC
  * @{
  */

#define BFLB_RTC_SEC2TIME(s)    (s * 32768)
#define BFLB_RTC_TIME2SEC(time) (time / 32768)

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief clear and disable rtc.
 *
 * @param [in] dev device handle
 */
void bflb_rtc_disable(struct bflb_device_s *dev);

/**
 * @brief Set rtc alarming time.
 *
 * @param [in] dev device handle
 * @param [in] time alarming time, unit is (1/32768 s)
 */
void bflb_rtc_set_time(struct bflb_device_s *dev, uint64_t time);

/**
 * @brief Get rtc current time.
 *
 * @param [in] dev device handle
 * @return current rtc running time
 */
uint64_t bflb_rtc_get_time(struct bflb_device_s *dev);

#ifdef __cplusplus
}
#endif

/**
  * @}
  */

/**
  * @}
  */

#endif