Go to the documentation of this file.
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 RTC17_REG_SECOND_COUNTER 0x00
74 #define RTC17_REG_MINUTE_COUNTER 0x01
75 #define RTC17_REG_HOUR_COUNTER 0x02
76 #define RTC17_REG_DAY_OF_WEEK_COUNTER 0x03
77 #define RTC17_REG_DAY_COUNTER 0x04
78 #define RTC17_REG_MONTH_COUNTER 0x05
79 #define RTC17_REG_YEAR_COUNTER 0x06
80 #define RTC17_REG_OSC_ADJ 0x07
81 #define RTC17_REG_ALARM_W_MINUTE 0x08
82 #define RTC17_REG_ALARM_W_HOUR 0x09
83 #define RTC17_REG_ALARM_W_DAY_OF_WEEK 0x0A
84 #define RTC17_REG_ALARM_D_MINUTE 0x0B
85 #define RTC17_REG_ALARM_D_HOUR 0x0C
86 #define RTC17_REG_CONTROL1 0x0E
87 #define RTC17_REG_CONTROL2 0x0F
105 #define RTC17_CONTROL1_ALARM_W_DISABLE 0x00
106 #define RTC17_CONTROL1_ALARM_W_ENABLE 0x80
107 #define RTC17_CONTROL1_ALARM_D_DISABLE 0x00
108 #define RTC17_CONTROL1_ALARM_D_ENABLE 0x40
109 #define RTC17_CONTROL1_12HOUR_TIME 0x00
110 #define RTC17_CONTROL1_24HOUR_TIME 0x20
111 #define RTC17_CONTROL1_CLOCK1_ENABLE 0x00
112 #define RTC17_CONTROL1_CLOCK1_DISABLE 0x10
113 #define RTC17_CONTROL1_TEST_NORMAL 0x00
114 #define RTC17_CONTROL1_TEST_TEST 0x08
115 #define RTC17_CONTROL1_CT_OFF 0x00
116 #define RTC17_CONTROL1_CT_FIXED_L 0x01
117 #define RTC17_CONTROL1_CT_PULSE_2HZ 0x02
118 #define RTC17_CONTROL1_CT_PULSE_1HZ 0x03
119 #define RTC17_CONTROL1_CT_EVERY_SECOND 0x04
120 #define RTC17_CONTROL1_CT_EVERY_MINUTE 0x05
121 #define RTC17_CONTROL1_CT_EVERY_HOUR 0x06
122 #define RTC17_CONTROL1_CT_EVERY_MONTH 0x07
128 #define RTC17_CONTROL2_VDSL_2p1V 0x00
129 #define RTC17_CONTROL2_VDSL_1p6V 0x80
130 #define RTC17_CONTROL2_VDET_ABOVE 0x00
131 #define RTC17_CONTROL2_VDET_BELOW 0x40
132 #define RTC17_CONTROL2_SCRATCH_BIT 0x20
133 #define RTC17_CONTROL2_XSTP_NORMAL 0x00
134 #define RTC17_CONTROL2_XSTP_HALT 0x10
135 #define RTC17_CONTROL2_CLOCK2_ENABLE 0x00
136 #define RTC17_CONTROL2_CLOCK2_DISABLE 0x08
137 #define RTC17_CONTROL2_CLEAR_INTERRUPT 0x04
138 #define RTC17_CONTROL2_CLEAR_ALARM_W 0x02
139 #define RTC17_CONTROL2_CLEAR_ALARM_D 0x01
145 #define RTC17_MONDAY 0x00
146 #define RTC17_TUESDAY 0x01
147 #define RTC17_WEDNESDAY 0x02
148 #define RTC17_THURSDAY 0x03
149 #define RTC17_FRIDAY 0x04
150 #define RTC17_SATURDAY 0x05
151 #define RTC17_SUNDAY 0x06
158 #define RTC17_SET_DEVICE_ADDRESS 0x32
176 #define RTC17_MAP_MIKROBUS( cfg, mikrobus ) \
177 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
178 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
179 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
uint8_t day_of_week
Definition: rtc17.h:237
uint8_t day
Definition: rtc17.h:238
uint8_t second
Definition: rtc17.h:224
err_t rtc17_read_time(rtc17_t *ctx, rtc17_time_t *time)
RTC 17 read time function.
rtc17_return_value_t
RTC 17 Click return value data.
Definition: rtc17.h:249
pin_name_t int_pin
Definition: rtc17.h:210
@ RTC17_OK
Definition: rtc17.h:250
pin_name_t sda
Definition: rtc17.h:208
uint8_t i2c_address
Definition: rtc17.h:213
uint8_t month
Definition: rtc17.h:239
err_t rtc17_set_time(rtc17_t *ctx, rtc17_time_t *time)
RTC 17 set time function.
@ RTC17_ERROR
Definition: rtc17.h:251
pin_name_t scl
Definition: rtc17.h:207
err_t rtc17_set_date(rtc17_t *ctx, rtc17_date_t *date)
RTC 17 set date function.
uint32_t i2c_speed
Definition: rtc17.h:212
err_t rtc17_clear_interrupts(rtc17_t *ctx)
RTC 17 clear interrupts function.
i2c_master_t i2c
Definition: rtc17.h:194
err_t rtc17_read_register(rtc17_t *ctx, uint8_t reg, uint8_t *data_out)
RTC 17 read register function.
digital_in_t int_pin
Definition: rtc17.h:191
uint8_t rtc17_get_int_pin(rtc17_t *ctx)
RTC 17 get int pin function.
RTC 17 Click context object.
Definition: rtc17.h:189
RTC 17 Click time object.
Definition: rtc17.h:223
uint8_t year
Definition: rtc17.h:240
RTC 17 Click configuration object.
Definition: rtc17.h:206
uint8_t minute
Definition: rtc17.h:225
err_t rtc17_init(rtc17_t *ctx, rtc17_cfg_t *cfg)
RTC 17 initialization function.
err_t rtc17_default_cfg(rtc17_t *ctx)
RTC 17 default configuration function.
uint8_t hour
Definition: rtc17.h:226
RTC 17 Click date object.
Definition: rtc17.h:236
err_t rtc17_write_multiple_registers(rtc17_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
RTC 17 write multiple registers function.
void rtc17_cfg_setup(rtc17_cfg_t *cfg)
RTC 17 configuration object setup function.
err_t rtc17_read_date(rtc17_t *ctx, rtc17_date_t *date)
RTC 17 read date function.
err_t rtc17_write_register(rtc17_t *ctx, uint8_t reg, uint8_t data_in)
RTC 17 write register function.
uint8_t slave_address
Definition: rtc17.h:197
err_t rtc17_read_multiple_registers(rtc17_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
RTC 17 read multiple registers function.