MAX32680 Peripheral Driver API
Peripheral Driver API for the MAX32680
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
rtc.h
1
6/******************************************************************************
7 *
8 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9 * Analog Devices, Inc.),
10 * Copyright (C) 2023-2024 Analog Devices, Inc.
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 ******************************************************************************/
25
26/* Define to prevent redundant inclusion */
27#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_RTC_H_
28#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_RTC_H_
29
30/* **** Includes **** */
31#include <stdint.h>
32#include "mxc_device.h"
33#include "rtc_regs.h"
34#include "mxc_sys.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
46#define MXC_RTC_MAX_SSEC (MXC_F_RTC_SSEC_SSEC + 1)
47#define MXC_RTC_TRIM_TMR_IRQ \
48 0x0 //Place holder to prevent build errors, RevA function which uses this will never be called
49
50/* **** Definitions **** */
54typedef enum {
60
64typedef enum {
70
74typedef enum {
79
85int MXC_RTC_SetTimeofdayAlarm(uint32_t ras);
86
93int MXC_RTC_SetSubsecondAlarm(uint32_t rssa);
94
99int MXC_RTC_Start(void);
104int MXC_RTC_Stop(void);
105
112int MXC_RTC_Init(uint32_t sec, uint16_t ssec);
113
120
126
132int MXC_RTC_Trim(int8_t trm);
133
140int MXC_RTC_EnableInt(uint32_t mask);
141
148int MXC_RTC_DisableInt(uint32_t mask);
149
157
164int MXC_RTC_ClearFlags(int flags);
165
170#ifdef __GNUC__
171__attribute__((deprecated("Use MXC_RTC_GetSubSeconds() instead.")))
172#endif
174
181int MXC_RTC_GetSubSeconds(uint32_t *ssec);
182
187#ifdef __GNUC__
188__attribute__((deprecated("Use MXC_RTC_GetSeconds() instead.")))
189#endif
191
198int MXC_RTC_GetSeconds(uint32_t *sec);
199
206int MXC_RTC_GetTime(uint32_t *sec, uint32_t *subsec);
207
213
222
224#ifdef __cplusplus
225}
226#endif
227
228#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_RTC_H_
#define MXC_F_RTC_CTRL_SSEC_ALARM_IE
Definition: rtc_regs.h:161
#define MXC_F_RTC_CTRL_TOD_ALARM
Definition: rtc_regs.h:173
#define MXC_F_RTC_CTRL_RDY_IE
Definition: rtc_regs.h:170
#define MXC_S_RTC_CTRL_SQW_SEL_FREQ1HZ
Definition: rtc_regs.h:184
#define MXC_F_RTC_CTRL_RDY
Definition: rtc_regs.h:167
#define MXC_F_RTC_CTRL_SSEC_ALARM
Definition: rtc_regs.h:176
#define MXC_S_RTC_CTRL_SQW_SEL_FREQ512HZ
Definition: rtc_regs.h:186
#define MXC_F_RTC_CTRL_TOD_ALARM_IE
Definition: rtc_regs.h:158
#define MXC_S_RTC_CTRL_SQW_SEL_FREQ4KHZ
Definition: rtc_regs.h:188
int MXC_RTC_Stop(void)
Stop the Real Time Clock (Blocking function)
int MXC_RTC_EnableInt(uint32_t mask)
Enable Interurpts (Blocking function)
int MXC_RTC_GetSubSeconds(uint32_t *ssec)
This function stores the current value of the sub-seconds counter into a pointer if the RTC is not bu...
int MXC_RTC_GetBusyFlag(void)
Get RTC busy flag.
int MXC_RTC_DisableInt(uint32_t mask)
Disable Interurpts (Blocking function)
int MXC_RTC_GetSecond(void)
Get Second or E_BUSY, see /ref MXC_ERROR_CODES.
mxc_rtc_int_en_t
Bitmasks for each of the RTC's interrupt enables.
Definition: rtc.h:64
mxc_rtc_freq_sel_t
Definition: rtc.h:54
int MXC_RTC_Trim(int8_t trm)
Set Trim register value (Blocking function)
int MXC_RTC_SquareWaveStart(mxc_rtc_freq_sel_t fq)
Allow generation of Square Wave on the SQW pin (Blocking function)
int MXC_RTC_TrimCrystal(void)
Use the 32 MHz crystal to trim the 32 kHz crystal.
int MXC_RTC_GetSubSecond(void)
Get SubSecond or E_BUSY, see /ref MXC_ERROR_CODES.
int MXC_RTC_ClearFlags(int flags)
Clear interrupt flags.
int MXC_RTC_GetFlags(void)
Gets interrupt flags.
int MXC_RTC_SquareWaveStop(void)
Stop the generation of square wave (Blocking function)
int MXC_RTC_GetTime(uint32_t *sec, uint32_t *subsec)
Get the current second and sub-second counts.
mxc_rtc_int_fl_t
Bitmasks for each of the RTC's interrupt flags.
Definition: rtc.h:74
int MXC_RTC_Start(void)
Start the Real Time Clock (Blocking function)
int MXC_RTC_SetSubsecondAlarm(uint32_t rssa)
Set Sub-Second alarm value and enable interrupt,.
int MXC_RTC_GetSeconds(uint32_t *sec)
This function stores the current value of the seconds counter into a pointer if the RTC is not busy....
int MXC_RTC_SetTimeofdayAlarm(uint32_t ras)
Set Time-of-Day alarm value and enable Interrupt.
int MXC_RTC_Init(uint32_t sec, uint16_t ssec)
Initialize the sec and ssec registers and enable RTC (Blocking function)
@ MXC_RTC_INT_EN_SHORT
Definition: rtc.h:66
@ MXC_RTC_INT_EN_LONG
Definition: rtc.h:65
@ MXC_RTC_INT_EN_READY
Definition: rtc.h:68
@ MXC_RTC_F_1HZ
Definition: rtc.h:55
@ MXC_RTC_F_32KHZ
Definition: rtc.h:58
@ MXC_RTC_F_4KHZ
Definition: rtc.h:57
@ MXC_RTC_F_512HZ
Definition: rtc.h:56
@ MXC_RTC_INT_FL_SHORT
Definition: rtc.h:76
@ MXC_RTC_INT_FL_LONG
Definition: rtc.h:75
@ MXC_RTC_INT_FL_READY
Definition: rtc.h:77
Registers, Bit Masks and Bit Positions for the RTC Peripheral Module.