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_one_wire.h"
73#define RTC4_CMD_READ_CLOCK 0x66
74#define RTC4_CMD_WRITE_CLOCK 0x99
92#define RTC4_SEC_PER_MINUTE 60
93#define RTC4_SEC_PER_HOUR 3600
94#define RTC4_SEC_PER_DAY 86400
95#define RTC4_START_YEAR 1970
96#define RTC4_DAYS_PER_LEAP_YEAR 366
97#define RTC4_DAYS_PER_YEAR 365
98#define RTC4_DAYS_IN_FEB 29
116#define RTC4_DCB_INT_ENABLE 0x80
117#define RTC4_DCB_OSC_ENABLE 0x0C
118#define RTC4_DCB_INTERVAL_1S 0x00
119#define RTC4_DCB_INTERVAL_4S 0x10
120#define RTC4_DCB_INTERVAL_32S 0x20
121#define RTC4_DCB_INTERVAL_64S 0x30
122#define RTC4_DCB_INTERVAL_2048S 0x40
123#define RTC4_DCB_INTERVAL_4096S 0x50
124#define RTC4_DCB_INTERVAL_65536S 0x60
125#define RTC4_DCB_INTERVAL_131072S 0x70
131#define RTC4_FAMILY_CODE 0x27
149#define RTC4_MAP_MIKROBUS( cfg, mikrobus ) \
150 cfg.gp0 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
151 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
152 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
void rtc4_date_time_to_unix(rtc4_date_t *date, rtc4_time_t *time, uint32_t *unix_time)
RTC 4 date time to unix function.
err_t rtc4_check_communication(rtc4_t *ctx)
RTC 4 check communication function.
void rtc4_unix_to_date_time(uint32_t unix_time, rtc4_time_t *time, rtc4_date_t *date)
RTC 4 unix to date time function.
err_t rtc4_set_date_time(rtc4_t *ctx, rtc4_date_t *date, rtc4_time_t *time, uint8_t int_interval)
RTC 4 set date time function.
err_t rtc4_init(rtc4_t *ctx, rtc4_cfg_t *cfg)
RTC 4 initialization function.
err_t rtc4_get_unix_time(rtc4_t *ctx, uint32_t *unix_time)
RTC 4 get unix time function.
void rtc4_cfg_setup(rtc4_cfg_t *cfg)
RTC 4 configuration object setup function.
void rtc4_gpio_selection(rtc4_cfg_t *cfg, rtc4_gpio_sel_t gpio_sel)
RTC 4 driver interface setup function.
err_t rtc4_set_unix_and_int(rtc4_t *ctx, uint32_t unix_time, uint8_t int_interval)
RTC 4 set unix and interrupt interval function.
err_t rtc4_get_date_time(rtc4_t *ctx, rtc4_date_t *date, rtc4_time_t *time)
RTC 4 get date time function.
uint8_t rtc4_get_interrupt(rtc4_t *ctx)
RTC 4 get interrupt function.
rtc4_date_t date
Definition main.c:31
rtc4_time_t time
Definition main.c:30
rtc4_return_value_t
RTC 4 Click return value data.
Definition rtc4.h:232
@ RTC4_OK
Definition rtc4.h:233
@ RTC4_ERROR
Definition rtc4.h:234
rtc4_gpio_sel_t
RTC 4 Click gpio selector.
Definition rtc4.h:187
@ RTC4_GPIO_1
Definition rtc4.h:189
@ RTC4_GPIO_0
Definition rtc4.h:188
RTC 4 Click configuration object.
Definition rtc4.h:215
pin_name_t gp0
Definition rtc4.h:217
pin_name_t int_pin
Definition rtc4.h:221
pin_name_t gp1
Definition rtc4.h:218
rtc4_gpio_sel_t gpio_sel
Definition rtc4.h:223
RTC 4 Click date object.
Definition rtc4.h:175
uint32_t month
Definition rtc4.h:177
uint32_t day
Definition rtc4.h:178
uint32_t year
Definition rtc4.h:176
RTC 4 Click context object.
Definition rtc4.h:198
one_wire_rom_address_t rom_addr
Definition rtc4.h:205
digital_in_t int_pin
Definition rtc4.h:200
uint8_t address
Definition rtc4.h:206
one_wire_t ow
Definition rtc4.h:203
RTC 4 Click time object.
Definition rtc4.h:163
uint32_t min
Definition rtc4.h:165
uint32_t sec
Definition rtc4.h:166
uint32_t hours
Definition rtc4.h:164