-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathds3231.h
58 lines (48 loc) · 1.71 KB
/
ds3231.h
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
#ifndef LIBS_DS3231_H_
#define LIBS_DS3231_H_
#ifndef I2C_H_
#include "i2c.h"
#endif
#ifndef GPIO_H_
#include "gpio.h"
#endif
#ifndef _STDBOOL_H
#include <stdbool.h>
#endif
#define SECONDS_FROM_1970_TO_2000 946684800
typedef struct
{
uint8_t yOff, m, d, hh, mm, ss;
} DateTime;
static const uint8_t daysInMonth [];
ADI_I2C_RESULT setAlarm(); //por enquanto o valor é hardcoded
ADI_I2C_RESULT resetAlarm();
DateTime now();
uint32_t unixtime(DateTime dt);
uint8_t getSecond();
uint8_t getMinute();
uint8_t getHour(bool* _h12, bool* _PM_time);
uint8_t getDoW();
uint8_t getDate();
uint8_t getMonth(bool* _Century);
uint8_t getYear();
void setSecond(uint8_t Second);
void setMinute(uint8_t Minute);
void setHour(uint8_t Hour);
void setDoW(uint8_t DoW);
void setDate(uint8_t Date);
void setMonth(uint8_t Month);
void setYear(uint8_t Year);
void setClockMode(bool h12);
void getA1Time(uint8_t* _A1Day, uint8_t* _A1Hour, uint8_t* _A1Minute, uint8_t* _A1Second, uint8_t* _AlarmBits, bool* _A1Dy, bool* _A1h12, bool* _A1PM);
void getA2Time(uint8_t* _A2Day, uint8_t* _A2Hour, uint8_t* _A2Minute, uint8_t* _AlarmBits, bool* _A2Dy, bool* _A2h12, bool* _A2PM);
void setA1Time(uint8_t A1Day, uint8_t A1Hour, uint8_t A1Minute, uint8_t A1Second, uint8_t AlarmBits, bool A1Dy, bool A1h12, bool A1PM);
void setA2Time(uint8_t A2Day, uint8_t A2Hour, uint8_t A2Minute, uint8_t AlarmBits, bool A2Dy, bool A2h12, bool A2PM);
void turnOnAlarm(uint8_t Alarm);
void turnOffAlarm(uint8_t Alarm);
bool checkAlarmEnabled(uint8_t Alarm);
bool checkIfAlarm(uint8_t Alarm);
void enableOscillator(bool TF, bool battery, uint8_t frequency);
void enable32kHz(bool TF);
bool oscillatorCheck();
#endif /* LIBS_DS3231_H_ */