VSF Documented
rtc_common.c File Reference
#include "hal/vsf_hal_cfg.h"
#include "hal/driver/driver.h"

Macros

#define VSF_RTC_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_rtc_init (vsf_rtc_t *rtc_ptr, vsf_rtc_cfg_t *cfg_ptr)
 Initialize a RTC instance.
 
void vsf_rtc_fini (vsf_rtc_t *rtc_ptr)
 Finalize a RTC instance.
 
fsm_rt_t vsf_rtc_enable (vsf_rtc_t *rtc_ptr)
 Enable a RTC instance.
 
fsm_rt_t vsf_rtc_disable (vsf_rtc_t *rtc_ptr)
 Disable a RTC instance.
 
vsf_err_t vsf_rtc_get (vsf_rtc_t *rtc_ptr, vsf_rtc_tm_t *rtc_tm)
 Get RTC date and time.
 
vsf_err_t vsf_rtc_set (vsf_rtc_t *rtc_ptr, const vsf_rtc_tm_t *rtc_tm)
 Set RTC date and time.
 
vsf_err_t vsf_rtc_get_time (vsf_rtc_t *rtc_ptr, vsf_rtc_time_t *second_ptr, vsf_rtc_time_t *millisecond_ptr)
 Get RTC time in seconds and milliseconds.
 
vsf_err_t vsf_rtc_set_time (vsf_rtc_t *rtc_ptr, vsf_rtc_time_t second, vsf_rtc_time_t millisecond)
 Set RTC time in seconds and milliseconds.
 
vsf_rtc_capability_t vsf_rtc_capability (vsf_rtc_t *rtc_ptr)
 Get the capability of RTC instance.
 
vsf_err_t vsf_rtc_get_configuration (vsf_rtc_t *rtc_ptr, vsf_rtc_cfg_t *cfg_ptr)
 Get the current configuration of an RTC instance.
 
vsf_err_t vsf_rtc_ctrl (vsf_rtc_t *rtc_ptr, vsf_rtc_ctrl_t ctrl, void *param)
 Calls the specified RTC command.
 
bool vsf_rtc_tm_is_valid (const vsf_rtc_tm_t *rtc_tm)
 
bool vsf_rtc_tm_is_epoch_time (const vsf_rtc_tm_t *rtc_tm)
 

Macro Definition Documentation

◆ VSF_RTC_CFG_FUNCTION_RENAME

#define VSF_RTC_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_rtc_init()

vsf_err_t vsf_rtc_init ( vsf_rtc_t * rtc_ptr,
vsf_rtc_cfg_t * cfg_ptr )

Initialize a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[in]cfg_ptrPointer to configuration structure vsf_rtc_cfg_t
Returns
vsf_err_t VSF_ERR_NONE if initialization successful, otherwise returns error code
Note
It is not necessary to call vsf_rtc_fini() to deinitialize. vsf_rtc_init() should be called before any other RTC API except vsf_rtc_capability().

◆ vsf_rtc_fini()

void vsf_rtc_fini ( vsf_rtc_t * rtc_ptr)

Finalize a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
None

◆ vsf_rtc_enable()

fsm_rt_t vsf_rtc_enable ( vsf_rtc_t * rtc_ptr)

Enable a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
fsm_rt_t FSM_RT_CPL if RTC was enabled, fsm_rt_on_going if RTC is still enabling

◆ vsf_rtc_disable()

fsm_rt_t vsf_rtc_disable ( vsf_rtc_t * rtc_ptr)

Disable a RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
fsm_rt_t FSM_RT_CPL if RTC was disabled, fsm_rt_on_going if RTC is still disabling

◆ vsf_rtc_get()

vsf_err_t vsf_rtc_get ( vsf_rtc_t * rtc_ptr,
vsf_rtc_tm_t * rtc_tm )

Get RTC date and time.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[out]rtc_tmDate and time (year, month, day, hour, minute, second, etc.)
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code

◆ vsf_rtc_set()

vsf_err_t vsf_rtc_set ( vsf_rtc_t * rtc_ptr,
const vsf_rtc_tm_t * rtc_tm )

Set RTC date and time.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[in]rtc_tmDate and time (year, month, day, hour, minute, second, etc.)
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code

◆ vsf_rtc_get_time()

vsf_err_t vsf_rtc_get_time ( vsf_rtc_t * rtc_ptr,
vsf_rtc_time_t * second_ptr,
vsf_rtc_time_t * millisecond_ptr )

Get RTC time in seconds and milliseconds.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[out]second_ptrSeconds
[out]millisecond_ptrMilliseconds
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code

◆ vsf_rtc_set_time()

vsf_err_t vsf_rtc_set_time ( vsf_rtc_t * rtc_ptr,
vsf_rtc_time_t seconds,
vsf_rtc_time_t milliseconds )

Set RTC time in seconds and milliseconds.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
[in]secondsSeconds
[in]millisecondsMilliseconds
Returns
vsf_err_t VSF_ERR_NONE if operation successful, otherwise returns error code

◆ vsf_rtc_capability()

vsf_rtc_capability_t vsf_rtc_capability ( vsf_rtc_t * rtc_ptr)

Get the capability of RTC instance.

Parameters
[in]rtc_ptrPointer to structure vsf_rtc_t
Returns
vsf_rtc_capability_t All capabilities of current RTC, reference vsf_rtc_capability_t

◆ vsf_rtc_get_configuration()

vsf_err_t vsf_rtc_get_configuration ( vsf_rtc_t * rtc_ptr,
vsf_rtc_cfg_t * cfg_ptr )

Get the current configuration of an RTC instance.

Parameters
[in]rtc_ptrpointer to structure vsf_rtc_t
[out]cfg_ptrpointer to configuration structure vsf_rtc_cfg_t to store the current configuration
Returns
vsf_err_t: VSF_ERR_NONE if successful, otherwise return error code
Note
This function retrieves the current RTC configuration including interrupt settings and other parameters. The RTC instance should be initialized before calling this function.

◆ vsf_rtc_ctrl()

vsf_err_t vsf_rtc_ctrl ( vsf_rtc_t * rtc_ptr,
vsf_rtc_ctrl_t ctrl,
void * param )

Calls the specified RTC command.

Parameters
[in]rtc_ptra pointer to structure vsf_rtc_t
[in]ctrlRTC control command vsf_rtc_ctrl_t
[in,out]paramthe parameter of the command, its use is determined by the command
Returns
vsf_err_t: returns VSF_ERR_NONE if successful, or a negative error code

◆ vsf_rtc_tm_is_valid()

bool vsf_rtc_tm_is_valid ( const vsf_rtc_tm_t * rtc_tm)

◆ vsf_rtc_tm_is_epoch_time()

bool vsf_rtc_tm_is_epoch_time ( const vsf_rtc_tm_t * rtc_tm)
Generated from commit: vsfteam/vsf@ceb53fd