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_spi_master.h"
70 #define RTC12_REG_SECONDS 0x00
71 #define RTC12_REG_MINUTES 0x01
72 #define RTC12_REG_HOUR 0x02
73 #define RTC12_REG_DAY 0x03
74 #define RTC12_REG_DATE 0x04
75 #define RTC12_REG_MONTH 0x05
76 #define RTC12_REG_YEAR 0x06
77 #define RTC12_REG_ALARM_0_SECONDS 0x07
78 #define RTC12_REG_ALARM_0_MINUTES 0x08
79 #define RTC12_REG_ALARM_0_HOUR 0x09
80 #define RTC12_REG_ALARM_0_DAY 0x0A
81 #define RTC12_REG_ALARM_1_SECONDS 0x0B
82 #define RTC12_REG_ALARM_1_MINUTES 0x0C
83 #define RTC12_REG_ALARM_1_HOUR 0x0D
84 #define RTC12_REG_ALARM_1_DAY 0x0E
85 #define RTC12_REG_CONTROL 0x0F
86 #define RTC12_REG_STATUS 0x10
87 #define RTC12_REG_TRICKLE_CHARGER 0x11
105 #define RTC12_SET_EOSC_ENABLE 0x00
106 #define RTC12_SET_EOSC_DISABLE 0x01
107 #define RTC12_SET_DOSF_ENABLE 0x00
108 #define RTC12_SET_DOSF_DISABL 0x01
109 #define RTC12_SET_EGFIL_DISABLE 0x00
110 #define RTC12_SET_EGFIL_ENABLE 0x01
111 #define RTC12_SET_SQW_DISABLE 0x00
112 #define RTC12_SET_SQW_ENABLE 0x01
113 #define RTC12_SET_INTCN_A0IE 0x00
114 #define RTC12_SET_INTCN_A0IE_A1IE 0x01
115 #define RTC12_SET_ALARM_1_DISABLE 0x00
116 #define RTC12_SET_ALARM_1_ENABLE 0x01
117 #define RTC12_SET_ALARM_0_DISABLE 0x00
118 #define RTC12_SET_ALARM_0_ENABLE 0x01
137 #define RTC12_MAP_MIKROBUS( cfg, mikrobus ) \
138 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
139 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
140 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
141 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
142 cfg.pf = MIKROBUS( mikrobus, MIKROBUS_AN ); \
143 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
uint8_t intcn
Definition: rtc12.h:243
spi_master_t spi
Definition: rtc12.h:161
pin_name_t chip_select
Definition: rtc12.h:163
@ RTC12_ERROR
Definition: rtc12.h:257
err_t rtc12_set_date(rtc12_t *ctx, rtc12_date_t rtc_date)
RTC 12 get time function.
RTC 12 Click control object.
Definition: rtc12.h:238
err_t rtc12_generic_read(rtc12_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
RTC 12 data reading function.
err_t rtc12_get_ctrl_reg(rtc12_t *ctx, rtc12_control_t *rtc_ctrl)
RTC 12 get control register function.
err_t rtc12_set_alarm_0(rtc12_t *ctx, rtc12_alarm_t rtc_alarm)
RTC 12 get alarm 0 function.
pin_name_t pf
Definition: rtc12.h:182
uint8_t day
Definition: rtc12.h:213
rtc12_return_value_t
RTC 12 Click return value data.
Definition: rtc12.h:255
pin_name_t mosi
Definition: rtc12.h:176
@ RTC12_OK
Definition: rtc12.h:256
pin_name_t cs
Definition: rtc12.h:178
err_t rtc12_default_cfg(rtc12_t *ctx)
RTC 12 default configuration function.
pin_name_t miso
Definition: rtc12.h:175
err_t rtc12_set_ctrl_reg(rtc12_t *ctx, rtc12_control_t rtc_ctrl)
RTC 12 set control register function.
uint8_t month
Definition: rtc12.h:212
pin_name_t int_pin
Definition: rtc12.h:183
err_t rtc12_generic_write(rtc12_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
RTC 12 data writing function.
err_t rtc12_init(rtc12_t *ctx, rtc12_cfg_t *cfg)
RTC 12 initialization function.
uint8_t min
Definition: rtc12.h:200
uint8_t hours
Definition: rtc12.h:199
pin_name_t sck
Definition: rtc12.h:177
uint8_t a1ie
Definition: rtc12.h:244
uint8_t year
Definition: rtc12.h:211
RTC 12 Click context object.
Definition: rtc12.h:153
uint8_t eosc
Definition: rtc12.h:239
uint8_t min
Definition: rtc12.h:227
err_t rtc12_set_time(rtc12_t *ctx, rtc12_time_t rtc_time)
RTC 12 set time function.
spi_master_chip_select_polarity_t cs_polarity
Definition: rtc12.h:189
digital_in_t pf
Definition: rtc12.h:156
uint32_t spi_speed
Definition: rtc12.h:187
spi_master_mode_t spi_mode
Definition: rtc12.h:188
err_t rtc12_get_time(rtc12_t *ctx, rtc12_time_t *rtc_time)
RTC 12 get time function.
void rtc12_cfg_setup(rtc12_cfg_t *cfg)
RTC 12 configuration object setup function.
RTC 12 Click configuration object.
Definition: rtc12.h:172
uint8_t hours
Definition: rtc12.h:226
uint8_t dosf
Definition: rtc12.h:240
err_t rtc12_get_date(rtc12_t *ctx, rtc12_date_t *rtc_date)
RTC 12 get date function.
err_t rtc12_set_alarm_1(rtc12_t *ctx, rtc12_alarm_t rtc_alarm)
RTC 12 get alarm 1 function.
RTC 12 Click alarm object.
Definition: rtc12.h:224
uint8_t sqw
Definition: rtc12.h:242
uint8_t day
Definition: rtc12.h:225
digital_in_t int_pin
Definition: rtc12.h:157
uint8_t alarm_rate
Definition: rtc12.h:229
uint8_t a0ie
Definition: rtc12.h:245
RTC 12 Click time object.
Definition: rtc12.h:198
uint8_t sec
Definition: rtc12.h:228
uint8_t day_of_week
Definition: rtc12.h:214
uint8_t rtc12_check_power_fail(rtc12_t *ctx)
RTC 12 check power fail state function.
uint8_t sec
Definition: rtc12.h:201
RTC 12 Click date object.
Definition: rtc12.h:210
err_t rtc12_get_alarm_0(rtc12_t *ctx, rtc12_alarm_t *rtc_alarm)
RTC 12 get alarm 0 function.
err_t rtc12_get_alarm_1(rtc12_t *ctx, rtc12_alarm_t *rtc_alarm)
RTC 12 get alarm 1 function.
uint8_t rtc12_check_int(rtc12_t *ctx)
RTC 12 check interrupt state function.
uint8_t egfil
Definition: rtc12.h:241