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_spi_master.h"
74#define RTC13_REG_CTRL1_ADDR 0x00
75#define RTC13_REG_CTRL2_ADDR 0x01
76#define RTC13_REG_TIME_SECONDS 0x02
77#define RTC13_REG_TIME_MINUTES 0x03
78#define RTC13_REG_TIME_HOUR 0x04
79#define RTC13_REG_DATE_DAY 0x05
80#define RTC13_REG_DATE_WEEKDAYS 0x06
81#define RTC13_REG_DATE_MONTHS 0x07
82#define RTC13_REG_DATE_YEARS 0x08
83#define RTC13_REG_ALARM_MINUTE 0x09
84#define RTC13_REG_ALARM_HOUR 0x0A
85#define RTC13_REG_ALARM_DAY 0x0B
86#define RTC13_REG_ALARM_WEEKDAY 0x0C
87#define RTC13_REG_OFFSET_ADDR 0x0D
88#define RTC13_REG_TIMER_CLKOUT_ADDR 0x0E
89#define RTC13_REG_COUNTDOWN_TIMER_ADDR 0x0F
107#define RTC13_SOFT_RESET 0x58
108#define RTC13_BLOCK_CLKOUT_DISABLE 0x00
109#define RTC13_BLOCK_CLKOUT_ENABLE 0x01
119#define RTC13_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
120#define RTC13_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
138#define RTC13_MAP_MIKROBUS( cfg, mikrobus ) \
139 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
140 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
141 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
142 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
143 cfg.cle = MIKROBUS( mikrobus, MIKROBUS_RST ); \
144 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
uint8_t rtc13_get_interrupt(rtc13_t *ctx)
RTC 13 get interrupt function.
err_t rtc13_init(rtc13_t *ctx, rtc13_cfg_t *cfg)
RTC 13 initialization function.
err_t rtc13_default_cfg(rtc13_t *ctx)
RTC 13 default configuration function.
err_t rtc13_block_clkout(rtc13_t *ctx, uint8_t en_clkout)
RTC 13 block CLKOUT function.
void rtc13_cfg_setup(rtc13_cfg_t *cfg)
RTC 13 configuration object setup function.
err_t rtc13_soft_reset(rtc13_t *ctx)
RTC 13 soft reset function.
err_t rtc13_get_time(rtc13_t *ctx, rtc13_time_t *rtc_time)
RTC 13 get time function.
err_t rtc13_generic_read(rtc13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
RTC 13 data reading function.
err_t rtc13_set_date(rtc13_t *ctx, rtc13_date_t rtc_date)
RTC 13 set date function.
err_t rtc13_set_time(rtc13_t *ctx, rtc13_time_t rtc_time)
RTC 13 set time function.
err_t rtc13_get_date(rtc13_t *ctx, rtc13_date_t *rtc_date)
RTC 13 get date function.
err_t rtc13_get_alarm(rtc13_t *ctx, rtc13_alarm_t *rtc_alarm)
RTC 13 get alarm function.
err_t rtc13_set_alarm(rtc13_t *ctx, rtc13_alarm_t rtc_alarm)
RTC 13 set alarm function.
err_t rtc13_generic_write(rtc13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
RTC 13 data writing function.
rtc13_return_value_t
RTC 13 Click return value data.
Definition rtc13.h:234
@ RTC13_ERROR
Definition rtc13.h:236
@ RTC13_OK
Definition rtc13.h:235
This file contains SPI specific macros, functions, etc.
RTC 13 Click alarm object.
Definition rtc13.h:179
uint8_t hours
Definition rtc13.h:181
uint8_t weekday
Definition rtc13.h:183
uint8_t day
Definition rtc13.h:182
uint8_t min
Definition rtc13.h:180
RTC 13 Click configuration object.
Definition rtc13.h:211
pin_name_t cle
Definition rtc13.h:219
spi_master_chip_select_polarity_t cs_polarity
Definition rtc13.h:225
pin_name_t sck
Definition rtc13.h:215
spi_master_mode_t spi_mode
Definition rtc13.h:224
pin_name_t mosi
Definition rtc13.h:214
uint32_t spi_speed
Definition rtc13.h:223
pin_name_t int_pin
Definition rtc13.h:220
pin_name_t miso
Definition rtc13.h:213
pin_name_t cs
Definition rtc13.h:216
RTC 13 Click date object.
Definition rtc13.h:166
uint8_t month
Definition rtc13.h:168
uint8_t weekday
Definition rtc13.h:170
uint8_t day
Definition rtc13.h:169
uint8_t year
Definition rtc13.h:167
RTC 13 Click context object.
Definition rtc13.h:192
digital_out_t cle
Definition rtc13.h:194
spi_master_t spi
Definition rtc13.h:200
digital_in_t int_pin
Definition rtc13.h:197
pin_name_t chip_select
Definition rtc13.h:202
RTC 13 Click time object.
Definition rtc13.h:154
uint8_t hours
Definition rtc13.h:155
uint8_t min
Definition rtc13.h:156
uint8_t sec
Definition rtc13.h:157