libwwcl libwwcl
WWitch compatibility layer for the Wonderful toolchain
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022, 2023 Adrian "asie" Siekierka
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 *
17 * 2. Altered source versions must be plainly marked as such, and must not be
18 * misrepresented as being the original software.
19 *
20 * 3. This notice may not be removed or altered from any source distribution.
21 */
22
27#ifndef __WF_LIBWW_TIMER_H__
28#define __WF_LIBWW_TIMER_H__
29
30#include "types.h"
31
37#define RTC_YEAR 0x00
38#define RTC_MONTH 0x01
39#define RTC_DATE 0x02
40#define RTC_DAY_OF_WEEK 0x03
41#define RTC_HOUR 0x04
42#define RTC_MIN 0x05
43#define RTC_SEC 0x06
44
45void rtc_set_datetime(uint16_t field, uint16_t value);
46
47static inline void rtc_set_year(uint16_t value) {
49}
50
51static inline void rtc_set_month(uint16_t value) {
53}
54
55static inline void rtc_set_date(uint16_t value) {
57}
58
59static inline void rtc_set_day_of_week(uint16_t value) {
61}
62
63static inline void rtc_set_hour(uint16_t value) {
65}
66
67static inline void rtc_set_minute(uint16_t value) {
69}
70
71static inline void rtc_set_second(uint16_t value) {
73}
74
75uint16_t rtc_get_datetime(uint16_t field);
76
77static inline uint16_t rtc_get_year(void) {
79}
80
81static inline uint16_t rtc_get_month(void) {
83}
84
85static inline uint16_t rtc_get_date(void) {
87}
88
89static inline uint16_t rtc_get_day_of_week(void) {
91}
92
93static inline uint16_t rtc_get_hour(void) {
95}
96
97static inline uint16_t rtc_get_minute(void) {
99}
100
101static inline uint16_t rtc_get_second(void) {
103}
104
105void rtc_enable_alarm(uint8_t hour, uint8_t minute);
107
108#define TIMER_HBLANK 0
109#define TIMER_VBLANK 1
110#define TIMER_ONESHOT 0
111#define TIMER_AUTOPRESET 1
112
113void timer_enable(uint8_t type, uint16_t reload, uint16_t count);
114void timer_disable(uint8_t type);
115uint16_t timer_get_count(uint8_t type);
116
119#endif /* __WF_LIBWW_TIMER_H__ */
static uint16_t rtc_get_month(void)
Definition timer.h:81
#define RTC_YEAR
Definition timer.h:37
static uint16_t rtc_get_year(void)
Definition timer.h:77
static void rtc_set_date(uint16_t value)
Definition timer.h:55
#define RTC_SEC
Definition timer.h:43
uint16_t rtc_get_datetime(uint16_t field)
#define RTC_MIN
Definition timer.h:42
static void rtc_set_month(uint16_t value)
Definition timer.h:51
void rtc_set_datetime(uint16_t field, uint16_t value)
static void rtc_set_second(uint16_t value)
Definition timer.h:71
#define RTC_DATE
Definition timer.h:39
void rtc_disable_alarm(void)
#define RTC_HOUR
Definition timer.h:41
static void rtc_set_day_of_week(uint16_t value)
Definition timer.h:59
static uint16_t rtc_get_hour(void)
Definition timer.h:93
static void rtc_set_hour(uint16_t value)
Definition timer.h:63
static uint16_t rtc_get_date(void)
Definition timer.h:85
void timer_disable(uint8_t type)
#define RTC_MONTH
Definition timer.h:38
static void rtc_set_minute(uint16_t value)
Definition timer.h:67
static uint16_t rtc_get_second(void)
Definition timer.h:101
uint16_t timer_get_count(uint8_t type)
#define RTC_DAY_OF_WEEK
Definition timer.h:40
void rtc_enable_alarm(uint8_t hour, uint8_t minute)
void timer_enable(uint8_t type, uint16_t reload, uint16_t count)
static uint16_t rtc_get_minute(void)
Definition timer.h:97
static uint16_t rtc_get_day_of_week(void)
Definition timer.h:89
static void rtc_set_year(uint16_t value)
Definition timer.h:47