MAX32675 Peripheral Driver API
Peripheral Driver API for the MAX32675
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 
59 /* **** Definitions **** */
63 typedef enum {
69 
73 typedef enum {
78 
82 typedef enum {
87 
93 int MXC_RTC_SetTimeofdayAlarm (uint32_t ras);
94 
101 int MXC_RTC_SetSubsecondAlarm (uint32_t rssa);
102 
107 int MXC_RTC_Start (void);
112 int MXC_RTC_Stop (void);
113 
120 int MXC_RTC_Init (uint32_t sec, uint8_t ssec);
121 
128 
133 int MXC_RTC_SquareWaveStop (void);
134 
140 int MXC_RTC_Trim (int8_t trm);
141 
148 int MXC_RTC_EnableInt (uint32_t mask);
149 
156 int MXC_RTC_DisableInt (uint32_t mask);
157 
164 int MXC_RTC_GetFlags (void);
165 
172 int MXC_RTC_ClearFlags (int flags);
173 
178 int MXC_RTC_GetSubSecond (void);
179 
184 int MXC_RTC_GetSecond (void);
185 
192 int MXC_RTC_GetTime (uint32_t* sec, uint32_t* subsec);
193 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #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:73
MXC_S_RTC_CTRL_SQW_SEL_FREQ1HZ
#define MXC_S_RTC_CTRL_SQW_SEL_FREQ1HZ
Definition: rtc_regs.h:196
MXC_F_RTC_CTRL_TOD_ALARM_IE
#define MXC_F_RTC_CTRL_TOD_ALARM_IE
Definition: rtc_regs.h:170
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:66
MXC_F_RTC_CTRL_RDY
#define MXC_F_RTC_CTRL_RDY
Definition: rtc_regs.h:179
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:63
MXC_F_RTC_CTRL_SSEC_ALARM_IE
#define MXC_F_RTC_CTRL_SSEC_ALARM_IE
Definition: rtc_regs.h:173
MXC_RTC_EnableInt
int MXC_RTC_EnableInt(uint32_t mask)
Enable Interurpts.
MXC_S_RTC_CTRL_SQW_SEL_FREQ512HZ
#define MXC_S_RTC_CTRL_SQW_SEL_FREQ512HZ
Definition: rtc_regs.h:198
MXC_RTC_INT_FL_READY
@ MXC_RTC_INT_FL_READY
Timer ready interrupt flag.
Definition: rtc.h:85
MXC_RTC_INT_FL_SHORT
@ MXC_RTC_INT_FL_SHORT
Short-interval alarm interrupt flag.
Definition: rtc.h:84
MXC_RTC_INT_FL_LONG
@ MXC_RTC_INT_FL_LONG
Long-interval alarm interrupt flag.
Definition: rtc.h:83
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:76
MXC_F_RTC_CTRL_TOD_ALARM
#define MXC_F_RTC_CTRL_TOD_ALARM
Definition: rtc_regs.h:185
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:75
MXC_RTC_SquareWaveStop
int MXC_RTC_SquareWaveStop(void)
Stop the generation of square wave.
MXC_S_RTC_CTRL_SQW_SEL_FREQ4KHZ
#define MXC_S_RTC_CTRL_SQW_SEL_FREQ4KHZ
Definition: rtc_regs.h:200
MXC_RTC_F_512HZ
@ MXC_RTC_F_512HZ
512Hz (Compensated)
Definition: rtc.h:65
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:74
mxc_rtc_int_fl_t
mxc_rtc_int_fl_t
Bitmasks for each of the RTC's interrupt flags.
Definition: rtc.h:82
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_F_RTC_CTRL_RDY_IE
#define MXC_F_RTC_CTRL_RDY_IE
Definition: rtc_regs.h:182
MXC_RTC_F_1HZ
@ MXC_RTC_F_1HZ
1Hz (Compensated)
Definition: rtc.h:64
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_F_RTC_CTRL_SSEC_ALARM
#define MXC_F_RTC_CTRL_SSEC_ALARM
Definition: rtc_regs.h:188
MXC_RTC_F_32KHZ
@ MXC_RTC_F_32KHZ
32Khz
Definition: rtc.h:67
MXC_RTC_Stop
int MXC_RTC_Stop(void)
Stop the Real Time Clock.