MKMxxZxxACxx5 Bare Metal Software Drivers  R4.1.6
Reference Manual
IRTC API Specification

Overview

This section describes functions and macros of the driver's API.

Macros

#define IRTC_GetIsrFlag(flag)
 Returns state of IRTC interrupt pending flag. More...
 
#define IRTC_ClrIsrFlag(mask)
 Clear IRTC pending interrupt flag(s). More...
 
#define IRTC_DisableIsr(mask)
 Disables IRTC interrupt(s). More...
 
#define IRTC_EnableIsr(mask)
 Enables selected IRTC interrupt(s). More...
 
#define IRTC_SelRtcClkout(src)
 Selects clock source to be outputted from device for use outside RTC. More...
 
#define IRTC_GetTamperLog(log)
 Fills IRTC Tamper Log Data Structure with current tamper event time stamp and status information. More...
 
#define IRTC_SetTamperPinActiveLow(pin)
 Sets active low polarity for specified tamper pins. More...
 
#define IRTC_SetTamperPinActiveHigh(pin)
 Sets active high polarity for specified tamper pins. More...
 
#define IRTC_BootVLPR()
 Enables Boot into VLPR mode after POR. More...
 
#define IRTC_BootRUN()
 Enables Boot into RUN mode after POR. More...
 
#define IRTC_GetClock(ptr)
 Gets IRTC clock. More...
 
#define IRTC_SetClock(ptr)
 Sets IRTC clock. More...
 
#define IRTC_SetAlarm(match, time)
 Sets IRTC alarm and alarm match condition. More...
 
#define IRTC_SetDST(hour_start, day_start, mon_start, hour_end, day_end, mon_end)
 Sets Daylight Saving Time (DST). More...
 
#define IRTC_UpdateCoarseCompVal(interval, value)
 Updates coarse compensation value. More...
 
#define IRTC_UpdateFineCompVal(integer, fraction)
 Updates fine compensation value. More...
 
#define IRTC_WrRam(src, size)
 Writes data into 32-byte IRTC RAM. More...
 
#define IRTC_RdRam(dst, size)
 Reads data from 32-byte IRTC RAM. More...
 
#define IRTC_Hibernate(state)
 Places device into hibernation mode. More...
 
#define IRTC_InstallCallback(ip, callback)
 Installs callback function for IRTC interrupt vector 41. More...
 
#define IRTC_Init(irtc, t0, t1, t2, mask)
 Initializes IRTC module with WKUP/TAMPER0 pin assigned to tamper mode. More...
 
#define IRTC_WkupInit(irtc, t1, t2, mask)
 Initializes IRTC module with WKUP/TAMPER0 pin assigned to hibernation mode. More...
 

Macro Definition Documentation

#define IRTC_GetIsrFlag (   flag)

This macro returns state of IRTC interrupt pending interrupt flag.

Parameters
flagSelect one of the IRTC Interrupts.
Returns
true (non-zero) interrupt flag set,
false interrupt flag cleared.
Note
Implemented as an inline macro.
See also
IRTC_ClrIsrFlag
#define IRTC_ClrIsrFlag (   mask)

This macro clears IRTC pending interrupt flag(s).

Parameters
maskSelect one or more OR'ed IRTC Interrupts.
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
See also
IRTC_GetIsrFlag
#define IRTC_DisableIsr (   mask)

This macro disables selected IRTC interrupt(s)

Parameters
maskSelect one or more OR'ed IRTC Interrupts.
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
See also
IRTC_EnableIsr
#define IRTC_EnableIsr (   mask)

This macro enables selected IRTC interrupt(s).

Parameters
maskSelect one or more OR'ed IRTC Interrupts.
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
See also
IRTC_DisableIsr
#define IRTC_SelRtcClkout (   src)

This macro selects clock source to be outputted from device for use outside RTC. Clock is routed to RTCCLKOUT pins and XBAR input[10].

