ATY_LIB V2_102_230218
ATY_LIB for general devices or ALGO
 
Loading...
Searching...
No Matches
rx8025t.h
Go to the documentation of this file.
1// Copyright 2021 IOsetting <iosetting(at)outlook.com>
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef __FW_RX8025T_H__
16#define __FW_RX8025T_H__
17
18#include "fw_hal.h"
19
20#define RX8025T_I2C_ADDR 0x64
21
27#define RX8025T_REG_SECOND 0x00 // BCD value 00 -> 59
28#define RX8025T_REG_MINUTE 0x01 // BCD value 00 -> 59
29#define RX8025T_REG_HOUR 0x02 // BCD value 00 -> 23
30#define RX8025T_REG_WEEKDAY 0x03 // bit 0->6: sunday->saturday
31#define RX8025T_REG_DAY 0x04 // BCD value 01 -> 31
32#define RX8025T_REG_MONTH 0x05 // BCD value 01 -> 12
33#define RX8025T_REG_YEAR 0x06 // BCD value 00 -> 99
34#define RX8025T_REG_RAM 0x07 // R/W accessible for any data in the range from 00 h to FF h
35
36#define RX8025T_REG_ALARM_MIN 0x08 // BCD value 00 -> 59
37#define RX8025T_REG_ALARM_HOUR 0x09 // BCD value 00 -> 23
38#define RX8025T_REG_ALARM_W_OR_D 0x0A // WEEK: bit 0->6: sunday->saturday
39 // DAY: BCD value
40
41#define RX8025T_REG_TIMER_COUNTER0 0x0B // Fixed-cycle timer control registers to set the preset countdown value
42 // for the fixed-cycle timer interrupt. (COUNTER1, COUNTER0) = 12bit number
43#define RX8025T_REG_TIMER_COUNTER1 0x0C // When control register changes from 001h to 000h, the /INT pin goes to
44 // low level and "1" is set to the TF.
45
46#define RX8025T_REG_EXTEN 0x0D
47 #define RX8025T_EXTEN_TEST 0x80 // TEST bit. value should always be "0"
48 #define RX8025T_EXTEN_WADA 0x40 // Week Alarm/Day Alarm bit. R/W to specify either WEEK or DAY
49 // as the target of the alarm interrupt function. 0:WEEK, 1:DAY
50 #define RX8025T_EXTEN_USEL 0x20 // Update Interrupt Select bit. R/W specify either "second"
51 // or "minute" as update interrupt, 0:second update, 1:minute update
52 #define RX8025T_EXTEN_TE 0x10 // Timer Enable bit. controls the start/stop setting for the fixed-cycle
53 // timer interrupt function. 1:start, 0:stop
54 #define RX8025T_EXTEN_FSEL1 0x08 // FOUT frequency Select bits to set the FOUT frequency. (FSEL1, FSEL0)
55 #define RX8025T_EXTEN_FSEL0 0x04 // 0,0:32.768KHz, 0,1:1024Hz, 1,0:1Hz, 1,1:32.768KHz
56 #define RX8025T_EXTEN_TSEL1 0x02 // Timer Select bits to set the countdown period (source clock) for the
57 // fixed-cycle timer interrupt (TSEL1, TSEL0)
58 #define RX8025T_EXTEN_TSEL0 0x01 // 0,0:4096Hz, 0,1:64Hz, 1,0:1Hz(per second), 1,1:1/60Hz(per minute)
59
60#define RX8025T_REG_FLAG 0x0E
61 #define RX8025T_FLAG_UF 0x20 // Update Flag. 0 -> 1 when a time update interrupt event has
62 // occurred. 1 is retained until a 0 is written
63 #define RX8025T_FLAG_TF 0x10 // Timer Flag. 0 -> 1 when a fixed-cycle timer interrupt
64 // event has occurred, 1 is retained until a 0 is written
65 #define RX8025T_FLAG_AF 0x08 // Alarm Flag. 0 -> 1 when an alarm interrupt event has occurred
66 // 1 is retained until a 0 is written
67 #define RX8025T_FLAG_VLF 0x02 // Voltage Low Flag. 0 -> 1 when data loss occurs, e.g. a supply
68 // voltage drop,
69 #define RX8025T_FLAG_VDET 0x01 // Voltage Detection Flag. 0 -> 1 when stop the temperature compensation
70 // such as due to a supply voltage drop, 1 is retained until a 0 is written
71
72#define RX8025T_REG_CONTROL 0x0F
73 #define RX8025T_CONTR_CSEL1 0x80 // Compensation interval (CSEL1, CSEL0)
74 #define RX8025T_CONTR_CSEL0 0x40 // 0,0:0.5s, 0,1:2s(default), 1,0:10s, 1,1:30s
75 #define RX8025T_CONTR_UIE 0x20 // Update Interrupt Enable, 0:off, 1:on
76 #define RX8025T_CONTR_TIE 0x10 // Timer Interrupt Enable
77 #define RX8025T_CONTR_AIE 0x08 // Alarm Interrupt Enable
78 #define RX8025T_CONTR_RESET 0x01 // Writing a "1" to this bit stops the counter operation and
79 // resets the RTC module's internal counter value when the
80 // value is less than one second.
81
85
86#endif
unsigned char uint8_t
Definition: fw_types.h:18
uint8_t RX8025T_SetTime(uint8_t *t)
Definition: rx8025t.c:39
uint8_t RX8025T_Init(void)
Definition: rx8025t.c:24
uint8_t RX8025T_GetTime(uint8_t *t)
Definition: rx8025t.c:33