MAX32660 Peripheral Driver API
Peripheral Driver API for the MAX32660
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_MAX32660_RTC_H_
28#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32660_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 (0xFFF + 1) // 0xFFF = max ssec counter value
47#define MXC_RTC_TRIM_TMR_IRQ MXC_F_TMR_INTR_IRQ
48
49/* **** Definitions **** */
53typedef enum {
59
63typedef enum {
68
72typedef enum {
77
83int MXC_RTC_SetTimeofdayAlarm(uint32_t ras);
84
91int MXC_RTC_SetSubsecondAlarm(uint32_t rssa);
92
97int MXC_RTC_Start(void);
102int MXC_RTC_Stop(void);
103
110int MXC_RTC_Init(uint32_t sec, uint8_t ssec);
111
118
124
130int MXC_RTC_Trim(int8_t trm);
131
138int MXC_RTC_EnableInt(uint32_t mask);
139
146int MXC_RTC_DisableInt(uint32_t mask);
147
155
162int MXC_RTC_ClearFlags(int flags);
163
168#ifdef __GNUC__
169__attribute__((deprecated("Use MXC_RTC_GetSubSeconds() instead.")))
170#endif
172
179int MXC_RTC_GetSubSeconds(uint32_t *ssec);
180
185#ifdef __GNUC__
186__attribute__((deprecated("Use MXC_RTC_GetSeconds() instead.")))
187#endif
189
196int MXC_RTC_GetSeconds(uint32_t *sec);
197
204int MXC_RTC_GetTime(uint32_t *sec, uint32_t *subsec);
205
211
213#ifdef __cplusplus
214}
215#endif
216
217#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32660_RTC_H_
#define MXC_F_RTC_CTRL_ALDF
Definition: rtc_regs.h:173
#define MXC_F_RTC_CTRL_ALSF
Definition: rtc_regs.h:176
#define MXC_S_RTC_CTRL_FT_FREQ512HZ
Definition: rtc_regs.h:186
#define MXC_F_RTC_CTRL_ASE
Definition: rtc_regs.h:161
#define MXC_F_RTC_CTRL_RDYE
Definition: rtc_regs.h:170
#define MXC_S_RTC_CTRL_FT_FREQ4KHZ
Definition: rtc_regs.h:188
#define MXC_F_RTC_CTRL_RDY
Definition: rtc_regs.h:167
#define MXC_S_RTC_CTRL_FT_FREQ1HZ
Definition: rtc_regs.h:184
#define MXC_F_RTC_CTRL_ADE
Definition: rtc_regs.h:158
int MXC_RTC_Stop(void)
Stop the Real Time Clock (Blocking function)
int MXC_RTC_Init(uint32_t sec, uint8_t ssec)
Initialize the sec and ssec registers and enable RTC (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:63
mxc_rtc_freq_sel_t
Bitmasks for each of the RTC's Frequency.
Definition: rtc.h:53
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_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:72
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.
@ MXC_RTC_INT_EN_SHORT
Short-interval alarm interrupt enable.
Definition: rtc.h:65
@ MXC_RTC_INT_EN_LONG
Long-interval alarm interrupt enable.
Definition: rtc.h:64
@ MXC_RTC_INT_EN_READY
Timer ready interrupt enable.
Definition: rtc.h:66
@ MXC_RTC_F_1HZ
1Hz (Compensated)
Definition: rtc.h:54
@ MXC_RTC_F_32KHZ
32Khz
Definition: rtc.h:57
@ MXC_RTC_F_4KHZ
4Khz
Definition: rtc.h:56
@ MXC_RTC_F_512HZ
512Hz (Compensated)
Definition: rtc.h:55
@ MXC_RTC_INT_FL_SHORT
Short-interval alarm interrupt flag.
Definition: rtc.h:74
@ MXC_RTC_INT_FL_LONG
Long-interval alarm interrupt flag.
Definition: rtc.h:73
@ MXC_RTC_INT_FL_READY
Timer ready interrupt flag.
Definition: rtc.h:75
Registers, Bit Masks and Bit Positions for the RTC Peripheral Module.