Parameters
srcSelect one of the IRTC RTCCLKOUT Clock Sources.
Note
Implemented as an inline macro.
See also
SIM_SelClkout
#define IRTC_GetTamperLog (   log)

This macro will fills IRTC Tamper Log Data Structure with current time stamp and status information.

Parameters
logPointer to IRTC Tamper Log Data Structure.
Note
Implemented as an inline macro.
#define IRTC_SetTamperPinActiveLow (   pin)

This macro sets active low polarity for specified tamper pins.

Parameters
pinSelect one of the IRTC Tamper Sources.
Note
Implemented as an inline macro.
See also
IRTC_SetTamperPinActiveHigh
#define IRTC_SetTamperPinActiveHigh (   pin)

This macro sets active high polarity for specified tamper pins.

Parameters
pinSelect one of the IRTC Tamper Sources.
Note
Implemented as an inline macro.
See also
IRTC_SetTamperPinActiveLow
#define IRTC_BootVLPR ( )

This macro enables the VLPR Boot Mode after POR.

Note
Implemented as an inline macro.
Warning
Use this macro with precaution. You won't be able to program the MCU after reset. Make sure there is a way to clear this bit. An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
See also
IRTC_BootRUN
#define IRTC_BootRUN ( )

This macro enables the RUN Boot Mode after POR.

Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
See also
IRTC_BootVLPR
#define IRTC_GetClock (   ptr)

This function reads date and time from IRTC module. Function updates the tTIME structure passed by pointer.

Parameters
ptrPointer to the IRTC Time Data Structure.
Note
Implemented as a function call.
Warning
An attempt to debug this function may fail due to IRTC lock/unlock mechanism.
See also
IRTC_SetClock
#define IRTC_SetClock (   ptr)

This function sets date and time of the IRTC module. Function sets IRTC module with parameters from tTIME structure passed by pointer.

Parameters
ptrPointer to the IRTC Time Data Structure.
Note
Implemented as a function call.
Warning
An attempt to debug this function may fail due to IRTC lock/unlock mechanism.
See also
IRTC_GetClock
#define IRTC_SetAlarm (   match,
  time 
)

This function sets IRTC alarm and alarm match condition.

Parameters
matchSelect one of the IRTC Alarm Match Conditions.
timePointer to the IRTC Alarm Data Structure.
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
#define IRTC_SetDST (   hour_start,
  day_start,
  mon_start,
  hour_end,
  day_end,
  mon_end 
)

This function sets Daylight Saving Time (DST).

Parameters
hour_startDaylight Saving Time (DST) Hour Start Value.
day_startDaylight Saving Time (DST) Day Start Value.
mon_startDaylight Saving Time (DST) IRTC Months Start Value .
hour_endDaylight Saving Time (DST) Hour End Value.
day_endDaylight Saving Time (DST) Day End Value.
mon_endDaylight Saving Time (DST) IRTC Months End Value.
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
#define IRTC_UpdateCoarseCompVal (   interval,
  value 
)

This function updates coarse compensation value.

Parameters
intervalCompensation Interval is the duration in seconds over which the correction is applied. This is the time in which the addition or removal of 32.768 KHz clock cycles is done thereby ensuring that the compensation interval is close to the interval obtained with an ideal 1 Hz clock. Range of Compensation Interval: 1 second to 255 seconds.
valueCompensation/Correction Value is a 2's complement format by which the 1 Hz Clock is modified by either adding or removing RTC Oscillator clock cycles. Range of Compensation: -128 to +127 (32.768 KHz clock cycles).
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
See also
IRTC_UpdateFineCompVal
#define IRTC_UpdateFineCompVal (   integer,
  fraction 
)

This function updates fine compensation value.

