Kinetis SDK v.1.3 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include "fsl_device_registers.h"
Data Structures | |
struct | irtc_datetime_t |
Structure is used to hold the time in a simple "date" format. 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... | |
Macros | |
#define | IRTC_BASE_YEAR (2112U) |
#define | RTC_WRITE_ENABLE(base, value) (*(__IO uint8_t*)(&RTC_STATUS_REG(base)) = (value)) |
Enumerations | |
enum | irtc_status_t { kStatus_IRTC_Success = 0x00U, kStatus_IRTC_Fail = 0x01U } |
Error codes for the IRTC driver. More... | |
enum | irtc_filter_clock_source_t { kIRTC32K = 0x0, kIRTC512 = 0x1, kIRTC128 = 0x2, kIRTC64 = 0x3, kIRTC16 = 0x4, kIRTC8 = 0x5, kIRTC4 = 0x6, kIRTC2 = 0x7 } |
IRTC filter clock source options. More... | |
enum | irtc_tamper_pins_t { kIRTCTamper0 = 0x0, kIRTCTamper1 = 0x1, kIRTCTamper2 = 0x2, kIRTCTamper3 = 0x3 } |
IRTC Tamper pins. More... | |
enum | irtc_clock_output_t { kIRTCNoOutputClk = 0x0, kIRTCFine1hzClk = 0x1, kIRTC32khzClk = 0x2, kIRTCCoarse1hzClck = 0x3 } |
IRTC clock output selection. More... | |
enum | irtc_alarm_match_t { kIRTCSecMinHour = 0x0, kIRTCSecMinHourDay = 0x1, kIRTCSecMinHourDayMon = 0x2, kIRTCSecMinHourDayMonYear = 0x3 } |
IRTC alarm match selection. More... | |
enum | irtc_status_flag_t { kIRTCInvalidate = RTC_STATUS_INVAL_BIT_SHIFT, kIRTCReadOnly = RTC_STATUS_WRITE_PROT_EN_SHIFT, kIRTCLowVoltage = RTC_STATUS_CPU_LOW_VOLT_SHIFT, kIRTCResetSrc = RTC_STATUS_RST_SRC_SHIFT, kIRTCCmpInterval = RTC_STATUS_CMP_INT_SHIFT, kIRTCBusErr = RTC_STATUS_BUS_ERR_SHIFT, kIRTCCmpDone = RTC_STATUS_CMP_DONE_SHIFT } |
IRTC status flags. More... | |
enum | irtc_int_status_flag_t { kIRTCTamperIntFlag = RTC_ISR_TAMPER_IS_SHIFT, kIRTCAlarmIntFlag = RTC_ISR_ALM_IS_SHIFT, kIRTCDayIntFlag = RTC_ISR_DAY_IS_SHIFT, kIRTCHourIntFlag = RTC_ISR_HOUR_IS_SHIFT, kIRTCMinIntFlag = RTC_ISR_MIN_IS_SHIFT, kIRTC1hzIntFlag = RTC_ISR_IS_1HZ_SHIFT, kIRTC2hzIntFlag = RTC_ISR_IS_2HZ_SHIFT, kIRTC4hzIntFlag = RTC_ISR_IS_4HZ_SHIFT, kIRTC8hzIntFlag = RTC_ISR_IS_8HZ_SHIFT, kIRTC16hzIntFlag = RTC_ISR_IS_16HZ_SHIFT, kIRTC32hzIntFlag = RTC_ISR_IS_32HZ_SHIFT, kIRTC64hzIntFlag = RTC_ISR_IS_64HZ_SHIFT, kIRTC128hzIntFlag = RTC_ISR_IS_128HZ_SHIFT, kIRTC256hzIntFlag = RTC_ISR_IS_256HZ_SHIFT, kIRTC512hzIntFlag = RTC_ISR_IS_512HZ_SHIFT } |
IRTC interrupt status flags. More... | |
enum | irtc_int_t { kIRTCTamperInt = RTC_IER_TAMPER_IE_SHIFT, kIRTCAlarmInt = RTC_IER_ALM_IE_SHIFT, kIRTCDayInt = RTC_IER_DAY_IE_SHIFT, kIRTCHourInt = RTC_IER_HOUR_IE_SHIFT, kIRTCMinInt = RTC_IER_MIN_IE_SHIFT, kIRTC1hzInt = RTC_IER_IE_1HZ_SHIFT, kIRTC2hzInt = RTC_IER_IE_2HZ_SHIFT, kIRTC4hzInt = RTC_IER_IE_4HZ_SHIFT, kIRTC8hzInt = RTC_IER_IE_8HZ_SHIFT, kIRTC16hzInt = RTC_IER_IE_16HZ_SHIFT, kIRTC32hzInt = RTC_IER_IE_32HZ_SHIFT, kIRTC64hzInt = RTC_IER_IE_64HZ_SHIFT, kIRTC128hzInt = RTC_IER_IE_128HZ_SHIFT, kIRTC256hzInt = RTC_IER_IE_256HZ_SHIFT, kIRTC512hzInt = RTC_IER_IE_512HZ_SHIFT } |
IRTC interrupts. More... | |
Functions | |
Initialization | |
void | IRTC_HAL_Init (RTC_Type *base) |
Resets the IRTC module. More... | |
void | IRTC_HAL_SetLockRegisterCmd (RTC_Type *base, bool lock) |
Locks or unlocks IRTC registers for write access. More... | |
Date and Time Setting | |
| |
void | IRTC_HAL_SetYearMonth (RTC_Type *base, uint16_t year, uint16_t month) |
Sets the IRTC year and month. More... | |
void | IRTC_HAL_GetYearMonth (RTC_Type *base, uint16_t *year, uint16_t *month) |
Gets the IRTC current year and month. More... | |
static void | IRTC_HAL_SetDayWeek (RTC_Type *base, uint16_t day, uint16_t weekDay) |
Sets the IRTC day and day of week. More... | |
void | IRTC_HAL_GetDayWeek (RTC_Type *base, uint16_t *day, uint16_t *weekDay) |
Gets the IRTC current day and day of week. More... | |
static void | IRTC_HAL_SetHourMin (RTC_Type *base, uint16_t hour, uint16_t min) |
Sets the IRTC hours and minutes. More... | |
void | IRTC_HAL_GetHourMin (RTC_Type *base, uint16_t *hour, uint16_t *min) |
Gets the IRTC current hours and minutes. More... | |
static void | IRTC_HAL_SetSec (RTC_Type *base, uint16_t sec) |
Sets the IRTC second counter. More... | |
static void | IRTC_HAL_GetSec (RTC_Type *base, uint16_t *sec) |
Gets the IRTC current second counter. More... | |
void | IRTC_HAL_SetDatetime (RTC_Type *base, const irtc_datetime_t *datetime) |
Sets the IRTC date and time according to the given time structure. More... | |
void | IRTC_HAL_GetDatetime (RTC_Type *base, irtc_datetime_t *datetime) |
Gets the IRTC time and stores it in the given time structure. More... | |
Alarm Time Setting | |
static void | IRTC_HAL_SetAlarmMatchMode (RTC_Type *base, irtc_alarm_match_t alarmType) |
Sets the alarm match type. More... | |
void | IRTC_HAL_SetAlarm (RTC_Type *base, const irtc_datetime_t *datetime) |
Sets the IRTC alarm time and enables the alarm interrupt. More... | |
void | IRTC_HAL_GetAlarm (RTC_Type *base, irtc_datetime_t *datetime) |
Reads the value of the time alarm. More... | |
Daylight Saving Time Setting | |
static void | IRTC_HAL_SetDaylightMonth (RTC_Type *base, uint16_t startMonth, uint16_t endMonth) |
Sets IRTC daylight savings start month and end month. More... | |
void | IRTC_HAL_GetDaylightMonth (RTC_Type *base, uint16_t *startMonth, uint16_t *endMonth) |
Gets the IRTC current daylight savings start and end month. More... | |
static void | IRTC_HAL_SetDaylightDay (RTC_Type *base, uint16_t startDay, uint16_t endDay) |
Sets the IRTC daylight savings start and end day. More... | |
void | IRTC_HAL_GetDaylightDay (RTC_Type *base, uint16_t *startDay, uint16_t *endDay) |
Gets the IRTC current daylight savings start and end day. More... | |
static void | IRTC_HAL_SetDaylightHour (RTC_Type *base, uint16_t startHour, uint16_t endHour) |
Sets the IRTC current daylight savings start and end hour. More... | |
void | IRTC_HAL_GetDaylightHour (RTC_Type *base, uint16_t *startHour, uint16_t *endHour) |
Gets the IRTC current daylight savings start and end hour. More... | |
void | IRTC_HAL_SetDaylightTime (RTC_Type *base, const irtc_daylight_time_t *datetime) |
Sets the IRTC daylight savings date and time. More... | |
void | IRTC_HAL_GetDaylightTime (RTC_Type *base, irtc_daylight_time_t *datetime) |
Gets the IRTC daylight savings time and stores it in the given time structure. More... | |
Status | |
static bool | IRTC_HAL_GetStatusFlag (RTC_Type *base, irtc_status_flag_t statusFlag) |
Gets the IRTC status flag state. More... | |
Interrupts | |
static void | IRTC_HAL_SetIntCmd (RTC_Type *base, irtc_int_t interrupt, bool enable) |
Enables or disables the related IRTC interrupt. More... | |
static bool | IRTC_HAL_GetIntCmd (RTC_Type *base, irtc_int_t interrupt) |
Indicates whether the IRTC interrupt is enabled or not. More... | |
static bool | IRTC_HAL_GetIntStatusFlag (RTC_Type *base, irtc_int_status_flag_t statusFlag) |
Gets the IRTC interrupt status flag state. More... | |
static void | IRTC_HAL_ClearIntStatusFlag (RTC_Type *base, irtc_int_status_flag_t statusFlag) |
Clears the IRTC interrupt status flag. More... | |
IRTC Time Compensation | |
void | IRTC_HAL_SetCoarseCompensation (RTC_Type *base, uint8_t compVal, uint8_t compInterval) |
Enables the coarse compensation and sets the value to the IRTC compensation register. More... | |
void | IRTC_HAL_SetFineCompensation (RTC_Type *base, uint8_t integralVal, uint8_t fracVal, bool accumulateFrac) |
Enables the fine compensation and sets the value to the IRTC compensation register. More... | |
IRTC Control | |
static void | IRTC_HAL_SetClockOutMode (RTC_Type *base, irtc_clock_output_t clock) |
Selects which clock to output from the SoC for use outside the RTC. More... | |
static void | IRTC_HAL_SoftwareReset (RTC_Type *base) |
Performs a software reset on the IRTC module. More... | |
IRTC Tamper | |
void | IRTC_HAL_ConfigTamperParams (RTC_Type *base, irtc_tamper_pins_t tamperNum, irtc_tamper_config_t *tamperConfig) |
This function allows configuring the four tamper inputs. More... | |
static void | IRTC_HAL_EnableTamper (RTC_Type *base) |
Enables the tamper feature. More... | |
static void | IRTC_HAL_DisableTamper (RTC_Type *base) |
Disables the tamper feature. More... | |