XMC Peripheral Library for XMC4000 Family: RTC

XMC Peripheral Library for XMC4000 Family

XMC Peripheral Library for XMC4000 Family  2.1.16

Data Structures

struct  XMC_RTC_ALARM_t
 
struct  XMC_RTC_CONFIG_t
 
struct  XMC_RTC_TIME_t
 

Enumerations

Functions

void XMC_RTC_ClearEvent (const uint32_t event)
 
void XMC_RTC_Disable (void)
 
void XMC_RTC_DisableEvent (const uint32_t event)
 
void XMC_RTC_DisableHibernationWakeUp (const uint32_t event)
 
void XMC_RTC_Enable (void)
 
void XMC_RTC_EnableEvent (const uint32_t event)
 
void XMC_RTC_EnableHibernationWakeUp (const uint32_t event)
 
void XMC_RTC_GetAlarm (XMC_RTC_ALARM_t *const alarm)
 
void XMC_RTC_GetAlarmStdFormat (struct tm *const stdtime)
 
uint32_t XMC_RTC_GetEventStatus (void)
 
uint32_t XMC_RTC_GetPrescaler (void)
 
void XMC_RTC_GetTime (XMC_RTC_TIME_t *const time)
 
void XMC_RTC_GetTimeStdFormat (struct tm *const stdtime)
 
XMC_RTC_STATUS_t XMC_RTC_Init (const XMC_RTC_CONFIG_t *const config)
 
bool XMC_RTC_IsEnabled (void)
 
bool XMC_RTC_IsRunning (void)
 
void XMC_RTC_SetAlarm (const XMC_RTC_ALARM_t *const alarm)
 
void XMC_RTC_SetAlarmStdFormat (const struct tm *const stdtime)
 
void XMC_RTC_SetPrescaler (uint16_t prescaler)
 
void XMC_RTC_SetTime (const XMC_RTC_TIME_t *const timeval)
 
void XMC_RTC_SetTimeStdFormat (const struct tm *const stdtime)
 
void XMC_RTC_Start (void)
 
void XMC_RTC_Stop (void)
 

Detailed Description

Real-time clock (RTC) is a clock that keeps track of the current time. Precise real time keeping is with a 32.768 KHz external crystal clock or a 32.768 KHz high precision internal clock. It provides a periodic time based interrupt and a programmable alarm interrupt on time match. It also supports wakeup from hibernate.

The RTC low level driver provides functions to configure and initialize the RTC hardware peripheral.

Enumeration Type Documentation

Events which enables interrupt request generation

Enumerator
XMC_RTC_EVENT_PERIODIC_SECONDS 

Mask value to enable an event on periodic seconds

XMC_RTC_EVENT_PERIODIC_MINUTES 

Mask value to enable an event on periodic seconds

XMC_RTC_EVENT_PERIODIC_HOURS 

Mask value to enable an event on periodic seconds

XMC_RTC_EVENT_PERIODIC_DAYS 

Mask value to enable an event on periodic seconds

XMC_RTC_EVENT_PERIODIC_MONTHS 

Mask value to enable an event on periodic seconds

XMC_RTC_EVENT_PERIODIC_YEARS 

Mask value to enable an event on periodic seconds

XMC_RTC_EVENT_ALARM 

Mask value to enable an event on periodic seconds

Months used to program the date

Status return values for RTC low level driver

Enumerator
XMC_RTC_STATUS_OK 

Operation successful

XMC_RTC_STATUS_ERROR 

Operation unsuccessful

XMC_RTC_STATUS_BUSY 

Busy with a previous request

Wakeup events for RTC from hibernate domain

Enumerator
XMC_RTC_WAKEUP_EVENT_ON_ALARM 

Wakeup from alarm event

XMC_RTC_WAKEUP_EVENT_ON_SECONDS 

Wakeup from seconds event

XMC_RTC_WAKEUP_EVENT_ON_MINUTES 

Wakeup from minutes event

XMC_RTC_WAKEUP_EVENT_ON_HOURS 

Wakeup from hours event

XMC_RTC_WAKEUP_EVENT_ON_DAYS 

Wakeup from days event

XMC_RTC_WAKEUP_EVENT_ON_MONTHS 

Wakeup from months event

XMC_RTC_WAKEUP_EVENT_ON_YEARS 

Wakeup from years event

Week days used program the date

Function Documentation