Parameters
integerIntegral Compensation Value is a 2's complement value of the integer part of correction that has to be adjusted in every 1 second period. Range of Compensation: from -8 to +7 (32.768 KHz clock cycles).
fractionFraction Compensation Value is the fractional part of the correction value that has to be adjusted. This value is expressed as number of clock cycles of a fixed 4.194304 MHz clock. Range of Compensation Interval: from 0 (0us delay) to 127 (30.279us delay).
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
See also
IRTC_UpdateCoarseCompVal
#define IRTC_WrRam (   src,
  size 
)

This macro writes data into 32-byte IRTC RAM.

Parameters
srcPointer to the uint8 array to be saved.
sizeNumber of bytes in range from 1 to 32.
Note
Implemented as an inline macro.
See also
IRTC_RdRam
#define IRTC_RdRam (   dst,
  size 
)

This macro reads data from 32-byte IRTC RAM.

Parameters
dstPointer to the uint8 array to be read.
sizeNumber of bytes in range from 1 to 32.
Note
Implemented as an inline macro.
See also
IRTC_WrRam
#define IRTC_Hibernate (   state)

This macro places device into hibernation mode by forcing TAMPER0 pin state from HiZ to either logic 0 or logic 1. The TAMPER0 pin is expected to control external LDO regulator or PMOS transistor.

Parameters
stateSelect one of the IRTC WKUP/TAMPER0 Pin States.
Note
Implemented as an inline macro.
Warning
An attempt to debug this macro may fail due to IRTC lock/unlock mechanism.
Set the required wakeup interrupt sources to recover from hibernation mode. When the selected event (interrupt) is detected, the TAMPER0 pin changes back to HiZ mode and switch on supply power for the device via controlling external LDO regulator or PMOS transistor.
See also
IRTC_WkupInit
#define IRTC_InstallCallback (   ip,
  callback 
)

This function installs callback function for IRTC interrupt vector 41.

Parameters
ipSelect one of the ARM Cortex-M0+ Interrupt Priority Levels.
callbackPointer to the IRTC Callback Function.
Note
Implemented as a function call.
See also
IRTC_Init, IRTC_WkupInit
#define IRTC_Init (   irtc,
  t0,
  t1,
  t2,
  mask 
)

This function initializes Independent Real Time Clock (IRTC) and functionality of all three tamper pins. Call IRTC_InstallCallback function to install callback function for IRTC interrupt vector 45.

Parameters
irtcSelect one of the IRTC Configuration Structures.
t0TAMPER0 pin configuration IRTC Tamper Configuration Structures.
t1TAMPER1 pin configuration IRTC Tamper Configuration Structures.
t2TAMPER2 pin configuration IRTC Tamper Configuration Structures.
maskSelect one or more OR'ed IRTC Interrupts. Remaining interrupts will be disabled.
Note
Implemented as a function call.
Warning
Function disables all interrupts excluding those selected by mask. An attempt to debug this function may fail due to IRTC lock/unlock mechanism.
See also
IRTC_WkupInit, IRTC_InstallCallback, FLL_CtrlIRCLKEN, FLL_SetFastClkDiv
#define IRTC_WkupInit (   irtc,
  t1,
  t2,
  mask 
)

This function initializes Independent Real Time Clock (IRTC) and functionality of two tamper pins (TAMPER1 and TAMPER2). The TAMPER0 pin is configured into hibernation mode. Call IRTC_InstallCallback function to install callback function for IRTC interrupt vector 45.

Parameters
irtcSelect one of the IRTC Configuration Structures.
t1TAMPER1 pin configuration IRTC Tamper Configuration Structures.
t2TAMPER2 pin configuration IRTC Tamper Configuration Structures.
maskSelect one or more OR'ed IRTC Interrupts. Remaining interrupts will be disabled.
Note
Implemented as a function call.
Warning
Function disables all interrupts excluding those selected by mask. An attempt to debug this function may fail due to IRTC lock/unlock mechanism.
See also
IRTC_Init, IRTC_InstallCallback, IRTC_Hibernate, FLL_CtrlIRCLKEN, FLL_SetFastClkDiv