Common IO - basic v1.0.0
Common IO - basic v1.0.0 Library
 
Loading...
Searching...
No Matches
iot_rtc.h
Go to the documentation of this file.
1/*
2 * Common IO - basic V1.0.0
3 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * http://aws.amazon.com/freertos
23 * http://www.FreeRTOS.org
24 */
25
26/*******************************************************************************
27 * @file iot_rtc.h
28 *
29 * @brief HAL APIs for RTC
30 *******************************************************************************
31 */
32
38#ifndef _IOT_RTC_H_
39#define _IOT_RTC_H_
40
49#define IOT_RTC_SUCCESS ( 0 )
50#define IOT_RTC_INVALID_VALUE ( 1 )
51#define IOT_RTC_NOT_STARTED ( 2 )
52#define IOT_RTC_GET_FAILED ( 3 )
53#define IOT_RTC_SET_FAILED ( 4 )
54#define IOT_RTC_FUNCTION_NOT_SUPPORTED ( 5 )
59typedef enum
60{
66
70typedef struct IotRtcDatetime
71{
72 uint8_t ucSecond;
73 uint8_t ucMinute;
74 uint8_t ucHour;
75 uint8_t ucDay;
76 uint8_t ucMonth;
77 uint16_t usYear;
78 uint8_t ucWday;
80
86typedef enum IotRtcIoctlRequest
87{
97
101struct IotRtcDescriptor;
102
108typedef struct IotRtcDescriptor * IotRtcHandle_t;
109
120typedef void ( * IotRtcCallback_t)( IotRtcStatus_t xStatus,
121 void * pvUserContext );
122
135IotRtcHandle_t iot_rtc_open( int32_t lRtcInstance );
136
151void iot_rtc_set_callback( IotRtcHandle_t const pxRtcHandle,
152 IotRtcCallback_t xCallback,
153 void * pvUserContext );
154
177int32_t iot_rtc_ioctl( IotRtcHandle_t const pxRtcHandle,
178 IotRtcIoctlRequest_t xRequest,
179 void * const pvBuffer );
180
194int32_t iot_rtc_set_datetime( IotRtcHandle_t const pxRtcHandle,
195 const IotRtcDatetime_t * pxDatetime );
196
211int32_t iot_rtc_get_datetime( IotRtcHandle_t const pxRtcHandle,
212 IotRtcDatetime_t * pxDatetime );
213
226int32_t iot_rtc_close( IotRtcHandle_t const pxRtcHandle );
227
232#endif /* ifndef _IOT_RTC_H_ */
int32_t iot_rtc_ioctl(IotRtcHandle_t const pxRtcHandle, IotRtcIoctlRequest_t xRequest, void *const pvBuffer)
iot_rtc_ioctl is used to set RTC configuration and RTC properties like Wakeup time,...
int32_t iot_rtc_get_datetime(IotRtcHandle_t const pxRtcHandle, IotRtcDatetime_t *pxDatetime)
iot_rtc_get_datetime is used to get the current time from the RTC counter. The time must be set first...
IotRtcIoctlRequest_t
Ioctl request types.
Definition: iot_rtc.h:87
void iot_rtc_set_callback(IotRtcHandle_t const pxRtcHandle, IotRtcCallback_t xCallback, void *pvUserContext)
iot_rtc_set_callback is used to set the callback to be called when alarmTime triggers....
IotRtcStatus_t
RTC driver status values.
Definition: iot_rtc.h:60
int32_t iot_rtc_close(IotRtcHandle_t const pxRtcHandle)
iot_rtc_close is used to de-Initialize RTC Timer. it resets the RTC timer and may stop the timer.
struct IotRtcDescriptor * IotRtcHandle_t
IotRtcHandle_t type is the RTC handle returned by calling iot_rtc_open() this is initialized in open ...
Definition: iot_rtc.h:108
int32_t iot_rtc_set_datetime(IotRtcHandle_t const pxRtcHandle, const IotRtcDatetime_t *pxDatetime)
iot_rtc_set_date_time is used to set the current time as a reference in RTC timer counter.
IotRtcHandle_t iot_rtc_open(int32_t lRtcInstance)
iot_rtc_open is used to initialize the RTC timer. It usually resets the RTC timer,...
void(* IotRtcCallback_t)(IotRtcStatus_t xStatus, void *pvUserContext)
RTC notification callback type. This callback is passed to the driver by using iot_rtc_set_callback A...
Definition: iot_rtc.h:120
@ eSetRtcAlarm
Definition: iot_rtc.h:88
@ eCancelRtcAlarm
Definition: iot_rtc.h:91
@ eCancelRtcWakeup
Definition: iot_rtc.h:94
@ eSetRtcWakeupTime
Definition: iot_rtc.h:92
@ eGetRtcWakeupTime
Definition: iot_rtc.h:93
@ eGetRtcAlarm
Definition: iot_rtc.h:90
@ eGetRtcStatus
Definition: iot_rtc.h:95
@ eRtcTimerStopped
Definition: iot_rtc.h:61
@ eRtcTimerAlarmTriggered
Definition: iot_rtc.h:63
@ eRtcTimerRunning
Definition: iot_rtc.h:62
@ eRtcTimerWakeupTriggered
Definition: iot_rtc.h:64
RTC date and time format info.
Definition: iot_rtc.h:71
uint8_t ucMinute
Definition: iot_rtc.h:73
uint8_t ucDay
Definition: iot_rtc.h:75
uint8_t ucSecond
Definition: iot_rtc.h:72
uint8_t ucMonth
Definition: iot_rtc.h:76
uint16_t usYear
Definition: iot_rtc.h:77
uint8_t ucWday
Definition: iot_rtc.h:78
uint8_t ucHour
Definition: iot_rtc.h:74