-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIV3.h
59 lines (47 loc) · 1 KB
/
IV3.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
59
#ifndef __IV3__
#define __IV3__
#include <Arduino.h>
#define MAX_TUBE_BRIGHTNESS 20
#define SET_TIME 0
#define READ_TIME 1
#define CLOCK_MODE 2
#define USER_DISPLAY 3
#define HOUR_MODE 4
#define SET_BRIGHTNESS 5
#define NIGHT_FADE 6
#define GET_STATUS 7
#define SFT_RST 0xFF
typedef struct
{
uint8_t year;
uint8_t month;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t second;
} TIME_STRUCT;
class IV3_clock
{
private:
uint8_t I2C_address = 0x16;
uint8_t IV3_status;
void i2c_trans(uint8_t* data, uint8_t length);
public:
TIME_STRUCT time;
// Constructor
IV3_clock(){};
void set_time(void);
void get_time(void);
void clock_mode(void);
void user_display(uint8_t *data);
void set_hour_mode(bool mode);
void set_brightness(uint8_t brightness);
void set_night_fade(bool fade);
void reset(void);
void get_status(void);
bool get_hour_mode(void);
bool get_fade_mode(void);
uint8_t get_brightness(void);
void print_time(void);
};
#endif