mikroSDK Reference Manual

RTC Driver API Reference. More...

Functions list

void rtc_init ()
 Initialize the RTC module.
 
err_t rtc_start ()
 Start the RTC module.
 
err_t rtc_stop ()
 Stop the RTC module.
 
err_t rtc_reset ()
 Reset the RTC module.
 
err_t rtc_set_time (rtc_time_t *time)
 Configure time of RTC module.
 
err_t rtc_get_time (rtc_time_t *time)
 Get time from RTC module.
 
void rtc_system_reset ()
 Preforms system reset.
 

Function Documentation

◆ rtc_get_time()

err_t rtc_get_time ( rtc_time_t * time)

Configure rtc_time_t structure with the values from time registers.

Parameters
timertc_time_t structure.
Returns
The function can return one of the values defined by rtc_err_t structure, which is size dependant on the architecture.
Note
It is recommended to check return value for error.

Example

// Time structure.
static rtc_time_t time;
// Initialize RTC.
if ( RTC_SUCCESS != rtc_get_time( &time ) ) {
// Error handling strategy.
}
@ RTC_SUCCESS
Definition drv_rtc.h:58
err_t rtc_get_time(rtc_time_t *time)
Get time from RTC module.
void rtc_init()
Initialize the RTC module.
Structure representing the RTC time.
Definition drv_rtc.h:81

◆ rtc_init()

void rtc_init ( )

Initialize the RTC module.

Parameters
None.

Example

// Initialize RTC.

◆ rtc_reset()

err_t rtc_reset ( )

Reset the RTC counter to the default values of 0h:0m:0s.

Parameters
None.
Returns
The function can return one of the values defined by rtc_err_t structure, which is size dependant on the architecture.
Note
It is recommended to check return value for error.

Example

// RTC time structure.
static rtc_time_t time;
// Initalize the RTC module.
// Reset the RTC module.
if ( RTC_ERROR == rtc_reset() ) {
// Error handling strategy.
}
@ RTC_ERROR
Definition drv_rtc.h:59
err_t rtc_reset()
Reset the RTC module.

◆ rtc_set_time()

err_t rtc_set_time ( rtc_time_t * time)

Configure time registers with the values from rtc_time_t structure.

Parameters
timertc_time_t structure.
Returns
The function can return one of the values defined by rtc_err_t structure, which is size dependant on the architecture.
Note
It is recommended to check return value for error.

Example

// Time structure.
static rtc_time_t time;
// Initialize RTC.
// Modify time.
time.second = 0;
time.minute = 5;
time.hour = 3;
// Set time.
if ( RTC_SUCCESS != rtc_set_time( &time ) ) {
// Error handling strategy.
}
err_t rtc_set_time(rtc_time_t *time)
Configure time of RTC module.

◆ rtc_start()

err_t rtc_start ( )

Continue the RTC module count from the stored value in the counter register.

Parameters
None.
Returns
The function can return one of the values defined by rtc_err_t structure, which is size dependant on the architecture.
Note
It is recommended to configure RTC module using rtc_set_time( rtc_time_t *time ) before the first start and to check return value for error.

Example

// RTC time structure.
static rtc_time_t time;
// Initalize the RTC module.
// Start the RTC module.
if ( RTC_ERROR == rtc_start() ) {
// Error handling strategy.
}
err_t rtc_start()
Start the RTC module.

◆ rtc_stop()

err_t rtc_stop ( )

Stop the RTC module count.

Parameters
None.
Returns
The function can return one of the values defined by rtc_err_t structure, which is size dependant on the architecture.
Note
It is recommended to check return value for error.

Example

// RTC time structure.
static rtc_time_t time;
// Initalize the RTC module.
// Stop the RTC module.
if ( RTC_ERROR == rtc_stop() ) {
// Error handling strategy.
}
err_t rtc_stop()
Stop the RTC module.

◆ rtc_system_reset()

void rtc_system_reset ( )

Resets the core and all on-chip peripherals except the Debug interface.

Parameters
None.
Warning
System reset affects core and periferals, depending on the architecture you will need to reconfigure opened modules.

Example

// Time structure.
static rtc_time_t time;
// Initialize RTC.
// Reset.
void rtc_system_reset()
Preforms system reset.