![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a driver for the IRTC module of MCUXpresso SDK devices.
Data Structures | |
struct | irtc_datetime_t |
Structure is used to hold the date and time. More... | |
struct | irtc_daylight_time_t |
Structure is used to hold the daylight saving time. More... | |
struct | irtc_tamper_config_t |
Structure is used to define the parameters to configure a RTC tamper event. More... | |
struct | irtc_config_t |
RTC config structure. More... | |
Enumerations | |
enum | irtc_filter_clock_source_t { kIRTC_32K = 0x0, kIRTC_512 = 0x1, kIRTC_128 = 0x2, kIRTC_64 = 0x3, kIRTC_16 = 0x4, kIRTC_8 = 0x5, kIRTC_4 = 0x6, kIRTC_2 = 0x7 } |
IRTC filter clock source options. More... | |
enum | irtc_tamper_pins_t { kIRTC_Tamper_0 = 0U, kIRTC_Tamper_1, kIRTC_Tamper_2, kIRTC_Tamper_3 } |
IRTC Tamper pins. More... | |
enum | irtc_interrupt_enable_t { kIRTC_TamperInterruptEnable = RTC_IER_TAMPER_IE_MASK, kIRTC_AlarmInterruptEnable = RTC_IER_ALM_IE_MASK, kIRTC_DayInterruptEnable = RTC_IER_DAY_IE_MASK, kIRTC_HourInterruptEnable = RTC_IER_HOUR_IE_MASK, kIRTC_MinInterruptEnable = RTC_IER_MIN_IE_MASK, kIRTC_1hzInterruptEnable = RTC_IER_IE_1HZ_MASK, kIRTC_2hzInterruptEnable = RTC_IER_IE_2HZ_MASK, kIRTC_4hzInterruptEnable = RTC_IER_IE_4HZ_MASK, kIRTC_8hzInterruptEnable = RTC_IER_IE_8HZ_MASK, kIRTC_16hzInterruptEnable = RTC_IER_IE_16HZ_MASK, kIRTC_32hzInterruptEnable = RTC_IER_IE_32HZ_MASK, kIRTC_64hzInterruptEnable = RTC_IER_IE_64HZ_MASK, kIRTC_128hzInterruptEnable = RTC_IER_IE_128HZ_MASK, kIRTC_256hzInterruptEnable = RTC_IER_IE_256HZ_MASK, kIRTC_512hzInterruptEnable = RTC_IER_IE_512HZ_MASK } |
List of IRTC interrupts. More... | |
enum | irtc_status_flags_t { kIRTC_TamperFlag = RTC_ISR_TAMPER_IS_MASK, kIRTC_AlarmFlag = RTC_ISR_ALM_IS_MASK, kIRTC_DayFlag = RTC_ISR_DAY_IS_MASK, kIRTC_HourFlag = RTC_ISR_HOUR_IS_MASK, kIRTC_MinFlag = RTC_ISR_MIN_IS_MASK, kIRTC_1hzFlag = RTC_ISR_IS_1HZ_MASK, kIRTC_2hzFlag = RTC_ISR_IS_2HZ_MASK, kIRTC_4hzFlag = RTC_ISR_IS_4HZ_MASK, kIRTC_8hzFlag = RTC_ISR_IS_8HZ_MASK, kIRTC_16hzFlag = RTC_ISR_IS_16HZ_MASK, kIRTC_32hzFlag = RTC_ISR_IS_32HZ_MASK, kIRTC_64hzFlag = RTC_ISR_IS_64HZ_MASK, kIRTC_128hzFlag = RTC_ISR_IS_128HZ_MASK, kIRTC_256hzFlag = RTC_ISR_IS_256HZ_MASK, kIRTC_512hzFlag = RTC_ISR_IS_512HZ_MASK, kIRTC_InvalidFlag = (RTC_STATUS_INVAL_BIT_MASK << 16), kIRTC_WriteProtFlag = (RTC_STATUS_WRITE_PROT_EN_MASK << 16), kIRTC_CpuLowVoltFlag = (RTC_STATUS_CPU_LOW_VOLT_MASK << 16), kIRTC_ResetSrcFlag = (RTC_STATUS_RST_SRC_MASK << 16), kIRTC_CmpIntFlag = (RTC_STATUS_CMP_INT_MASK << 16), kIRTC_BusErrFlag = (RTC_STATUS_BUS_ERR_MASK << 16), kIRTC_CmpDoneFlag = (RTC_STATUS_CMP_DONE_MASK << 16) } |
List of IRTC flags. More... | |
enum | irtc_alarm_match_t { kRTC_MatchSecMinHr = 0, kRTC_MatchSecMinHrDay = 1, kRTC_MatchSecMinHrDayMnth = 2, kRTC_MatchSecMinHrDayMnthYr = 3 } |
IRTC alarm match options. More... | |
enum | irtc_osc_cap_load_t { kIRTC_Capacitor2p = (1U << 1), kIRTC_Capacitor4p = (1U << 2), kIRTC_Capacitor8p = (1U << 3), kIRTC_Capacitor16p = (1U << 4) } |
List of RTC Oscillator capacitor load settings. More... | |
Functions | |
static void | IRTC_SetOscCapLoad (RTC_Type *base, uint16_t capLoad) |
This function sets the specified capacitor configuration for the RTC oscillator. More... | |
status_t | IRTC_SetWriteProtection (RTC_Type *base, bool lock) |
Locks or unlocks IRTC registers for write access. More... | |
static void | IRTC_Reset (RTC_Type *base) |
Performs a software reset on the IRTC module. More... | |
Driver version | |
#define | FSL_IRTC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
Version 2.0.0. | |
Initialization and deinitialization | |
status_t | IRTC_Init (RTC_Type *base, const irtc_config_t *config) |
Ungates the IRTC clock and configures the peripheral for basic operation. More... | |
static void | IRTC_Deinit (RTC_Type *base) |
Gate the IRTC clock. More... | |
void | IRTC_GetDefaultConfig (irtc_config_t *config) |
Fill in the IRTC config struct with the default settings. More... | |
Current Time & Alarm | |
status_t | IRTC_SetDatetime (RTC_Type *base, const irtc_datetime_t *datetime) |
Sets the IRTC date and time according to the given time structure. More... | |
void | IRTC_GetDatetime (RTC_Type *base, irtc_datetime_t *datetime) |
Gets the IRTC time and stores it in the given time structure. More... | |
status_t | IRTC_SetAlarm (RTC_Type *base, const irtc_datetime_t *alarmTime) |
Sets the IRTC alarm time. More... | |
void | IRTC_GetAlarm (RTC_Type *base, irtc_datetime_t *datetime) |
Returns the IRTC alarm time. More... | |
Interrupt Interface | |
static void | IRTC_EnableInterrupts (RTC_Type *base, uint32_t mask) |
Enables the selected IRTC interrupts. More... | |
static void | IRTC_DisableInterrupts (RTC_Type *base, uint32_t mask) |
Disables the selected IRTC interrupts. More... | |
static uint16_t | IRTC_GetEnabledInterrupts (RTC_Type *base) |
Gets the enabled IRTC interrupts. More... | |
Status Interface | |
static uint32_t | IRTC_GetStatusFlags (RTC_Type *base) |
Gets the IRTC status flags. More... | |
static void | IRTC_ClearStatusFlags (RTC_Type *base, uint32_t mask) |
Clears the IRTC status flags. More... | |
Daylight Savings Interface | |
void | IRTC_SetDaylightTime (RTC_Type *base, const irtc_daylight_time_t *datetime) |
Sets the IRTC daylight savings start and stop date and time. More... | |
void | IRTC_GetDaylightTime (RTC_Type *base, irtc_daylight_time_t *datetime) |
Gets the IRTC daylight savings time and stores it in the given time structure. More... | |
Time Compensation Interface | |
void | IRTC_SetCoarseCompensation (RTC_Type *base, uint8_t compensationValue, uint8_t compensationInterval) |
Enables the coarse compensation and sets the value in the IRTC compensation register. More... | |
void | IRTC_SetFineCompensation (RTC_Type *base, uint8_t integralValue, uint8_t fractionValue, bool accumulateFractional) |
Enables the fine compensation and sets the value in the IRTC compensation register. More... | |
Tamper Interface | |
void | IRTC_SetTamperParams (RTC_Type *base, irtc_tamper_pins_t tamperNumber, const irtc_tamper_config_t *tamperConfig) |
This function allows configuring the four tamper inputs. More... | |
struct irtc_datetime_t |
Data Fields | |
uint16_t | year |
Range from 1984 to 2239. More... | |
uint8_t | month |
Range from 1 to 12. More... | |
uint8_t | day |
Range from 1 to 31 (depending on month). More... | |
uint8_t | weekDay |
Range from 0(Sunday) to 6(Saturday). 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 irtc_datetime_t::year |
uint8_t irtc_datetime_t::month |
uint8_t irtc_datetime_t::day |
uint8_t irtc_datetime_t::weekDay |
uint8_t irtc_datetime_t::hour |
uint8_t irtc_datetime_t::minute |
uint8_t irtc_datetime_t::second |
struct irtc_daylight_time_t |
struct irtc_tamper_config_t |
Data Fields | |
bool | pinPolarity |
true: tamper has active low polarity; false: active high polarity | |
irtc_filter_clock_source_t | filterClk |
Clock source for the tamper filter. | |
uint8_t | filterDuration |
Tamper filter duration. More... | |
uint8_t irtc_tamper_config_t::filterDuration |
struct irtc_config_t |
This structure holds the configuration settings for the RTC peripheral. To initialize this structure to reasonable defaults, call the IRTC_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
Data Fields | |
bool | wakeupSelect |
true: Tamper pin 0 is used to wakeup the chip; false: Tamper pin 0 is used as the tamper pin | |
bool | timerStdMask |
true: Sampling clocks gated in standby mode; false: Sampling clocks not gated | |
irtc_alarm_match_t | alrmMatch |
Pick one option from enumeration :: irtc_alarm_match_t. | |
enum irtc_tamper_pins_t |
enum irtc_status_flags_t |
enum irtc_alarm_match_t |
enum irtc_osc_cap_load_t |
status_t IRTC_Init | ( | RTC_Type * | base, |
const irtc_config_t * | config | ||
) |
This function initiates a soft-reset of the IRTC module, this has not effect on DST, calendaring, standby time and tamper detect registers.
base | IRTC peripheral base address |
config | Pointer to user's IRTC config structure. |
|
inlinestatic |
base | IRTC peripheral base address |
void IRTC_GetDefaultConfig | ( | irtc_config_t * | config | ) |
The default values are:
config | Pointer to user's IRTC config structure. |
status_t IRTC_SetDatetime | ( | RTC_Type * | base, |
const irtc_datetime_t * | datetime | ||
) |
The IRTC counter is started after the time is set.
base | IRTC peripheral base address |
datetime | Pointer to structure where the date and time details to set are stored |
void IRTC_GetDatetime | ( | RTC_Type * | base, |
irtc_datetime_t * | datetime | ||
) |
base | IRTC peripheral base address |
datetime | Pointer to structure where the date and time details are stored. |
status_t IRTC_SetAlarm | ( | RTC_Type * | base, |
const irtc_datetime_t * | alarmTime | ||
) |
base | RTC peripheral base address |
alarmTime | Pointer to structure where the alarm time is stored. |
void IRTC_GetAlarm | ( | RTC_Type * | base, |
irtc_datetime_t * | datetime | ||
) |
base | RTC peripheral base address |
datetime | Pointer to structure where the alarm date and time details are stored. |
|
inlinestatic |
base | IRTC peripheral base address |
mask | The interrupts to enable. This is a logical OR of members of the enumeration ::rtc_interrupt_enable_t |
|
inlinestatic |
base | IRTC peripheral base address |
mask | The interrupts to enable. This is a logical OR of members of the enumeration ::rtc_interrupt_enable_t |
|
inlinestatic |
base | IRTC peripheral base address |
|
inlinestatic |
base | IRTC peripheral base address |
|
inlinestatic |
base | IRTC peripheral base address |
mask | The status flags to clear. This is a logical OR of members of the enumeration irtc_status_flags_t |
|
inlinestatic |
base | IRTC peripheral base address |
capLoad | Oscillator loads to enable. This is a logical OR of members of the enumeration irtc_osc_cap_load_t |
status_t IRTC_SetWriteProtection | ( | RTC_Type * | base, |
bool | lock | ||
) |
base | IRTC peripheral base address |
lock | true: Lock IRTC registers; false: Unlock IRTC registers. |
|
inlinestatic |
Clears contents of alarm, interrupt (status and enable except tamper interrupt enable bit) registers, STATUS[CMP_DONE] and STATUS[BUS_ERR]. This has no effect on DST, calendaring, standby time and tamper detect registers.
base | IRTC peripheral base address |
void IRTC_SetDaylightTime | ( | RTC_Type * | base, |
const irtc_daylight_time_t * | datetime | ||
) |
It also enables the daylight saving bit in the IRTC control register
base | IRTC peripheral base address |
datetime | Pointer to a structure where the date and time details are stored. |
void IRTC_GetDaylightTime | ( | RTC_Type * | base, |
irtc_daylight_time_t * | datetime | ||
) |
base | IRTC peripheral base address |
datetime | Pointer to a structure where the date and time details are stored. |
void IRTC_SetCoarseCompensation | ( | RTC_Type * | base, |
uint8_t | compensationValue, | ||
uint8_t | compensationInterval | ||
) |
base | IRTC peripheral base address |
compensationValue | Compensation value is a 2's complement value. |
compensationInterval | Compensation interval. |
void IRTC_SetFineCompensation | ( | RTC_Type * | base, |
uint8_t | integralValue, | ||
uint8_t | fractionValue, | ||
bool | accumulateFractional | ||
) |
base | The IRTC peripheral base address |
integralValue | Compensation integral value; twos complement value of the integer part |
fractionValue | Compensation fraction value expressed as number of clock cycles of a fixed 4.194304Mhz clock that have to be added. |
accumulateFractional | Flag indicating if we want to add to previous fractional part; true: Add to previously accumulated fractional part, false: Start afresh and overwrite current value |
void IRTC_SetTamperParams | ( | RTC_Type * | base, |
irtc_tamper_pins_t | tamperNumber, | ||
const irtc_tamper_config_t * | tamperConfig | ||
) |
The function configures the filter properties for the three external tampers. It also sets up active/passive and direction of the tamper bits, which are not available on all platforms.
base | The IRTC peripheral base address |
tamperNumber | The IRTC tamper input to configure |
tamperConfig | The IRTC tamper properties |