Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_spi_master.h"
59 #define RTC11_RD_BIT_MASK 0x7F
60 #define RTC11_WR_BIT_MASK 0x80
62 #define RTC11_REG_HDT 0x00
63 #define RTC11_REG_SEC 0x01
64 #define RTC11_REG_MIN 0x02
65 #define RTC11_REG_HRS 0x03
66 #define RTC11_REG_DAT 0x04
67 #define RTC11_REG_MON 0x05
68 #define RTC11_REG_YRS 0x06
69 #define RTC11_REG_WKD 0x07
70 #define RTC11_REG_ALA_HDT 0x08
71 #define RTC11_REG_ALA_SEC 0x09
72 #define RTC11_REG_ALA_MIN 0x0A
73 #define RTC11_REG_ALA_HRS 0x0B
74 #define RTC11_REG_ALA_DAT 0x0C
75 #define RTC11_REG_ALA_MON 0x0D
76 #define RTC11_REG_ALA_WKD 0x0E
77 #define RTC11_REG_STAT 0x0F
78 #define RTC11_REG_CTL1 0x10
79 #define RTC11_REG_CTL2 0x11
80 #define RTC11_REG_INT_MSK 0x12
81 #define RTC11_REG_SQW 0x13
82 #define RTC11_REG_CAL_XT 0x14
83 #define RTC11_REG_CAL_RC_HI 0x15
84 #define RTC11_REG_CAL_RC_LOW 0x16
85 #define RTC11_REG_INT_POL 0x17
86 #define RTC11_REG_TMR_CTL 0x18
87 #define RTC11_REG_TMR 0x19
88 #define RTC11_REG_TMR_INIT 0x1A
89 #define RTC11_REG_WDT 0x1B
90 #define RTC11_REG_OSC_CTL 0x1C
91 #define RTC11_REG_OSC_STAT 0x1D
92 #define RTC11_REG_CFG_KEY 0x1F
93 #define RTC11_REG_TRCK 0x20
94 #define RTC11_REG_BREF_CTL 0x21
95 #define RTC11_REG_BAT_MODE 0x27
96 #define RTC11_REG_ID_0 0x28
97 #define RTC11_REG_ID_1 0x29
98 #define RTC11_REG_ID_2 0x2A
99 #define RTC11_REG_ID_3 0x2B
100 #define RTC11_REG_ID_4 0x2C
101 #define RTC11_REG_ID_5 0x2D
102 #define RTC11_REG_ID_6 0x2E
103 #define RTC11_REG_ASTAT 0x2F
104 #define RTC11_REG_OCTRL 0x30
105 #define RTC11_REG_EXT_ADR 0x3F
106 #define RTC11_REG_RAM 0x40
124 #define RTC11_CTL1_STOP 0x80
125 #define RTC11_CTL1_12_HRS 0x40
126 #define RTC11_CTL1_OUTB 0x20
127 #define RTC11_CTL1_OUT 0x10
128 #define RTC11_CTL1_ARST 0x04
129 #define RTC11_CTL1_WRTC 0x01
131 #define RTC11_ACS_OSC_CTL 0xA1
132 #define RTC11_SW_RST 0x3C
133 #define RTC11_ACS_AN_CTL_REG 0x9D
135 #define RTC11_CEB 0x80
136 #define RTC11_BLIE 0x10
137 #define RTC11_TIE 0x08
138 #define RTC11_AIE 0x04
139 #define RTC11_EX2E 0x02
140 #define RTC11_EX1E 0x01
142 #define RTC11_PROP_DIS 0x00
143 #define RTC11_PROP_EN 0x01
161 #define RTC11_MAP_MIKROBUS( cfg, mikrobus ) \
162 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
163 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
164 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
165 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
166 cfg.wdi = MIKROBUS( mikrobus, MIKROBUS_AN ); \
167 cfg.exi = MIKROBUS( mikrobus, MIKROBUS_RST ); \
168 cfg.it2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
169 cfg.it1 = MIKROBUS( mikrobus, MIKROBUS_INT )
void rtc11_xt1_int_en(rtc11_t *ctx, uint8_t state)
XT1 Interrupt Enable function.
uint8_t rtc11_check_irq_1(rtc11_t *ctx)
Check Interrupt 1 pin function.
void rtc11_set_ala_time_seconds(rtc11_t *ctx, uint8_t seconds)
Set alarm time seconds function.
void rtc11_wdi(rtc11_t *ctx, uint8_t state)
Watchdog reset function.
void rtc11_set_date_year(rtc11_t *ctx, uint16_t date_yrs)
Set year function.
uint8_t min
Definition: rtc11.h:227
void rtc11_bat_low_int_en(rtc11_t *ctx, uint8_t state)
Battery Low Interrupt Enable function.
void rtc11_bat_mode_en(rtc11_t *ctx, uint8_t state)
Batmode enable function.
spi_master_chip_select_polarity_t cs_polarity
Definition: rtc11.h:216
void rtc11_set_time_hundredths(rtc11_t *ctx, uint8_t hundredths)
Set hundredths function.
void rtc11_get_time(rtc11_t *ctx, rtc11_time_t *rtc_time)
Get time hours, minutes and seconds function.
err_t rtc11_set_time(rtc11_t *ctx, rtc11_time_t rtc_time)
Set time hours, minutes and seconds function.
uint8_t rtc11_get_date_month(rtc11_t *ctx)
Get month function.
uint8_t rtc11_get_time_seconds(rtc11_t *ctx)
Get seconds function.
pin_name_t cs
Definition: rtc11.h:205
uint8_t rtc11_get_time_hundredths(rtc11_t *ctx)
Get hundredths function.
uint8_t hours
Definition: rtc11.h:226
void rtc11_set_time_hours(rtc11_t *ctx, uint8_t hours)
Set hours function.
void rtc11_generic_read(rtc11_t *ctx, uint8_t reg, uint8_t *rd_data, uint16_t n_len)
RTC 11 data reading function.
pin_name_t exi
Definition: rtc11.h:209
void rtc11_set_ala_time_hours(rtc11_t *ctx, uint8_t hours)
Set alarm time hours function.
RTC 11 Click context object.
Definition: rtc11.h:179
pin_name_t chip_select
Definition: rtc11.h:191
uint8_t rtc11_get_ala_time_hours(rtc11_t *ctx)
Get alarm time hours function.
void rtc11_alarm_int_en(rtc11_t *ctx, uint8_t state)
Alarm Interrupt Enable function.
uint8_t sec
Definition: rtc11.h:228
uint8_t rtc11_get_ala_date_month(rtc11_t *ctx)
Get alarm time month function.
uint8_t rtc11_get_date_year(rtc11_t *ctx)
Get year function.
uint8_t rtc11_get_time_minutes(rtc11_t *ctx)
Get minutes function.
digital_out_t wdi
Definition: rtc11.h:181
uint8_t rtc11_get_ala_date_day(rtc11_t *ctx)
Get alarm time days function.
uint8_t day_of_week
Definition: rtc11.h:240
void rtc11_set_time_minutes(rtc11_t *ctx, uint8_t minutes)
Set minutes function.
uint8_t rtc11_get_date_day(rtc11_t *ctx)
Get day function.
uint8_t rtc11_get_time_hours(rtc11_t *ctx)
Get hours function.
void rtc11_set_ala_date_day(rtc11_t *ctx, uint8_t date_day)
Set alarm time day function.
uint8_t rtc11_get_ala_time_minutes(rtc11_t *ctx)
Get alarm time minutes function.
uint8_t rtc11_get_day_of_the_week(rtc11_t *ctx)
Get day of the week function.
void rtc11_set_day_of_the_week(rtc11_t *ctx, uint8_t w_day)
Set day of the week function.
pin_name_t miso
Definition: rtc11.h:202
err_t rtc11_set_date(rtc11_t *ctx, rtc11_date_t rtc_date)
Set date day of the week, day, month and year function.
digital_in_t it2
Definition: rtc11.h:185
rtc11_return_value_t
RTC 11 Click return value data.
Definition: rtc11.h:248
spi_master_t spi
Definition: rtc11.h:189
spi_master_mode_t spi_mode
Definition: rtc11.h:215
RTC 11 Click time object.
Definition: rtc11.h:225
RTC 11 Click configuration object.
Definition: rtc11.h:200
uint8_t rtc11_check_irq_2(rtc11_t *ctx)
Check Interrupt 2 pin function.
uint8_t rtc11_get_ala_day_of_the_week(rtc11_t *ctx)
Get alarm time day of the week function.
void rtc11_timer_int_en(rtc11_t *ctx, uint8_t state)
Timer Interrupt Enable function.
void rtc11_auto_rst(rtc11_t *ctx, uint8_t state)
Auto reset enable function.
void rtc11_cen_en(rtc11_t *ctx, uint8_t state)
Century Enable function.
digital_in_t it1
Definition: rtc11.h:186
err_t rtc11_init(rtc11_t *ctx, rtc11_cfg_t *cfg)
RTC 11 initialization function.
RTC 11 Click date object.
Definition: rtc11.h:236
digital_out_t exi
Definition: rtc11.h:182
void rtc11_soft_rst(rtc11_t *ctx)
Software Reset function.
pin_name_t mosi
Definition: rtc11.h:203
uint8_t month
Definition: rtc11.h:238
void rtc11_get_date(rtc11_t *ctx, rtc11_date_t *rtc_date)
Get date day of the week, day, month and year function.
void rtc11_generic_write(rtc11_t *ctx, uint8_t reg, uint8_t *wr_data, uint16_t n_len)
RTC 11 data writing function.
pin_name_t it2
Definition: rtc11.h:210
void rtc11_cfg_setup(rtc11_cfg_t *cfg)
RTC 11 configuration object setup function.
uint8_t rtc11_get_ala_time_hundredths(rtc11_t *ctx)
Get alarm time hundredths function.
void rtc11_xt2_int_en(rtc11_t *ctx, uint8_t state)
XT2 Interrupt Enable function.
void rtc11_set_ala_time_hundredths(rtc11_t *ctx, uint8_t hundredths)
Set alarm time hundredths function.
@ RTC11_ERROR
Definition: rtc11.h:250
void rtc11_set_time_seconds(rtc11_t *ctx, uint8_t seconds)
Set seconds function.
void rtc11_stp_sys_slk(rtc11_t *ctx, uint8_t state)
Stop the clocking system function.
pin_name_t wdi
Definition: rtc11.h:208
@ RTC11_OK
Definition: rtc11.h:249
uint8_t rtc11_get_century_flag(rtc11_t *ctx)
Get century flag function.
uint8_t year
Definition: rtc11.h:237
pin_name_t sck
Definition: rtc11.h:204
uint8_t rtc11_get_ala_time_seconds(rtc11_t *ctx)
Get alarm time seconds function.
void rtc11_set_ala_time_minutes(rtc11_t *ctx, uint8_t minutes)
Set alarm time minutes function.
void rtc11_write_rtc(rtc11_t *ctx, uint8_t state)
Write RTC enable function.
void rtc11_set_ala_day_of_the_week(rtc11_t *ctx, uint8_t w_day)
Set alarm time day of the week function.
pin_name_t it1
Definition: rtc11.h:211
void rtc11_set_date_month(rtc11_t *ctx, uint8_t date_mth)
Set month function.
uint8_t day
Definition: rtc11.h:239
void rtc11_ext_int(rtc11_t *ctx, uint8_t state)
External interrupt function.
void rtc11_set_ala_date_month(rtc11_t *ctx, uint8_t date_mth)
Set alarm time month function.
uint32_t spi_speed
Definition: rtc11.h:214
void rtc11_set_date_day(rtc11_t *ctx, uint8_t date_day)
Set day function.