![]() |
S32 SDK
|
Real Time Clock Driver Peripheral Driver.
Data Structures | |
struct | rtc_timedate_t |
RTC Time Date structure Implements : rtc_timedate_t_Class. More... | |
struct | rtc_init_config_t |
RTC Initialization structure Implements : rtc_init_config_t_Class. More... | |
struct | rtc_alarm_config_t |
RTC alarm configuration Implements : rtc_alarm_config_t_Class. More... | |
struct | rtc_interrupt_config_t |
RTC interrupt configuration. It is used to configure interrupt other than Time Alarm and Time Seconds interrupt Implements : rtc_interrupt_config_t_Class. More... | |
struct | rtc_seconds_int_config_t |
RTC Seconds Interrupt Configuration Implements : rtc_seconds_int_config_t_Class. More... | |
struct | rtc_register_lock_config_t |
RTC Register Lock Configuration Implements : rtc_register_lock_config_t_Class. More... | |
Macros | |
#define | SECONDS_IN_A_DAY (86400UL) |
#define | SECONDS_IN_A_HOUR (3600U) |
#define | SECONDS_IN_A_MIN (60U) |
#define | MINS_IN_A_HOUR (60U) |
#define | HOURS_IN_A_DAY (24U) |
#define | DAYS_IN_A_YEAR (365U) |
#define | DAYS_IN_A_LEAP_YEAR (366U) |
#define | YEAR_RANGE_START (1970U) |
#define | YEAR_RANGE_END (2099U) |
Functions | |
status_t | RTC_DRV_Init (uint32_t instance, const rtc_init_config_t *const rtcUserCfg) |
This function initializes the RTC instance with the settings provided by the user via the rtcUserCfg parameter. The user must ensure that clock is enabled for the RTC instance used. If the Control register is locked then this method returns STATUS_ERROR. In order to clear the CR Lock the user must perform a power-on reset. More... | |
status_t | RTC_DRV_Deinit (uint32_t instance) |
This function deinitializes the RTC instance. If the Control register is locked then this method returns STATUS_ERROR. More... | |
status_t | RTC_DRV_StartCounter (uint32_t instance) |
Start RTC instance counter. Before calling this function the user should use RTC_DRV_SetTimeDate to configure the start time. More... | |
status_t | RTC_DRV_StopCounter (uint32_t instance) |
Disable RTC instance counter. More... | |
status_t | RTC_DRV_GetCurrentTimeDate (uint32_t instance, rtc_timedate_t *const currentTime) |
Get current time and date from RTC instance. More... | |
status_t | RTC_DRV_SetTimeDate (uint32_t instance, const rtc_timedate_t *const time) |
Set time and date for RTC instance. The user must stop the counter before using this function. Otherwise it will return an error. More... | |
status_t | RTC_DRV_ConfigureRegisterLock (uint32_t instance, const rtc_register_lock_config_t *const lockConfig) |
This method configures register lock for the corresponding RTC instance. Remember that all the registers are unlocked only by software reset or power on reset. (Except for CR that is unlocked only by POR). More... | |
void | RTC_DRV_GetRegisterLock (uint32_t instance, rtc_register_lock_config_t *const lockConfig) |
Get which registers are locked for RTC instance. More... | |
status_t | RTC_DRV_ConfigureTimeCompensation (uint32_t instance, uint8_t compInterval, int8_t compensation) |
This method configures time compensation. Data is passed by the compInterval and compensation parameters. For more details regarding coefficient calculation see the Reference Manual. More... | |
void | RTC_DRV_GetTimeCompensation (uint32_t instance, uint8_t *compInterval, int8_t *compensation) |
This retrieves the time compensation coefficients and saves them on the variables referenced by the parameters. More... | |
void | RTC_DRV_ConfigureFaultInt (uint32_t instance, rtc_interrupt_config_t *const intConfig) |
This method configures fault interrupts such as: More... | |
void | RTC_DRV_ConfigureSecondsInt (uint32_t instance, rtc_seconds_int_config_t *const intConfig) |
This method configures the Time Seconds Interrupt with the configuration from the intConfig parameter. More... | |
status_t | RTC_DRV_ConfigureAlarm (uint32_t instance, rtc_alarm_config_t *const alarmConfig) |
This method configures the alarm with the configuration from the alarmConfig parameter. More... | |
void | RTC_DRV_GetAlarmConfig (uint32_t instance, rtc_alarm_config_t *alarmConfig) |
Get alarm configuration for RTC instance. More... | |
bool | RTC_DRV_IsAlarmPending (uint32_t instance) |
Check if alarm is pending. More... | |
void | RTC_DRV_ConvertSecondsToTimeDate (const uint32_t *seconds, rtc_timedate_t *const timeDate) |
Convert seconds to rtc_timedate_t structure. More... | |
void | RTC_DRV_ConvertTimeDateToSeconds (const rtc_timedate_t *const timeDate, uint32_t *const seconds) |
Convert seconds to rtc_timedate_t structure. More... | |
bool | RTC_DRV_IsYearLeap (uint16_t year) |
Check if the current year is leap. More... | |
bool | RTC_DRV_IsTimeDateCorrectFormat (const rtc_timedate_t *const timeDate) |
Check if the date time struct is configured properly. More... | |
status_t | RTC_DRV_GetNextAlarmTime (uint32_t instance, rtc_timedate_t *const alarmTime) |
Gets the next alarm time. More... | |
void | RTC_DRV_IRQHandler (uint32_t instance) |
This method is the API's Interrupt handler for generic and alarm IRQ. It will handle the alarm repetition and calls the user callbacks if they are not NULL. More... | |
void | RTC_DRV_SecondsIRQHandler (uint32_t instance) |
This method is the API's Interrupt handler for RTC Second interrupt. This ISR will call the user callback if defined. More... | |
#define DAYS_IN_A_LEAP_YEAR (366U) |
Definition at line 43 of file rtc_driver.h.
#define DAYS_IN_A_YEAR (365U) |
Definition at line 42 of file rtc_driver.h.
#define HOURS_IN_A_DAY (24U) |
Definition at line 41 of file rtc_driver.h.
#define MINS_IN_A_HOUR (60U) |
Definition at line 40 of file rtc_driver.h.
#define SECONDS_IN_A_DAY (86400UL) |
Definition at line 37 of file rtc_driver.h.
#define SECONDS_IN_A_HOUR (3600U) |
Definition at line 38 of file rtc_driver.h.
#define SECONDS_IN_A_MIN (60U) |
Definition at line 39 of file rtc_driver.h.
#define YEAR_RANGE_END (2099U) |
Definition at line 45 of file rtc_driver.h.
#define YEAR_RANGE_START (1970U) |
Definition at line 44 of file rtc_driver.h.
status_t RTC_DRV_ConfigureAlarm | ( | uint32_t | instance, |
rtc_alarm_config_t *const | alarmConfig | ||
) |
This method configures the alarm with the configuration from the alarmConfig parameter.
[in] | instance | The number of the RTC instance used |
[in] | alarmConfig | Pointer to the structure which holds the alarm configuration |
Definition at line 914 of file rtc_driver.c.
void RTC_DRV_ConfigureFaultInt | ( | uint32_t | instance, |
rtc_interrupt_config_t *const | intConfig | ||
) |
This method configures fault interrupts such as:
[in] | instance | The number of the RTC instance used |
[in] | intConfig | Pointer to the structure which holds the configuration |
Definition at line 857 of file rtc_driver.c.
status_t RTC_DRV_ConfigureRegisterLock | ( | uint32_t | instance, |
const rtc_register_lock_config_t *const | lockConfig | ||
) |
This method configures register lock for the corresponding RTC instance. Remember that all the registers are unlocked only by software reset or power on reset. (Except for CR that is unlocked only by POR).
[in] | instance | The number of the RTC instance used |
[in] | lockConfig | Pointer to the lock configuration structure |
Definition at line 413 of file rtc_driver.c.
void RTC_DRV_ConfigureSecondsInt | ( | uint32_t | instance, |
rtc_seconds_int_config_t *const | intConfig | ||
) |
This method configures the Time Seconds Interrupt with the configuration from the intConfig parameter.
[in] | instance | The number of the RTC instance used |
[in] | intConfig | Pointer to the structure which holds the configuration |
Definition at line 884 of file rtc_driver.c.
status_t RTC_DRV_ConfigureTimeCompensation | ( | uint32_t | instance, |
uint8_t | compInterval, | ||
int8_t | compensation | ||
) |
This method configures time compensation. Data is passed by the compInterval and compensation parameters. For more details regarding coefficient calculation see the Reference Manual.
[in] | instance | The number of the RTC instance used |
[in] | compInterval | Compensation interval |
[in] | compensation | Compensation value |
Definition at line 488 of file rtc_driver.c.
void RTC_DRV_ConvertSecondsToTimeDate | ( | const uint32_t * | seconds, |
rtc_timedate_t *const | timeDate | ||
) |
Convert seconds to rtc_timedate_t structure.
[in] | seconds | Pointer to the seconds |
[out] | timeDate | Pointer to the structure in which to store the result |
Definition at line 538 of file rtc_driver.c.
void RTC_DRV_ConvertTimeDateToSeconds | ( | const rtc_timedate_t *const | timeDate, |
uint32_t *const | seconds | ||
) |
Convert seconds to rtc_timedate_t structure.
[in] | timeDate | Pointer to the source struct |
[out] | seconds | Pointer to the variable in which to store the result |
Definition at line 632 of file rtc_driver.c.
status_t RTC_DRV_Deinit | ( | uint32_t | instance | ) |
This function deinitializes the RTC instance. If the Control register is locked then this method returns STATUS_ERROR.
[in] | instance | The number of the RTC instance used |
Definition at line 165 of file rtc_driver.c.
void RTC_DRV_GetAlarmConfig | ( | uint32_t | instance, |
rtc_alarm_config_t * | alarmConfig | ||
) |
Get alarm configuration for RTC instance.
[in] | instance | The number of the RTC instance used |
[out] | alarmConfig | Pointer to the structure in which to store the alarm configuration |
Definition at line 968 of file rtc_driver.c.
status_t RTC_DRV_GetCurrentTimeDate | ( | uint32_t | instance, |
rtc_timedate_t *const | currentTime | ||
) |
Get current time and date from RTC instance.
[in] | instance | The number of the RTC instance used |
[out] | currentTime | Pointer to the variable in which to store the result |
Definition at line 315 of file rtc_driver.c.
status_t RTC_DRV_GetNextAlarmTime | ( | uint32_t | instance, |
rtc_timedate_t *const | alarmTime | ||
) |
Gets the next alarm time.
[in] | instance | The number of the RTC instance used |
[out] | alarmTime | Pointer to the variable in which to store the data |
Definition at line 1000 of file rtc_driver.c.
void RTC_DRV_GetRegisterLock | ( | uint32_t | instance, |
rtc_register_lock_config_t *const | lockConfig | ||
) |
Get which registers are locked for RTC instance.
[in] | instance | The number of the RTC instance used |
[out] | lockConfig | Pointer to the lock configuration structure in which to save the data |
Definition at line 460 of file rtc_driver.c.
void RTC_DRV_GetTimeCompensation | ( | uint32_t | instance, |
uint8_t * | compInterval, | ||
int8_t * | compensation | ||
) |
This retrieves the time compensation coefficients and saves them on the variables referenced by the parameters.
[in] | instance | The number of the RTC instance used |
[out] | compInterval | Pointer to the variable in which to save the compensation interval |
[out] | compensation | Pointer to the variable in which to save the compensation value |
Definition at line 521 of file rtc_driver.c.
status_t RTC_DRV_Init | ( | uint32_t | instance, |
const rtc_init_config_t *const | rtcUserCfg | ||
) |
This function initializes the RTC instance with the settings provided by the user via the rtcUserCfg parameter. The user must ensure that clock is enabled for the RTC instance used. If the Control register is locked then this method returns STATUS_ERROR. In order to clear the CR Lock the user must perform a power-on reset.
[in] | instance | The number of the RTC instance used |
[in] | rtcUserCfg | Pointer to the user's configuration structure |
Definition at line 100 of file rtc_driver.c.
void RTC_DRV_IRQHandler | ( | uint32_t | instance | ) |
This method is the API's Interrupt handler for generic and alarm IRQ. It will handle the alarm repetition and calls the user callbacks if they are not NULL.
[in] | instance | RTC instance used |
Definition at line 760 of file rtc_driver.c.
bool RTC_DRV_IsAlarmPending | ( | uint32_t | instance | ) |
Check if alarm is pending.
[in] | instance | The number of the RTC instance used |
Definition at line 983 of file rtc_driver.c.
bool RTC_DRV_IsTimeDateCorrectFormat | ( | const rtc_timedate_t *const | timeDate | ) |
Check if the date time struct is configured properly.
[in] | timeDate | Structure to check to check |
Definition at line 682 of file rtc_driver.c.
bool RTC_DRV_IsYearLeap | ( | uint16_t | year | ) |
Check if the current year is leap.
[in] | year | Year to check |
Definition at line 724 of file rtc_driver.c.
void RTC_DRV_SecondsIRQHandler | ( | uint32_t | instance | ) |
This method is the API's Interrupt handler for RTC Second interrupt. This ISR will call the user callback if defined.
[in] | instance | RTC instance used |
Definition at line 832 of file rtc_driver.c.
status_t RTC_DRV_SetTimeDate | ( | uint32_t | instance, |
const rtc_timedate_t *const | time | ||
) |
Set time and date for RTC instance. The user must stop the counter before using this function. Otherwise it will return an error.
[in] | instance | The number of the RTC instance used |
[in] | time | Pointer to the variable in which the time is stored |
Definition at line 370 of file rtc_driver.c.
status_t RTC_DRV_StartCounter | ( | uint32_t | instance | ) |
Start RTC instance counter. Before calling this function the user should use RTC_DRV_SetTimeDate to configure the start time.
[in] | instance | The number of the RTC instance used |
Definition at line 253 of file rtc_driver.c.
status_t RTC_DRV_StopCounter | ( | uint32_t | instance | ) |
Disable RTC instance counter.
[in] | instance | The number of the RTC instance used |
Definition at line 284 of file rtc_driver.c.