39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define RTC15_REG_CONTROL1 0x00
74#define RTC15_REG_CONTROL2 0x01
75#define RTC15_REG_OFFSET 0x02
76#define RTC15_REG_RAM 0x03
77#define RTC15_REG_SECONDS 0x04
78#define RTC15_REG_MINUTES 0x05
79#define RTC15_REG_HOURS 0x06
80#define RTC15_REG_DATE 0x07
81#define RTC15_REG_WEEKDAY 0x08
82#define RTC15_REG_MONTH 0x09
83#define RTC15_REG_YEAR 0x0A
84#define RTC15_REG_SECONDS_ALARM 0x0B
85#define RTC15_REG_MINUTES_ALARM 0x0C
86#define RTC15_REG_HOURS_ALARM 0x0D
87#define RTC15_REG_DATE_ALARM 0x0E
88#define RTC15_REG_WEEKDAY_ALARM 0x0F
89#define RTC15_REG_TIMER_VALUE 0x10
90#define RTC15_REG_TIMER_MODE 0x11
108#define RTC15_CONTROL1_TEST_NORMAL 0x00
109#define RTC15_CONTROL1_TEST_EXTCLK 0x80
110#define RTC15_CONTROL1_TEST_MASK 0x80
111#define RTC15_CONTROL1_SR_NORMAL 0x00
112#define RTC15_CONTROL1_SR_RESET 0x58
113#define RTC15_CONTROL1_SR_MASK 0x58
114#define RTC15_CONTROL1_STOP_NO_STOP 0x00
115#define RTC15_CONTROL1_STOP_RTC_STOP 0x20
116#define RTC15_CONTROL1_STOP_MASK 0x20
117#define RTC15_CONTROL1_CIE_DIS 0x00
118#define RTC15_CONTROL1_CIE_EN 0x04
119#define RTC15_CONTROL1_CIE_MASK 0x04
120#define RTC15_CONTROL1_12_24_24 0x00
121#define RTC15_CONTROL1_12_24_12 0x02
122#define RTC15_CONTROL1_12_24_MASK 0x02
128#define RTC15_CONTROL2_AIE_DIS 0x00
129#define RTC15_CONTROL2_AIE_EN 0x80
130#define RTC15_CONTROL2_AIE_MASK 0x80
131#define RTC15_CONTROL2_AF_DIS 0x00
132#define RTC15_CONTROL2_AF_EN 0x40
133#define RTC15_CONTROL2_AF_MASK 0x40
134#define RTC15_CONTROL2_MI_DIS 0x00
135#define RTC15_CONTROL2_MI_EN 0x20
136#define RTC15_CONTROL2_MI_MASK 0x20
137#define RTC15_CONTROL2_HMI_DIS 0x00
138#define RTC15_CONTROL2_HMI_EN 0x10
139#define RTC15_CONTROL2_HMI_MASK 0x10
140#define RTC15_CONTROL2_TF_DIS 0x00
141#define RTC15_CONTROL2_TF_EN 0x08
142#define RTC15_CONTROL2_TF_MASK 0x08
143#define RTC15_CONTROL2_FD_32_768KHZ 0x00
144#define RTC15_CONTROL2_FD_16_384KHZ 0x01
145#define RTC15_CONTROL2_FD_8_192KHZ 0x02
146#define RTC15_CONTROL2_FD_4_096KHZ 0x03
147#define RTC15_CONTROL2_FD_2_048KHZ 0x04
148#define RTC15_CONTROL2_FD_1_024KHZ 0x05
149#define RTC15_CONTROL2_FD_1HZ 0x06
150#define RTC15_CONTROL2_FD_LOW 0x07
151#define RTC15_CONTROL2_FD_MASK 0x07
157#define RTC15_OFFSET_MODE_NORMAL 0x00
158#define RTC15_OFFSET_MODE_FAST 0x80
159#define RTC15_OFFSET_MODE_MASK 0x80
160#define RTC15_OFFSET_OFFSET_MASK 0x7F
166#define RTC15_TIMER_VALUE_DEFAULT 0x01
172#define RTC15_TIMER_MODE_TD_4_096KHZ 0x00
173#define RTC15_TIMER_MODE_TD_64HZ 0x08
174#define RTC15_TIMER_MODE_TD_1HZ 0x10
175#define RTC15_TIMER_MODE_TD_1_OVER_64HZ 0x18
176#define RTC15_TIMER_MODE_TD_MASK 0x18
177#define RTC15_TIMER_MODE_TE_DIS 0x00
178#define RTC15_TIMER_MODE_TE_EN 0x04
179#define RTC15_TIMER_MODE_TE_MASK 0x04
180#define RTC15_TIMER_MODE_TIE_DIS 0x00
181#define RTC15_TIMER_MODE_TIE_EN 0x02
182#define RTC15_TIMER_MODE_TIE_MASK 0x02
183#define RTC15_TIMER_MODE_TI_TP_INTERVAL 0x00
184#define RTC15_TIMER_MODE_TI_TP_PULSE 0x01
185#define RTC15_TIMER_MODE_TI_TP_MASK 0x01
191#define RTC15_MONDAY 0x00
192#define RTC15_TUESDAY 0x01
193#define RTC15_WEDNESDAY 0x02
194#define RTC15_THURSDAY 0x03
195#define RTC15_FRIDAY 0x04
196#define RTC15_SATURDAY 0x05
197#define RTC15_SUNDAY 0x06
203#define RTC15_DUMMY_RAM 0xA5
210#define RTC15_DEVICE_ADDRESS 0x51
228#define RTC15_MAP_MIKROBUS( cfg, mikrobus ) \
229 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
230 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
231 cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
232 cfg.cle = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
233 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t rtc15_set_date(rtc15_t *ctx, rtc15_date_t *date)
RTC 15 set date function.
uint8_t rtc15_get_int_pin(rtc15_t *ctx)
RTC 15 get interrupt pin function.
err_t rtc15_check_communication(rtc15_t *ctx)
RTC 15 check communication function.
void rtc15_enable_device(rtc15_t *ctx)
RTC 15 enable device function.
void rtc15_disable_device(rtc15_t *ctx)
RTC 15 disable device function.
void rtc15_disable_clkout(rtc15_t *ctx)
RTC 15 disable clock output function.
err_t rtc15_read_time(rtc15_t *ctx, rtc15_time_t *time)
RTC 15 read time function.
err_t rtc15_default_cfg(rtc15_t *ctx)
RTC 15 default configuration function.
err_t rtc15_init(rtc15_t *ctx, rtc15_cfg_t *cfg)
RTC 15 initialization function.
void rtc15_enable_clkout(rtc15_t *ctx)
RTC 15 enable clock output function.
void rtc15_cfg_setup(rtc15_cfg_t *cfg)
RTC 15 configuration object setup function.
err_t rtc15_set_time(rtc15_t *ctx, rtc15_time_t *time)
RTC 15 set time function.
err_t rtc15_read_date(rtc15_t *ctx, rtc15_date_t *date)
RTC 15 read date function.
err_t rtc15_read_regs(rtc15_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
RTC 15 read multiple registers function.
err_t rtc15_write_reg(rtc15_t *ctx, uint8_t reg, uint8_t data_in)
RTC 15 write single register function.
err_t rtc15_read_reg(rtc15_t *ctx, uint8_t reg, uint8_t *data_out)
RTC 15 read single register function.
err_t rtc15_write_regs(rtc15_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
RTC 15 write multiple registers function.
rtc15_return_value_t
RTC 15 Click return value data.
Definition rtc15.h:309
@ RTC15_OK
Definition rtc15.h:310
@ RTC15_ERROR
Definition rtc15.h:311
RTC 15 Click configuration object.
Definition rtc15.h:264
uint32_t i2c_speed
Definition rtc15.h:272
pin_name_t cle
Definition rtc15.h:269
pin_name_t scl
Definition rtc15.h:265
pin_name_t en
Definition rtc15.h:268
pin_name_t int_pin
Definition rtc15.h:270
pin_name_t sda
Definition rtc15.h:266
uint8_t i2c_address
Definition rtc15.h:273
RTC 15 Click date object.
Definition rtc15.h:296
uint8_t month
Definition rtc15.h:299
uint8_t day
Definition rtc15.h:298
uint8_t year
Definition rtc15.h:300
uint8_t day_of_week
Definition rtc15.h:297
RTC 15 Click context object.
Definition rtc15.h:243
digital_out_t cle
Definition rtc15.h:246
digital_in_t int_pin
Definition rtc15.h:249
i2c_master_t i2c
Definition rtc15.h:252
digital_out_t en
Definition rtc15.h:245
uint8_t slave_address
Definition rtc15.h:255
RTC 15 Click time object.
Definition rtc15.h:283
uint8_t second
Definition rtc15.h:284
uint8_t minute
Definition rtc15.h:285
uint8_t hour
Definition rtc15.h:286