MAX32665 Peripheral Driver API
Peripheral Driver API for the MAX32665
rtc.h
1 
6 /* ****************************************************************************
7  * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  *************************************************************************** */
38 
39 /* Define to prevent redundant inclusion */
40 #ifndef _RTC_H_
41 #define _RTC_H_
42 
43 /* **** Includes **** */
44 #include <stdint.h>
45 #include "mxc_device.h"
46 #include "rtc_regs.h"
47 #include "mxc_sys.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
60 /* **** Definitions **** */
64 typedef enum {
70 
74 typedef enum {
79 
83 typedef enum {
88 
94 int MXC_RTC_SetTimeofdayAlarm (uint32_t ras);
95 
102 int MXC_RTC_SetSubsecondAlarm (uint32_t rssa);
103 
108 int MXC_RTC_Start (void);
113 int MXC_RTC_Stop (void);
114 
121 int MXC_RTC_Init (uint32_t sec, uint8_t ssec);
122 
129 
135 
141 int MXC_RTC_Trim (int8_t trm);
142 
149 int MXC_RTC_EnableInt (uint32_t mask);
150 
157 int MXC_RTC_DisableInt (uint32_t mask);
158 
165 int MXC_RTC_GetFlags (void);
166 
173 int MXC_RTC_ClearFlags (int flags);
174 
180 
185 int MXC_RTC_GetSecond (void);
186 
193 int MXC_RTC_GetTime (uint32_t* sec, uint32_t* subsec);
194 
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif /* _RTC_H_ */
MXC_RTC_GetSubSecond
int MXC_RTC_GetSubSecond(void)
Get SubSecond.
mxc_rtc_int_en_t
mxc_rtc_int_en_t
Bitmasks for each of the RTC's interrupt enables.
Definition: rtc.h:74
MXC_S_RTC_CTRL_FREQ_SEL_FREQ512HZ
#define MXC_S_RTC_CTRL_FREQ_SEL_FREQ512HZ
Definition: rtc_regs.h:187
MXC_F_RTC_CTRL_READY
#define MXC_F_RTC_CTRL_READY
Definition: rtc_regs.h:168
MXC_RTC_SetSubsecondAlarm
int MXC_RTC_SetSubsecondAlarm(uint32_t rssa)
Set Sub-Second alarm value and enable interrupt,.
MXC_RTC_F_4KHZ
@ MXC_RTC_F_4KHZ
4Khz
Definition: rtc.h:67
MXC_RTC_Init
int MXC_RTC_Init(uint32_t sec, uint8_t ssec)
Initialize the sec and ssec registers and enable RTC.
MXC_RTC_SetTimeofdayAlarm
int MXC_RTC_SetTimeofdayAlarm(uint32_t ras)
Set Time-of-Day alarm value and enable Interrupt.
MXC_RTC_Start
int MXC_RTC_Start(void)
Start the Real Time Clock.
mxc_rtc_freq_sel_t
mxc_rtc_freq_sel_t
Bitmasks for each of the RTC's Frequency.
Definition: rtc.h:64
MXC_F_RTC_CTRL_READY_INT_EN
#define MXC_F_RTC_CTRL_READY_INT_EN
Definition: rtc_regs.h:171
MXC_S_RTC_CTRL_FREQ_SEL_FREQ4KHZ
#define MXC_S_RTC_CTRL_FREQ_SEL_FREQ4KHZ
Definition: rtc_regs.h:189
MXC_F_RTC_CTRL_TOD_ALARM_FL
#define MXC_F_RTC_CTRL_TOD_ALARM_FL
Definition: rtc_regs.h:174
MXC_RTC_EnableInt
int MXC_RTC_EnableInt(uint32_t mask)
Enable Interurpts.
MXC_RTC_INT_FL_READY
@ MXC_RTC_INT_FL_READY
Timer ready interrupt flag.
Definition: rtc.h:86
MXC_RTC_INT_FL_SHORT
@ MXC_RTC_INT_FL_SHORT
Short-interval alarm interrupt flag.
Definition: rtc.h:85
MXC_F_RTC_CTRL_SSEC_ALARM_FL
#define MXC_F_RTC_CTRL_SSEC_ALARM_FL
Definition: rtc_regs.h:177
MXC_RTC_INT_FL_LONG
@ MXC_RTC_INT_FL_LONG
Long-interval alarm interrupt flag.
Definition: rtc.h:84
MXC_F_RTC_CTRL_SSEC_ALARM_EN
#define MXC_F_RTC_CTRL_SSEC_ALARM_EN
Definition: rtc_regs.h:162
MXC_RTC_GetSecond
int MXC_RTC_GetSecond(void)
Get Second.
MXC_RTC_INT_EN_READY
@ MXC_RTC_INT_EN_READY
Timer ready interrupt enable.
Definition: rtc.h:77
MXC_RTC_Trim
int MXC_RTC_Trim(int8_t trm)
Set Trim register value.
MXC_RTC_INT_EN_SHORT
@ MXC_RTC_INT_EN_SHORT
Short-interval alarm interrupt enable.
Definition: rtc.h:76
MXC_RTC_SquareWaveStop
int MXC_RTC_SquareWaveStop(void)
Stop the generation of square wave.
MXC_RTC_F_512HZ
@ MXC_RTC_F_512HZ
512Hz (Compensated)
Definition: rtc.h:66
MXC_RTC_GetFlags
int MXC_RTC_GetFlags(void)
Gets interrupt flags.
MXC_RTC_DisableInt
int MXC_RTC_DisableInt(uint32_t mask)
Disable Interurpts.
MXC_RTC_INT_EN_LONG
@ MXC_RTC_INT_EN_LONG
Long-interval alarm interrupt enable.
Definition: rtc.h:75
MXC_F_RTC_CTRL_TOD_ALARM_EN
#define MXC_F_RTC_CTRL_TOD_ALARM_EN
Definition: rtc_regs.h:159
mxc_rtc_int_fl_t
mxc_rtc_int_fl_t
Bitmasks for each of the RTC's interrupt flags.
Definition: rtc.h:83
MXC_S_RTC_CTRL_FREQ_SEL_FREQ1HZ
#define MXC_S_RTC_CTRL_FREQ_SEL_FREQ1HZ
Definition: rtc_regs.h:185
MXC_RTC_GetTime
int MXC_RTC_GetTime(uint32_t *sec, uint32_t *subsec)
Get the time using nuclear fusion. Or atomically. Something like that.
MXC_RTC_F_1HZ
@ MXC_RTC_F_1HZ
1Hz (Compensated)
Definition: rtc.h:65
MXC_RTC_SquareWaveStart
int MXC_RTC_SquareWaveStart(mxc_rtc_freq_sel_t fq)
Allow generation of Square Wave on the SQW pin.
MXC_RTC_ClearFlags
int MXC_RTC_ClearFlags(int flags)
Clear interrupt flags.
MXC_RTC_F_32KHZ
@ MXC_RTC_F_32KHZ
32Khz
Definition: rtc.h:68
MXC_RTC_Stop
int MXC_RTC_Stop(void)
Stop the Real Time Clock.