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 RTC21_REG_SECOND 0x00
74#define RTC21_REG_MINUTE 0x01
75#define RTC21_REG_HOUR 0x02
76#define RTC21_REG_DAY_OF_WEEK 0x03
77#define RTC21_REG_DATE 0x04
78#define RTC21_REG_MONTH 0x05
79#define RTC21_REG_YEAR 0x06
80#define RTC21_REG_CONTROL 0x07
81#define RTC21_REG_RAM_BOTTOM 0x08
82#define RTC21_REG_RAM_TOP 0x3F
100#define RTC21_MONDAY 0x01
101#define RTC21_TUESDAY 0x02
102#define RTC21_WEDNESDAY 0x03
103#define RTC21_THURSDAY 0x04
104#define RTC21_FRIDAY 0x05
105#define RTC21_SATURDAY 0x06
106#define RTC21_SUNDAY 0x07
113#define RTC21_DEVICE_ADDRESS 0x68
131#define RTC21_MAP_MIKROBUS( cfg, mikrobus ) \
132 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
133 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
134 cfg.ft = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t rtc21_generic_write(rtc21_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
RTC 21 I2C writing function.
err_t rtc21_read_register(rtc21_t *ctx, uint8_t reg, uint8_t *data_out)
RTC 21 read register function.
uint8_t rtc21_get_ft_pin(rtc21_t *ctx)
RTC 21 get ft pin function.
err_t rtc21_write_register(rtc21_t *ctx, uint8_t reg, uint8_t data_in)
RTC 21 write register function.
err_t rtc21_set_time(rtc21_t *ctx, rtc21_time_t *time)
RTC 21 set time function.
err_t rtc21_read_date(rtc21_t *ctx, rtc21_date_t *date)
RTC 21 read date function.
err_t rtc21_generic_read(rtc21_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
RTC 21 I2C reading function.
err_t rtc21_set_date(rtc21_t *ctx, rtc21_date_t *date)
RTC 21 set date function.
err_t rtc21_read_time(rtc21_t *ctx, rtc21_time_t *time)
RTC 21 read time function.
err_t rtc21_init(rtc21_t *ctx, rtc21_cfg_t *cfg)
RTC 21 initialization function.
void rtc21_cfg_setup(rtc21_cfg_t *cfg)
RTC 21 configuration object setup function.
rtc21_return_value_t
RTC 21 Click return value data.
Definition rtc21.h:204
@ RTC21_OK
Definition rtc21.h:205
@ RTC21_ERROR
Definition rtc21.h:206
RTC 21 Click configuration object.
Definition rtc21.h:161
uint32_t i2c_speed
Definition rtc21.h:167
pin_name_t scl
Definition rtc21.h:162
pin_name_t sda
Definition rtc21.h:163
pin_name_t ft
Definition rtc21.h:165
uint8_t i2c_address
Definition rtc21.h:168
RTC 21 Click date object.
Definition rtc21.h:191
uint8_t month
Definition rtc21.h:194
uint8_t day
Definition rtc21.h:193
uint8_t year
Definition rtc21.h:195
uint8_t day_of_week
Definition rtc21.h:192
RTC 21 Click context object.
Definition rtc21.h:144
i2c_master_t i2c
Definition rtc21.h:149
uint8_t slave_address
Definition rtc21.h:152
digital_in_t ft
Definition rtc21.h:146
RTC 21 Click time object.
Definition rtc21.h:178
uint8_t second
Definition rtc21.h:179
uint8_t minute
Definition rtc21.h:180
uint8_t hour
Definition rtc21.h:181