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 RTC24_REG_SECONDS 0x00
74#define RTC24_REG_MINUTES 0x01
75#define RTC24_REG_HOURS 0x02
76#define RTC24_REG_DAY 0x03
77#define RTC24_REG_DATE 0x04
78#define RTC24_REG_MONTH 0x05
79#define RTC24_REG_YEAR 0x06
80#define RTC24_REG_CONTROL 0x07
81#define RTC24_REG_RAM_START 0x08
82#define RTC24_REG_RAM_END 0x3F
100#define RTC24_CONTROL_OUT_LOW 0x00
101#define RTC24_CONTROL_OUT_HIGH 0x80
102#define RTC24_CONTROL_OUT_MASK 0x80
103#define RTC24_CONTROL_SQWE_DIS 0x00
104#define RTC24_CONTROL_SQWE_EN 0x10
105#define RTC24_CONTROL_SQWE_MASK 0x10
106#define RTC24_CONTROL_RS_1HZ 0x00
107#define RTC24_CONTROL_RS_4_096KHZ 0x01
108#define RTC24_CONTROL_RS_8_192KHZ 0x02
109#define RTC24_CONTROL_RS_32_768KHZ 0x03
110#define RTC24_CONTROL_RS_MASK 0x03
116#define RTC24_MONDAY 0x00
117#define RTC24_TUESDAY 0x01
118#define RTC24_WEDNESDAY 0x02
119#define RTC24_THURSDAY 0x03
120#define RTC24_FRIDAY 0x04
121#define RTC24_SATURDAY 0x05
122#define RTC24_SUNDAY 0x06
128#define RTC24_DUMMY_RAM 0xA5
135#define RTC24_DEVICE_ADDRESS 0x68
153#define RTC24_MAP_MIKROBUS( cfg, mikrobus ) \
154 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
155 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
156 cfg.sqw = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t rtc24_read_time(rtc24_t *ctx, rtc24_time_t *time)
RTC 24 read time function.
err_t rtc24_check_communication(rtc24_t *ctx)
RTC 24 check communication function.
err_t rtc24_write_regs(rtc24_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
RTC 24 write multiple registers function.
err_t rtc24_default_cfg(rtc24_t *ctx)
RTC 24 default configuration function.
err_t rtc24_set_time(rtc24_t *ctx, rtc24_time_t *time)
RTC 24 set time function.
uint8_t rtc24_get_sqw_pin(rtc24_t *ctx)
RTC 24 get square wave pin function.
err_t rtc24_read_reg(rtc24_t *ctx, uint8_t reg, uint8_t *data_out)
RTC 24 read single register function.
err_t rtc24_write_reg(rtc24_t *ctx, uint8_t reg, uint8_t data_in)
RTC 24 write single register function.
err_t rtc24_set_date(rtc24_t *ctx, rtc24_date_t *date)
RTC 24 set date function.
err_t rtc24_init(rtc24_t *ctx, rtc24_cfg_t *cfg)
RTC 24 initialization function.
err_t rtc24_read_regs(rtc24_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
RTC 24 read multiple registers function.
void rtc24_cfg_setup(rtc24_cfg_t *cfg)
RTC 24 configuration object setup function.
err_t rtc24_read_date(rtc24_t *ctx, rtc24_date_t *date)
RTC 24 read date function.
rtc24_return_value_t
RTC 24 Click return value data.
Definition rtc24.h:226
@ RTC24_OK
Definition rtc24.h:227
@ RTC24_ERROR
Definition rtc24.h:228
RTC 24 Click configuration object.
Definition rtc24.h:183
uint32_t i2c_speed
Definition rtc24.h:189
pin_name_t sqw
Definition rtc24.h:187
pin_name_t scl
Definition rtc24.h:184
pin_name_t sda
Definition rtc24.h:185
uint8_t i2c_address
Definition rtc24.h:190
RTC 24 Click date object.
Definition rtc24.h:213
uint8_t month
Definition rtc24.h:216
uint8_t day
Definition rtc24.h:215
uint8_t year
Definition rtc24.h:217
uint8_t day_of_week
Definition rtc24.h:214
RTC 24 Click context object.
Definition rtc24.h:166
i2c_master_t i2c
Definition rtc24.h:171
digital_in_t sqw
Definition rtc24.h:168
uint8_t slave_address
Definition rtc24.h:174
RTC 24 Click time object.
Definition rtc24.h:200
uint8_t second
Definition rtc24.h:201
uint8_t minute
Definition rtc24.h:202
uint8_t hour
Definition rtc24.h:203