~aleteoryx/muditaos

ref: da25a4b2f5a3f82d7fc0af847cbc231809110c2f muditaos/module-bsp/bsp/rtc/rtc.hpp -rw-r--r-- 1.3 KiB
da25a4b2 — mkamonMdt [EGD-5033] Fix missing texts for ApplicationDesktop 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
 * rtc.hpp
 *
 *  Created on: Jun 26, 2019
 *      Author: kuba
 */

#ifndef MODULE_BSP_BSP_RTC_RTC_HPP_
#define MODULE_BSP_BSP_RTC_RTC_HPP_


#include <time.h>
#include <stdint.h>

extern "C" {
	#include "FreeRTOS.h"
	#include "task.h"
	#include "queue.h"
}

typedef enum
{
    RtcBspOK,
    RtcBspError
} RtcBspError_e;


namespace bsp {

	enum class rtcIrqNotifications
	{
		alarmOcured = 0x01
	};

	/*
	 * RTC functions are using FreeRTOS functions, RTC should be initialized after scheduler starts.
	 * */
	RtcBspError_e rtc_Init(xQueueHandle qHandle);

	RtcBspError_e rtc_EnableAlarmIrq();

	RtcBspError_e rtc_DisableAlarmIrq();

	RtcBspError_e rtc_MaskAlarmIrq();

	RtcBspError_e rtc_UnmaskAlarmIrq();

	RtcBspError_e rtc_SetDateTimeFromTimestamp(time_t timestamp);

	RtcBspError_e rtc_SetDateTime(struct tm* time);

	RtcBspError_e rtc_GetCurrentDateTime(struct tm* datetime);

	RtcBspError_e rtc_GetCurrentTimestamp(time_t* timestamp);

	RtcBspError_e rtc_SetAlarmOnDate(struct tm* datetime);

	RtcBspError_e rtc_SetAlarmOnTimestamp(uint32_t secs);

	RtcBspError_e rtc_SetAlarmInSecondsFromNow(uint32_t secs);

	RtcBspError_e rtc_GetAlarmTimestamp(uint32_t* secs);

	time_t rtc_GetSecondCounter();

;	RtcBspError_e rtc_SetMinuteAlarm(time_t timestamp);
}
#endif /* MODULE_BSP_BSP_RTC_RTC_HPP_ */