42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
67#define RTC_C_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
85#define RTC_C_I2C_ADDRESS_0 0x50
86#define RTC_C_I2C_ADDRESS_1 0x51
93#define RTC_C_REG_CONTROL 0x00
94#define RTC_C_REG_TIME_HUN_SEC 0x01
95#define RTC_C_REG_TIME_SEC 0x02
96#define RTC_C_REG_TIME_MIN 0x03
97#define RTC_C_REG_TIME_HOUR 0x04
98#define RTC_C_REG_TIME_DATE_DAY_AND_YEAR 0x05
99#define RTC_C_REG_TIME_DAY_OF_THE_WEEK_AND_MONTH 0x06
100#define RTC_C_REG_TIMER 0x07
101#define RTC_C_REG_TIME_ALARM_CONTROL 0x08
102#define RTC_C_REG_TIME_ALARM_HUN_SEC 0x09
103#define RTC_C_REG_TIME_ALARM_SEC 0x0A
104#define RTC_C_REG_TIME_ALARM_MIN 0x0B
105#define RTC_C_REG_TIME_ALARM_HOUR 0x0C
106#define RTC_C_REG_TIME_ALARM_DATE_DAY_AND_YEAR 0x0D
107#define RTC_C_REG_TIME_ALARM_DAY_OF_THE_WEEK_AND_MONTH 0x0E
108#define RTC_C_REG_TIME_ALARM_TIMER 0x0F
void rtc_c_set_date(rtc_c_t *ctx)
Set date hours, minutes and seconds function.
uint8_t rtc_c_get_date_year(rtc_c_t *ctx)
Get year function.
void rtc_c_set_time(rtc_c_t *ctx)
Set time hours, minutes, seconds and hundredth of a seconds function.
void rtc_c_set_day_of_the_week(rtc_c_t *ctx, uint8_t w_day)
Set day of the week function.
void rtc_c_set_time_alarm(rtc_c_t *ctx)
Set alarm time - minutes function.
uint8_t rtc_c_get_date_day(rtc_c_t *ctx)
Get day function.
void rtc_c_get_time_alarm(rtc_c_t *ctx)
Get the alarm time hours, minutes, seconds and hundredth of a seconds function.
err_t rtc_c_generic_read(rtc_c_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
RTC I2C reading function.
void rtc_c_set_date_day(rtc_c_t *ctx, uint8_t date_day)
Set day function.
void rtc_c_read_time(rtc_c_t *ctx)
Set control register to read time function.
uint8_t rtc_c_get_day_of_the_week(rtc_c_t *ctx)
Get day of the week function.
uint8_t rtc_c_get_interrupt(rtc_c_t *ctx)
Get state of interrupt pin function.
uint8_t rtc_c_check_leap_year(rtc_c_t *ctx)
Check if it's a leap year function.
uint8_t rtc_c_get_date_month(rtc_c_t *ctx)
Get month function.
void rtc_c_set_date_month(rtc_c_t *ctx, uint8_t date_month)
Set month function.
void rtc_c_enable_disable_counting(rtc_c_t *ctx, uint8_t en_dis)
Enable/Disable counting function.
err_t rtc_c_init(rtc_c_t *ctx, rtc_c_cfg_t *cfg)
Initialization function.
void rtc_c_set_alarm_value(rtc_c_t *ctx, uint8_t al_time_val, uint8_t al_time_type)
Set alarm time value.
void rtc_c_enable_disable_alarm(rtc_c_t *ctx, uint8_t en_dis)
Enable/Disable alarm function.
void rtc_c_read_date(rtc_c_t *ctx)
Set control register to read date function.
void rtc_c_set_time_value(rtc_c_t *ctx, uint8_t time_part, uint8_t time_addr)
Set time values function.
void rtc_c_cfg_setup(rtc_c_cfg_t *cfg)
Config Object Initialization function.
uint8_t rtc_c_get_time_value(rtc_c_t *ctx, uint8_t time_part)
Get time value function.
err_t rtc_c_generic_write(rtc_c_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
RTC I2C writing function.
void rtc_c_get_date(rtc_c_t *ctx)
Get time hours, minutes and seconds function.
uint8_t rtc_c_get_alarm_value(rtc_c_t *ctx, uint8_t alarm_addr)
Get alarm time value function.
void rtc_c_enable_disable_interrupt(rtc_c_t *ctx, uint8_t flag)
Enable alarm interrupt function.
void rtc_c_get_time(rtc_c_t *ctx)
Get time hours, minutes, seconds and hundredth of a seconds function.
void rtc_c_set_date_year(rtc_c_t *ctx, uint16_t date_year)
Set year function.
Click configuration structure definition.
Definition rtc.h:166
uint32_t i2c_speed
Definition rtc.h:175
pin_name_t scl
Definition rtc.h:168
pin_name_t int_pin
Definition rtc.h:172
pin_name_t sda
Definition rtc.h:169
uint8_t i2c_address
Definition rtc.h:176
Date data structure.
Definition rtc.h:122
uint8_t date_month
Definition rtc.h:125
uint16_t date_year
Definition rtc.h:126
uint8_t day_of_the_week
Definition rtc.h:123
uint8_t date_day
Definition rtc.h:124
Click ctx object definition.
Definition rtc.h:146
rtc_c_date_t date
Definition rtc.h:157
digital_in_t int_pin
Definition rtc.h:148
i2c_master_t i2c
Definition rtc.h:151
uint8_t slave_address
Definition rtc.h:154
rtc_c_time_t time
Definition rtc.h:158
Time data structure.
Definition rtc.h:134
uint8_t time_hours
Definition rtc.h:135
int8_t time_hun_sec
Definition rtc.h:138
uint8_t time_minutes
Definition rtc.h:136
uint8_t time_seconds
Definition rtc.h:137