Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define RTC20_REG_HUNDREDTHS 0x00
70 #define RTC20_REG_SECONDS 0x01
71 #define RTC20_REG_MINUTES 0x02
72 #define RTC20_REG_HOURS 0x03
73 #define RTC20_REG_DATE 0x04
74 #define RTC20_REG_MONTH 0x05
75 #define RTC20_REG_YEAR 0x06
76 #define RTC20_REG_DAY 0x07
77 #define RTC20_REG_HUNDREDTHS_ALARM 0x08
78 #define RTC20_REG_SECONDS_ALARM 0x09
79 #define RTC20_REG_MINUTES_ALARM 0x0A
80 #define RTC20_REG_HOURS_ALARM 0x0B
81 #define RTC20_REG_DATE_ALARM 0x0C
82 #define RTC20_REG_MONTH_ALARM 0x0D
83 #define RTC20_REG_WEEKDAYS_ALARM 0x0E
84 #define RTC20_REG_STATUS 0x0F
85 #define RTC20_REG_CONTROL1 0x10
86 #define RTC20_REG_CONTROL2 0x11
87 #define RTC20_REG_OSC_CONTROL 0x1C
88 #define RTC20_REG_OSC_STATUS 0x1D
106 #define RTC20_SET_CTRL_STOP_DISABLE 0x00
107 #define RTC20_SET_CTRL_STOP_ENABLE 0x01
108 #define RTC20_SET_CTRL_HOURS_OP_MODE_24h 0x00
109 #define RTC20_SET_CTRL_HOURS_OP_MODE_12h 0x01
110 #define RTC20_SET_CTRL_OUTB_nIRQ2 0x00
111 #define RTC20_SET_CTRL_OUTB_LKO2 0x01
112 #define RTC20_SET_CTRL_OUT_nIRQ 0x00
113 #define RTC20_SET_CTRL_OUT_SQWE 0x01
114 #define RTC20_SET_CTRL_ARST_NO_CLR 0x00
115 #define RTC20_SET_CTRL_ARST_CLR 0x01
116 #define RTC20_SET_CTRL_WRTC_DISABLE 0x00
117 #define RTC20_SET_CTRL_WRTC_ENABLE 0x01
118 #define RTC20_SET_CTRL_OUT2S_nIRQ_ENABLE 0x00
119 #define RTC20_SET_CTRL_OUT2S_SQW_ENABLE 0x01
120 #define RTC20_SET_CTRL_OUT2S_nAIRQ_ENABLE 0x03
121 #define RTC20_SET_CTRL_OUT2S_TIRQ_ENABLE 0x04
122 #define RTC20_SET_CTRL_OUT2S_nTIRQ_ENABLE 0x05
123 #define RTC20_SET_CTRL_OUT2S_OUTB_ENABLE 0x07
124 #define RTC20_SET_CTRL_OUT1S_nIRQ_ENABLE 0x00
125 #define RTC20_SET_CTRL_OUT1S_SQW_ENABLE 0x01
126 #define RTC20_SET_CTRL_OUT1S_SQW_nIRQ_ENABLE 0x02
127 #define RTC20_SET_CTRL_OUT1S_nAIRQ_ENABLE 0x03
133 #define RTC20_DW_SUNDAY 0
134 #define RTC20_DW_MONDAY 1
135 #define RTC20_DW_TUESDAY 2
136 #define RTC20_DW_WEDNESDAY 3
137 #define RTC20_DW_THURSDAY 4
138 #define RTC20_DW_FRIDAY 5
139 #define RTC20_DW_SATURDAY 6
148 #define RTC20_DEVICE_ADDRESS 0x69
166 #define RTC20_MAP_MIKROBUS( cfg, mikrobus ) \
167 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
168 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
169 cfg.ir2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
170 cfg.wdi = MIKROBUS( mikrobus, MIKROBUS_RST ); \
171 cfg.ext = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
172 cfg.ir1 = MIKROBUS( mikrobus, MIKROBUS_INT )
uint8_t arst
Definition: rtc20.h:256
uint8_t second
Definition: rtc20.h:226
pin_name_t wdi
Definition: rtc20.h:209
pin_name_t ir1
Definition: rtc20.h:211
uint8_t rtc20_get_ir2_pin(rtc20_t *ctx)
RTC 20 get IR2 pin function.
err_t rtc20_get_time(rtc20_t *ctx, rtc20_time_t *rtc_time)
RTC 20 get time function.
uint8_t month
Definition: rtc20.h:241
pin_name_t scl
Definition: rtc20.h:205
err_t rtc20_get_alarm(rtc20_t *ctx, rtc20_time_t *rtc_alarm_time, rtc20_date_t *rtc_alarm_date)
RTC 20 get alarm function.
err_t rtc20_get_date(rtc20_t *ctx, rtc20_date_t *rtc_date)
RTC 20 get date function.
err_t rtc20_set_time(rtc20_t *ctx, rtc20_time_t rtc_time)
RTC 20 set time function.
uint8_t day
Definition: rtc20.h:240
err_t rtc20_set_date(rtc20_t *ctx, rtc20_date_t rtc_date)
RTC 20 set date function.
err_t rtc20_set_ctrl_signals(rtc20_t *ctx, rtc20_ctrl_signals_t ctrl_signals)
RTC 20 set ctrl signals function.
uint8_t wrtc
Definition: rtc20.h:257
RTC 20 Click date object.
Definition: rtc20.h:238
uint32_t i2c_speed
Definition: rtc20.h:213
uint8_t outb
Definition: rtc20.h:254
err_t rtc20_set_alarm(rtc20_t *ctx, rtc20_time_t rtc_alarm_time, rtc20_date_t rtc_alarm_date)
RTC 20 set alarm function.
RTC 20 Click time object.
Definition: rtc20.h:224
err_t rtc20_generic_read(rtc20_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
RTC 20 I2C reading function.
uint8_t rtc20_get_ir1_pin(rtc20_t *ctx)
RTC 20 get IR1 pin function.
rtc20_return_value_t
RTC 20 Click return value data.
Definition: rtc20.h:268
err_t rtc20_get_ctrl_signals(rtc20_t *ctx, rtc20_ctrl_signals_t *ctrl_signals)
RTC 20 get ctrl signals function.
i2c_master_t i2c
Definition: rtc20.h:192
err_t rtc20_generic_write(rtc20_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
RTC 20 I2C writing function.
uint8_t hours_op_mode
Definition: rtc20.h:253
uint8_t hundredths
Definition: rtc20.h:225
RTC 20 Click control signals object.
Definition: rtc20.h:251
err_t rtc20_init(rtc20_t *ctx, rtc20_cfg_t *cfg)
RTC 20 initialization function.
RTC 20 Click configuration object.
Definition: rtc20.h:204
uint8_t hour
Definition: rtc20.h:228
uint8_t year
Definition: rtc20.h:242
pin_name_t ext
Definition: rtc20.h:210
uint8_t i2c_address
Definition: rtc20.h:214
@ RTC20_OK
Definition: rtc20.h:269
pin_name_t sda
Definition: rtc20.h:206
void rtc20_wdi_pin_state(rtc20_t *ctx, uint8_t pin_state)
RTC 20 I2C reading function.
uint8_t out
Definition: rtc20.h:255
void rtc20_ext_pin_state(rtc20_t *ctx, uint8_t pin_state)
RTC 20 I2C reading function.
uint8_t out1s
Definition: rtc20.h:259
digital_out_t ext
Definition: rtc20.h:185
uint8_t out2s
Definition: rtc20.h:258
uint8_t minute
Definition: rtc20.h:227
RTC 20 Click context object.
Definition: rtc20.h:182
pin_name_t ir2
Definition: rtc20.h:208
uint8_t day_of_week
Definition: rtc20.h:239
digital_out_t wdi
Definition: rtc20.h:184
uint8_t stop
Definition: rtc20.h:252
digital_in_t ir1
Definition: rtc20.h:189
void rtc20_cfg_setup(rtc20_cfg_t *cfg)
RTC 20 configuration object setup function.
@ RTC20_ERROR
Definition: rtc20.h:270
digital_in_t ir2
Definition: rtc20.h:188
err_t rtc20_get_status(rtc20_t *ctx, uint8_t *status)
RTC 20 get status function.
uint8_t slave_address
Definition: rtc20.h:195