-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPCF2127a.h
More file actions
57 lines (53 loc) · 1.53 KB
/
Copy pathPCF2127a.h
File metadata and controls
57 lines (53 loc) · 1.53 KB
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
//Copyright Eric Dinger October 26 2012
//This is a driver for the NXP rtc 2127a, and maybe the 2129a
//Registers - names match those in the datasheet
#define Control_1 0x00
#define Control_2 0x01
#define Control_3 0x02
//Time and date registers
#define Seconds 0x03
#define Minutes 0x04
#define Hours 0x05
#define Days 0x06
#define Weekdays 0x07
#define Months 0x08
#define Years 0x09
//Alarm registers
#define Second_alarm 0x0A
#define Minute_alarm 0x0B
#define Hour_alarm 0x0C
#define Day_alarm 0x0D
#define Weekday_alarm 0x0E
//CLKOUT control register
#define CLKOUT_ctl 0x0F
//Watchdog Registers
#define Watchdg_tim_ctl 0x10
#define Watchdg_tim_val 0x11
//Timestamp registers
#define Timestp_ctl 0x12
#define Sec_timestp 0x13
#define Min_timestp 0x14
#define Hour_timestp 0x15
#define Day_timestp 0x16
#define Mon_timestp 0x17
#define Year_timestp 0x18
//Aging offset register
#define Aging_offset 0x19
//Ram register 2127 only?
#define RAM_addr_MSB 0x1A
#define RAM_addr_LSB 0x1B
#define RAM_wrt_cmd 0x1C
#define RAM_rd_cmd 0x1D
//The following define control bits and enums, using the names in the datasheet
//When possible
//Control 1
#define STOP 0b100000
#define TSF1 0b10000
#define POR_OVRD 0b1000
#define HOUR_MODE_12 0b100
#define MI 0b10
#define SI 0b1
/*
* Checks if the oscillator stop flag has been set
* Returns a 1 if the flag is set
*/