![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Real Time Clock module of MCUXpresso SDK devices.
Example use of RTC API. Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/rtc/
Data Structures | |
| struct | rtc_datetime_t |
| Structure is used to hold the date and time. More... | |
| struct | rtc_config_t |
| RTC config structure. More... | |
Typedefs | |
| typedef void(* | rtc_alarm_callback_t )(void) |
| RTC alarm callback function. More... | |
Enumerations | |
| enum | rtc_clock_source_t { kRTC_ExternalClock = 0U, kRTC_LPOCLK = 1U, kRTC_ICSIRCLK = 2U, kRTC_BusClock = 3U } |
| List of RTC clock source. More... | |
| enum | rtc_clock_prescaler_t { kRTC_ClockDivide_off = 0U, kRTC_ClockDivide_1_128 = 1U, kRTC_ClockDivide_2_256 = 2U, kRTC_ClockDivide_4_512 = 3U, kRTC_ClockDivide_8_1024 = 4U, kRTC_ClockDivide_16_2048 = 5U, kRTC_ClockDivide_32_100 = 6U, kRTC_ClockDivide_64_1000 = 7U } |
| List of RTC clock prescaler. More... | |
| enum | rtc_interrupt_enable_t { kRTC_InterruptEnable = RTC_SC_RTIE_MASK } |
| List of RTC interrupts. More... | |
| enum | rtc_interrupt_flags_t { kRTC_InterruptFlag = RTC_SC_RTIF_MASK } |
| List of RTC Interrupt flags. More... | |
| enum | rtc_output_enable_t { kRTC_OutputEnable = RTC_SC_RTCO_MASK } |
| List of RTC Output. More... | |
Driver version | |
| #define | FSL_RTC_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
| Version 2.0.2. | |
Initialization and deinitialization | |
| void | RTC_Init (RTC_Type *base, const rtc_config_t *config) |
| Ungates the RTC clock and configures the peripheral for basic operation. More... | |
| void | RTC_Deinit (RTC_Type *base) |
| Stops the timer and gate the RTC clock. More... | |
| void | RTC_GetDefaultConfig (rtc_config_t *config) |
| Fills in the RTC config struct with the default settings. More... | |
Current Time & Alarm | |
| status_t | RTC_SetDatetime (rtc_datetime_t *datetime) |
| Sets the RTC date and time according to the given time structure. More... | |
| void | RTC_GetDatetime (rtc_datetime_t *datetime) |
| Gets the RTC time and stores it in the given time structure. More... | |
| void | RTC_SetAlarm (uint32_t second) |
| Sets the RTC alarm time. More... | |
| void | RTC_GetAlarm (rtc_datetime_t *datetime) |
| Returns the RTC alarm time. More... | |
| void | RTC_SetAlarmCallback (rtc_alarm_callback_t callback) |
| Set the RTC alarm callback. More... | |
Select Source clock | |
| static void | RTC_SelectSourceClock (RTC_Type *base, rtc_clock_source_t clock, rtc_clock_prescaler_t divide) |
| Select Real-Time Clock Source and Clock Prescaler. More... | |
| uint32_t | RTC_GetDivideValue (RTC_Type *base) |
| Get the RTC Divide value. More... | |
Interrupt Interface | |
| static void | RTC_EnableInterrupts (RTC_Type *base, uint32_t mask) |
| Enables the selected RTC interrupts. More... | |
| static void | RTC_DisableInterrupts (RTC_Type *base, uint32_t mask) |
| Disables the selected RTC interrupts. More... | |
| static uint32_t | RTC_GetEnabledInterrupts (RTC_Type *base) |
| Gets the enabled RTC interrupts. More... | |
| static uint32_t | RTC_GetInterruptFlags (RTC_Type *base) |
| Gets the RTC interrupt flags. More... | |
| static void | RTC_ClearInterruptFlags (RTC_Type *base, uint32_t mask) |
| Clears the RTC interrupt flags. More... | |
Output Interface | |
| static void | RTC_EnableOutput (RTC_Type *base, uint32_t mask) |
| Enable the RTC output. More... | |
| static void | RTC_DisableOutput (RTC_Type *base, uint32_t mask) |
| Disable the RTC output. More... | |
Set module value and Get Count value | |
| static void | RTC_SetModuloValue (RTC_Type *base, uint32_t value) |
| Set the RTC module value. More... | |
| static uint16_t | RTC_GetCountValue (RTC_Type *base) |
| Get the RTC Count value. More... | |
| struct rtc_datetime_t |
Data Fields | |
| uint16_t | year |
| Range from 1970 to 2099. More... | |
| uint8_t | month |
| Range from 1 to 12. More... | |
| uint8_t | day |
| Range from 1 to 31 (depending on month). More... | |
| uint8_t | hour |
| Range from 0 to 23. More... | |
| uint8_t | minute |
| Range from 0 to 59. More... | |
| uint8_t | second |
| Range from 0 to 59. More... | |
| uint16_t rtc_datetime_t::year |
| uint8_t rtc_datetime_t::month |
| uint8_t rtc_datetime_t::day |
| uint8_t rtc_datetime_t::hour |
| uint8_t rtc_datetime_t::minute |
| uint8_t rtc_datetime_t::second |
| struct rtc_config_t |
This structure holds the configuration settings for the RTC peripheral. To initialize this structure to reasonable defaults, call the RTC_GetDefaultConfig() function and pass a pointer to your config structure instance.
| typedef void(* rtc_alarm_callback_t)(void) |
| enum rtc_clock_source_t |
| enum rtc_output_enable_t |
| void RTC_Init | ( | RTC_Type * | base, |
| const rtc_config_t * | config | ||
| ) |
| base | RTC peripheral base address |
| void RTC_Deinit | ( | RTC_Type * | base | ) |
| base | RTC peripheral base address |
| void RTC_GetDefaultConfig | ( | rtc_config_t * | config | ) |
The default values are as follows.
| config | Pointer to the user's RTC configuration structure. |
| status_t RTC_SetDatetime | ( | rtc_datetime_t * | datetime | ) |
| datetime | Pointer to the structure where the date and time details are stored. |
| void RTC_GetDatetime | ( | rtc_datetime_t * | datetime | ) |
| datetime | Pointer to the structure where the date and time details are stored. |
| void RTC_SetAlarm | ( | uint32_t | second | ) |
| second | Second value. User input the number of second. After seconds user input, alarm occurs. |
| void RTC_GetAlarm | ( | rtc_datetime_t * | datetime | ) |
| datetime | Pointer to the structure where the alarm date and time details are stored. |
| void RTC_SetAlarmCallback | ( | rtc_alarm_callback_t | callback | ) |
| callback | The callback function. |
|
inlinestatic |
| base | RTC peripheral base address |
| clock | Select RTC clock source |
| divide | Select RTC clock prescaler value |
| uint32_t RTC_GetDivideValue | ( | RTC_Type * | base | ) |
| base | RTC peripheral base address |
|
inlinestatic |
| base | RTC peripheral base address |
| mask | The interrupts to enable. This is a logical OR of members of the enumeration rtc_interrupt_enable_t |
|
inlinestatic |
| base | PIT peripheral base address |
| mask | The interrupts to disable. This is a logical OR of members of the enumeration rtc_interrupt_enable_t |
|
inlinestatic |
| base | RTC peripheral base address |
|
inlinestatic |
| base | RTC peripheral base address |
|
inlinestatic |
| base | RTC peripheral base address |
| mask | The interrupt flags to clear. This is a logical OR of members of the enumeration rtc_interrupt_flags_t |
|
inlinestatic |
If RTC output is enabled, the RTCO pinout will be toggled when RTC counter overflows
| base | RTC peripheral base address |
| mask | The Output to enable. This is a logical OR of members of the enumeration rtc_output_enable_t |
|
inlinestatic |
| base | RTC peripheral base address |
| mask | The Output to disable. This is a logical OR of members of the enumeration rtc_output_enable_t |
|
inlinestatic |
| base | RTC peripheral base address |
| value | The Module Value. The RTC Modulo register allows the compare value to be set to any value from 0x0000 to 0xFFFF |
|
inlinestatic |
| base | RTC peripheral base address |