Classes | Macros | Typedefs | Enumerations | Functions
hal_rtc.h File Reference

Header file containing functions prototypes of RTC HAL library. More...

`#include "ll_rtc.h"`
`#include "hal_def.h"`

Go to the source code of this file.

## Classes
struct | rtc_init_t
| rtc init params More...
struct | tick_handle_t
| tick handle params More...
struct | _alarm_handle_t
| alarm handle params More...
struct | _rtc_handle_t
| rtc handle definition More...
struct | _hal_rtc_callback
| HAL_RTC Callback function definition. More...

## Macros
#define | RTC_FLAG_ALARM RTC_INT_STAT_ALARM
#define | RTC_FLAG_WRAP RTC_INT_STAT_WRAP
#define | RTC_FLAG_TICK RTC_INT_STAT_TICK
#define | RTC_IT_ALARM RTC_INT_EN_ALARM
#define | RTC_IT_WRAP RTC_INT_EN_WRAP
#define | RTC_IT_TICK RTC_INT_EN_TICK
#define | HAL_RTC_ERROR_NONE (0x00000000U)
#define | HAL_RTC_ERROR_INVALID_PARAM (0x00000001U)
#define | HAL_RTC_ERROR_TIMEOUT (0x00000002U)
#define | RTC_DIV_NONE LL_RTC_DIV_NONE
#define | RTC_DIV_2 LL_RTC_DIV_2
#define | RTC_DIV_4 LL_RTC_DIV_4
#define | RTC_DIV_8 LL_RTC_DIV_8
#define | RTC_DIV_16 LL_RTC_DIV_16
#define | RTC_DIV_32 LL_RTC_DIV_32
#define | RTC_DIV_64 LL_RTC_DIV_64
#define | RTC_DIV_128 LL_RTC_DIV_128
#define | ONE_TIME LL_RTC_TIMER_TICK_TYPE_SINGLE
#define | AUTO_RELOAD LL_RTC_TIMER_TICK_TYPE_AUTO
#define | __HAL_RTC_DISABLE(RTCx) MODIFY_REG(RTCx->CFG0, 0xFFFFFFFFU, RTC_CFG0_CFG);
| Disable the specified RTC peripheral. More...
#define | __HAL_RTC_ENABLE(RTCx) WRITE_REG(RTCx->CFG0, RTC_CFG0_CFG | RTC_CFG0_EN);
| Enable the specified RTC peripheral. More...
#define | __HAL_RTC_BUSY_FLAG(RTCx) ((READ_BITS(RTCx->STAT, RTC_STAT_BUSY) == RTC_STAT_BUSY))
| Get the specified RTC peripheral busy flag. More...
#define | __HAL_RTC_CLEAR_FLAG(RTCx, __FLAG__) WRITE_REG(RTCx->INT_STAT, (__FLAG__))
| Clear the specified RTC flag. More...
#define | __HAL_RTC_ENABLE_IT(RTCx, __INTERRUPT__) SET_BITS(RTCx->INT_EN, (__INTERRUPT__))
| Enable the specified RTC interrupts. More...
#define | __HAL_RTC_DISABLE_IT(RTCx, __INTERRUPT__) CLEAR_BITS(RTCx->INT_EN, (__INTERRUPT__))
| Disable the specified RTC interrupts. More...
#define | __HAL_RTC_GET_IT_SOURCE(RTCx, __FLAG__) (READ_BITS(RTCx->INT_STAT, (__FLAG__)) == (__FLAG__))
| Check whether the specified RTC interrupt flag is set or not. More...

## Typedefs
typedef struct _alarm_handle_t | alarm_handle_t
| alarm handle params More...
typedef struct _rtc_handle_t | rtc_handle_t
| rtc handle definition More...
typedef struct _hal_rtc_callback | hal_rtc_callback_t
| HAL_RTC Callback function definition. More...

## Enumerations
enum | hal_rtc_state_t { HAL_RTC_READY = 0x00U, HAL_RTC_RESET, HAL_RTC_RUNNING, HAL_RTC_ERROR }
| hal_rtc_state definition More...
enum | rtc_tick_state_t { TICK_READY = 0x00U, TICK_RUNNING, TICK_ERROR }
| rtc_tick_state definition More...
enum | rtc_alarm_state_t { ALARM_READY = 0x00U, ALARM_RUNNING, ALARM_ERROR }
| rtc_alarm_state definition More...
enum | overflow_det_t { CLOSED = 0x00U, OPENED = !CLOSED }
| overflow config More...

## Functions
hal_status_t | hal_rtc_init (rtc_handle_t *p_rtc)
| Initialize the RTC according to the specified parameters in the rtc_init_t of associated handle.counter start after hal_rtc_init. More...
hal_status_t | hal_rtc_deinit (rtc_handle_t *p_rtc)
| DeInitialize the RTC according to the specified parameters in the rtc_init_t of associated handle.counter stop after hal_rtc_deinit. More...
hal_status_t | hal_rtc_set_tick_and_start (rtc_handle_t *p_rtc, uint8_t mode, uint32_t value)
| Start counting down for tick module. More...
hal_status_t | hal_rtc_stop_tick (rtc_handle_t *p_rtc)
| Stop counting down for tick module. More...
hal_status_t | hal_rtc_restart_tick (rtc_handle_t *p_rtc)
| Restart tick module and continue run with the previous settings. This function need be called after hal_rtc_stop_tick. More...
hal_status_t | hal_rtc_set_alarm (rtc_handle_t *p_rtc, uint32_t value)
| Compare counter with alarm_value for alarm module. More...
hal_status_t | hal_rtc_stop_alarm (rtc_handle_t *p_rtc)
| Stop counting up and compare with alarm_value for alarm module. More...
hal_status_t | hal_rtc_clear_wrap (rtc_handle_t *p_rtc)
| Clear wrap count. More...
uint32_t | hal_rtc_get_wrap_count (const rtc_handle_t *p_rtc)
| Get the times of overflow. More...
uint32_t | hal_rtc_get_cur_count (const rtc_handle_t *p_rtc)
| Get_cur_count_value. More...
uint32_t | hal_rtc_get_cur_tick (const rtc_handle_t *p_rtc)
| Get_cur_tick_value. More...
uint32_t | hal_rtc_get_alarm_value (const rtc_handle_t *p_rtc)
| Get_alarm_value. More...
hal_rtc_state_t | hal_rtc_get_state (const rtc_handle_t *p_rtc)
| Get_cur_rtc_state. More...
void | hal_rtc_irq_handler (rtc_handle_t *p_rtc)
| RTC_IRQHandler. More...
void | hal_rtc_alarm_callback (rtc_handle_t *p_rtc)
| alarm_callback More...
void | hal_rtc_overflow_callback (rtc_handle_t *p_rtc)
| overflow_callback More...
void | hal_rtc_tick_callback (rtc_handle_t *p_rtc)
| tick_callback More...

## Detailed Description

Header file containing functions prototypes of RTC HAL library.

Author
  BLE Driver Team

Attention
  #####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file hal_rtc.h.