void XMC_RTC_ClearEvent ( const uint32_t  event)
Parameters
eventA valid RTC event (XMC_RTC_EVENT_t) or a valid combination of logically OR'd events
Returns
None
Description:
Clears periodic and alarm event(s) status
The function sets the bitfields of CLRSR register to clear status bits in RAWSTAT and STSSR registers. Setting the value for the the RTC event(s) containing in the XMC_RTC_EVENT_t clears the corresponding status bits in RAWSTAT and STSSR registers.
Related APIs:
XMC_RTC_GetEventStatus()
void XMC_RTC_Disable ( void  )
Returns
None
Description
Disables RTC peripheral for programming its registers
Empty function (Hibernate domain is not disabled).
Related APIs:
XMC_RTC_Enable(), XMC_SCU_RESET_AssertPeripheralReset()
void XMC_RTC_DisableEvent ( const uint32_t  event)
Parameters
eventA valid RTC event (XMC_RTC_EVENT_t) or a valid combination of logically OR'd events
Returns
None
Description:
Disable RTC periodic and alarm event(s)
The function resets the bitfields of MSKSR register to disable interrupt generation for requested RTC event(s). Resetting the masking value for the the event(s) containing in the XMC_RTC_EVENT_t blocks the generation of the interrupt.
Related APIs:
XMC_RTC_EnableEvent()
void XMC_RTC_DisableHibernationWakeUp ( const uint32_t  event)
Parameters
eventA valid RTC Wakeup event (XMC_RTC_WAKEUP_EVENT_t) or a valid combination of logically OR'd events
Returns
None
Description:
Disable Wakeup from hibernate mode
The function resets the bitfields of CTR register to disable wakeup from hibernate mode. Resetting the masking value for the RTC wakeup events containing in the XMC_RTC_WAKEUP_EVENT_t disables wakeup from hibernate mode.
Related APIs:
XMC_RTC_EnableHibernationWakeUp()
void XMC_RTC_Enable ( void  )
Returns
None
Description
Enables RTC peripheral for programming its registers
Enables the hibernate domain for accessing RTC peripheral registers.
Related APIs:
XMC_RTC_Disable(), XMC_SCU_RESET_DeassertPeripheralReset()
void XMC_RTC_EnableEvent ( const uint32_t  event)
Parameters
eventA valid RTC event (XMC_RTC_EVENT_t) or a valid combination of logically OR'd events
Returns
None
Description:
Enable RTC periodic and alarm event(s)
The function sets the bitfields of MSKSR register to enable interrupt generation for requested RTC event(s). Setting the masking value for the event(s) containing in the XMC_RTC_EVENT_t leads to a generation of the interrupt.
Related APIs:
XMC_RTC_DisableEvent()
void XMC_RTC_EnableHibernationWakeUp ( const uint32_t  event)
Parameters
eventA valid RTC Wakeup event (XMC_RTC_WAKEUP_EVENT_t) or a valid combination of logically OR'd events
Returns
None
Description:
Enable Wakeup from hibernate mode
The function sets the bitfields of CTR register to enable wakeup from hibernate mode. Setting the masking value for the RTC wakeup events containing in the XMC_RTC_WAKEUP_EVENT_t leads to a wakeup from hibernate mode.
Related APIs:
XMC_RTC_DisableHibernationWakeUp()
void XMC_RTC_GetAlarm ( XMC_RTC_ALARM_t *const  alarm)
Parameters
alarmPointer to a constant XMC_RTC_ALARM_t structure containing the time parameters alarm seconds, alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month and alarm year.
Returns
None
Description:
Gets the RTC module alarm time value
The function gets the alarm time values from ATIM0, ATIM1 registers. See the structure XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
Related APIs:
XMC_RTC_SetAlarm()
void XMC_RTC_GetAlarmStdFormat ( struct tm *const  stdtime)
Parameters
stdtimePointer to a constant ::tm structure containing the time parameters alarm seconds, alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month, alarm year(since 1900) and alarm days in a year in standard format.
Returns
None
Description:
Gets the RTC module alarm time value in standard format
The function gets the alarm time values from ATIM0, ATIM1 registers. See the structure XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
For days the valid range is (1 - Actual days of month), year (since 1900) and daysinyear (0 -365).
Related APIs:
XMC_RTC_SetAlarm(), XMC_RTC_GetAlarm()
uint32_t XMC_RTC_GetEventStatus ( void  )
Returns
None
Description:
Gets the RTC periodic and alarm event(s) status
The function reads the bitfields of STSSR register to get the status of RTC events. Reading the value of the register STSSR gives the status of the event(s) containing in the XMC_RTC_EVENT_t.
Related APIs:
XMC_RTC_ClearEvent()
uint32_t XMC_RTC_GetPrescaler ( void  )
Returns
None
Description:
Gets the RTC module prescaler value
The function reads the CTR.DIV bitfield to get the prescalar value. The default value for the prescalar with the 32.768kHz crystal (or the internal clock) is 7FFFH for a time interval of 1 sec.
Related APIs:
XMC_RTC_SetPrescaler()
void XMC_RTC_GetTime ( XMC_RTC_TIME_t *const  time)
Parameters
timePointer to a constant XMC_RTC_TIME_t structure containing the time parameters seconds, minutes, hours, days, daysofweek, month and year.
Returns
None
Description:
Gets the RTC module time value
The function gets the time values from TIM0, TIM1 registers. See the structure XMC_RTC_TIME_t for the valid range of time value parameters.
Related APIs:
XMC_RTC_SetTime()
void XMC_RTC_GetTimeStdFormat ( struct tm *const  stdtime)
Parameters
stdtimePointer to a constant ::tm structure containing the time parameters seconds, minutes, hours, days, daysofweek, month, year(since 1900) and days in a year in standard format.
Returns
None
Description:
Gets the RTC module time value in standard format
The function gets the time values from TIM0, TIM1 registers. See the structure XMC_RTC_TIME_t for the valid range of time value parameters.
For days the valid range is (1 - Actual days of month), year (since 1900) and daysinyear (0 -365).
Related APIs:
XMC_RTC_SetTime(), XMC_RTC_GetTime()
XMC_RTC_STATUS_t XMC_RTC_Init ( const XMC_RTC_CONFIG_t *const  config)
Parameters
configConstant pointer to a constant XMC_RTC_CONFIG_t structure containing the time, alarm time and clock divider(prescaler) configuration.
Returns
XMC_RTC_STATUS_t Always returns XMC_RTC_STATUS_OK (It contains only register assignment statements)
Description:
Initialize the RTC peripheral
The function enables the hibernate domain for accessing RTC peripheral registers, configures
internal clock divider, time and alarm values by writing to the CTR.DIV, TIM0, TIM1, ATIM0 and ATIM1 registers.
bool XMC_RTC_IsEnabled ( void  )
Returns
None
Description
Checks RTC peripheral is enabled for programming its registers
Checks the hibernate domain is enabled or not.
Related APIs:
XMC_RTC_Enable(), XMC_RTC_Disable(), XMC_SCU_RESET_DeassertPeripheralReset(), XMC_SCU_RESET_AssertPeripheralReset()
bool XMC_RTC_IsRunning ( void  )
Returns
bool true if RTC is running false if RTC is not running
Description:
Checks the running status of the RTC
The function reads the bitfield ENB of CTR register to get the running status of RTC.
Related APIs:
XMC_RTC_Start(), XMC_RTC_Stop()
void XMC_RTC_SetAlarm ( const XMC_RTC_ALARM_t *const  alarm)
Parameters
alarmConstant pointer to a constant XMC_RTC_ALARM_t structure containing the alarm time parameters alarm seconds, alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month and alarm year.
Returns
None
Description:
Sets the RTC module alarm time value
The function sets the ATIM0, ATIM1 registers with alarm time values. See the structure XMC_RTC_ALARM_t for the valid range of alarm time value parameters.
Related APIs:
XMC_RTC_GetAlarm()
void XMC_RTC_SetAlarmStdFormat ( const struct tm *const  stdtime)
Parameters
stdtimePointer to a ::tm structure containing the time parameters alarm seconds, alarm minutes, alarm hours, alarm days, alarm daysofweek, alarm month, alarm year(since 1900) and alarm days in a year in standard format.
Returns
None
Description:
Sets the RTC module alarm time value in standard format
The function sets the alarm time values from ATIM0, ATIM1 registers.
Related APIs:
XMC_RTC_SetAlarm(), XMC_RTC_GetAlarm()
void XMC_RTC_SetPrescaler ( uint16_t  prescaler)
Parameters
prescalerPrescaler value to be set
Returns
None
Description:
Sets the RTC module prescaler value
The function sets the CTR.DIV bitfield to configure the prescalar value. The default value for the prescalar with the 32.768kHz crystal (or the internal clock) is 7FFFH for a time interval of 1 sec. Before setting the prescaler value RTC should be in stop mode and hibernate domain should be enabled.
Related APIs:
XMC_RTC_Stop(), XMC_RTC_Enable(), XMC_RTC_GetPrescaler()
void XMC_RTC_SetTime ( const XMC_RTC_TIME_t *const  timeval)
Parameters
timevalContstant pointer to a constant XMC_RTC_TIME_t structure containing the time parameters seconds, minutes, hours, days, daysofweek, month and year.
Returns
None
Description:
Sets the RTC module time values
The function sets the TIM0, TIM1 registers with time values. The values can only be written when RTC is disabled. See the structure XMC_RTC_TIME_t for the valid range of time value parameters.
Related APIs:
XMC_RTC_GetTime(), XMC_RTC_Stop()
void XMC_RTC_SetTimeStdFormat ( const struct tm *const  stdtime)
Parameters
stdtimePointer to a ::tm structure containing the time parameters seconds, minutes, hours, days, daysofweek, month, year(since 1900) and days in a year in standard format.
Returns
None
Description:
Sets the RTC module time value in standard format
The function sets the time values from TIM0, TIM1 registers.
Related APIs:
XMC_RTC_SetTime(), XMC_RTC_GetTime()
void XMC_RTC_Start ( void  )
Returns
None
Description
Enables RTC peripheral to start counting time
The function starts the RTC for counting time by setting CTR.ENB bit. Before starting the RTC, it should not be in running mode and also hibernate domain should be enabled.
Related APIs:
XMC_RTC_Enable(), XMC_RTC_Stop(), XMC_SCU_RESET_DeassertPeripheralReset()
void XMC_RTC_Stop ( void  )
Returns
None
Description
Disables RTC peripheral to start counting time
The function stops the RTC for counting time by resetting CTR.ENB. Before stopping the RTC, hibernate domain should be enabled.
Related APIs:
XMC_RTC_Enable(), XMC_RTC_Start(), XMC_SCU_RESET_AssertPeripheralReset()
Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by   doxygen 1.8.11