Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
52 #define RTC3_MAP_MIKROBUS( cfg, mikrobus ) \
53 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
55 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
62 #define RTC3_I2C_ADDRESS 0x68
69 #define RTC3_REG_TIME_SEC 0x00
70 #define RTC3_REG_TIME_MIN 0x01
71 #define RTC3_REG_TIME_HOUR 0x02
72 #define RTC3_REG_TIME_DAY_OF_THE_WEEK 0x03
73 #define RTC3_REG_TIME_DATE_DAY 0x04
74 #define RTC3_REG_TIME_DATE_MONTH 0x05
75 #define RTC3_REG_TIME_DATE_YEAR 0x06
76 #define RTC3_REG_CONFIG1 0x07
77 #define RTC3_REG_TRICKLE_CHARGE2 0x08
78 #define RTC3_REG_CONFIG2 0x09
79 #define RTC3_REG_SF_KEY1 0x20
80 #define RTC3_REG_SF_KEY2 0x21
81 #define RTC3_REG_SFR 0x22
88 #define RTC3_ENABLE_COUNTING 0x7F
89 #define RTC3_DISABLE_COUNTING 0x80
90 #define RTC3_CONFIG1_INITIAL 0x80
91 #define RTC3_TCH2_OPEN 0x00
92 #define RTC3_TCH2_CLOSED 0x20
93 #define RTC3_TCFE_OPEN 0x00
94 #define RTC3_TCFE_CLOSED 0x20
95 #define RTC3_FTF_NORMAL_512_HZ 0x00
96 #define RTC3_FTF_1_HZ 0x01
103 #define RTC3_RETVAL uint8_t
106 #define RTC3_INIT_ERROR 0xFF
uint8_t rtc3_get_interrupt(rtc3_t *ctx)
Get state of interrupt pin function.
void rtc3_set_date_month(rtc3_t *ctx, uint8_t date_month)
Set month function.
void rtc3_get_date(rtc3_t *ctx)
Get time hours, minutes and seconds function.
uint8_t rtc3_get_time_value(rtc3_t *ctx, uint8_t time_part)
Get time value function.
Time data structure.
Definition: rtc3.h:132
pin_name_t int_pin
Definition: rtc3.h:178
uint8_t time_seconds
Definition: rtc3.h:137
void rtc3_set_calibration(rtc3_t *ctx, uint8_t cal_sign, uint8_t cal_mumber)
Set calibration function.
uint8_t time_minutes
Definition: rtc3.h:136
void rtc3_get_time(rtc3_t *ctx)
Get time hours, minutes, seconds and hundredth of a seconds function.
uint8_t slave_address
Definition: rtc3.h:157
pin_name_t scl
Definition: rtc3.h:173
void rtc3_cfg_setup(rtc3_cfg_t *cfg)
Config Object Initialization function.
#define RTC3_RETVAL
Definition: rtc3.h:103
Date data structure.
Definition: rtc3.h:119
uint8_t rtc3_get_date_year(rtc3_t *ctx)
Get year function.
int8_t time_hun_sec
Definition: rtc3.h:138
digital_in_t int_pin
Definition: rtc3.h:149
uint8_t day_of_the_week
Definition: rtc3.h:122
void rtc3_set_special_function_key2(rtc3_t *ctx, uint8_t sfkey2)
Set special function key byte 2 function.
uint8_t rtc3_get_day_of_the_week(rtc3_t *ctx)
Get day of the week function.
RTC3_RETVAL rtc3_init(rtc3_t *ctx, rtc3_cfg_t *cfg)
Initialization function.
i2c_master_t i2c
Definition: rtc3.h:153
void rtc3_set_time_value(rtc3_t *ctx, uint8_t time_part, uint8_t time_addr)
Set time values function.
Click configuration structure definition.
Definition: rtc3.h:169
void rtc3_generic_read(rtc3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void rtc3_set_trickle_charge_bypass(rtc3_t *ctx, uint8_t tcfe)
Set trickle charge bypass control function.
void rtc3_set_time(rtc3_t *ctx)
Set time hours, minutes, seconds and hundredth of a seconds function.
void rtc3_set_trickle_charge(rtc3_t *ctx, uint8_t tch2)
Set trickle charge control function.
uint8_t time_hours
Definition: rtc3.h:135
void rtc3_generic_write(rtc3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void rtc3_set_frequency_calibration(rtc3_t *ctx, uint8_t ftf)
Set frequency calibration control function.
void rtc3_set_special_function_key1(rtc3_t *ctx, uint8_t sfkey1)
Set special function key byte 1 function.
uint8_t rtc3_get_date_month(rtc3_t *ctx)
Get month function.
void rtc3_enable_disable_counting(rtc3_t *ctx, uint8_t en_dis)
Enable/Disable counting function.
void rtc3_set_date(rtc3_t *ctx)
Set date hours, minutes and seconds function.
void rtc3_set_date_year(rtc3_t *ctx, uint16_t date_year)
Set year function.
uint8_t i2c_address
Definition: rtc3.h:183
time_data_t time
Definition: rtc3.h:162
void rtc3_set_day_of_the_week(rtc3_t *ctx, uint8_t w_day)
Set day of the week function.
uint16_t date_year
Definition: rtc3.h:125
uint8_t date_day
Definition: rtc3.h:123
uint8_t date_month
Definition: rtc3.h:124
uint32_t i2c_speed
Definition: rtc3.h:182
void rtc3_set_date_day(rtc3_t *ctx, uint8_t date_day)
Set day function.
void rtc3_default_cfg(rtc3_t *ctx)
Click Default Configuration function.
pin_name_t sda
Definition: rtc3.h:174
date_data_t date
Definition: rtc3.h:161
uint8_t rtc3_get_date_day(rtc3_t *ctx)
Get day function.
Click ctx object definition.
Definition: rtc3.h:145