42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
68#define RTC5_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
70 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
71 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.mfp = MIKROBUS( mikrobus, MIKROBUS_INT );
80#define RTC5_RETVAL uint8_t
83#define RTC5_INIT_ERROR 0xFF
90#define RTC5_REG_TIME_HUN_OF_SEC 0x00
91#define RTC5_REG_TIME_SEC 0x01
92#define RTC5_REG_TIME_MIN 0x02
93#define RTC5_REG_TIME_HOUR 0x03
94#define RTC5_REG_TIME_DAY_OF_THE_WEEK 0x04
95#define RTC5_REG_TIME_DATE_DAY 0x05
96#define RTC5_REG_TIME_DATE_MONTH 0x06
97#define RTC5_REG_TIME_DATE_YEAR 0x07
98#define RTC5_REG_CONFIG 0x08
99#define RTC5_REG_CALIBRATION 0x09
100#define RTC5_REG_ALARM_0_SEC 0x0C
101#define RTC5_REG_ALARM_0_MIN 0x0D
102#define RTC5_REG_ALARM_0_HOUR 0x0E
103#define RTC5_REG_ALARM_0_DATE_DATE 0x0F
104#define RTC5_REG_ALARM_0_DATE_DAY 0x10
105#define RTC5_REG_ALARM_0_MONTH 0x11
106#define RTC5_REG_ALARM_1_HUN_OF_SEC 0x12
107#define RTC5_REG_ALARM_1_SEC 0x13
108#define RTC5_REG_ALARM_1_MIN 0x14
109#define RTC5_REG_ALARM_1_HOUR 0x15
110#define RTC5_REG_ALARM_1_DATE_DATE 0x16
111#define RTC5_REG_ALARM_1_DATE_DAY 0x17
118#define RTC5_ALARM_0_VALUE 0x00
119#define RTC5_ALARM_1_VALUE 0x01
126#define RTC5_SPI_WRITE 0x12
127#define RTC5_SPI_READ 0x13
134#define RTC5_OSC_DISABLE 0x00
135#define RTC5_OSC_ENABLE 0x01
142#define RTC5_COUNTING_DISABLE 0x7F
143#define RTC5_COUNTING_ENABLE 0x80
150#define RTC5_CLR_CMD 0x54
157#define RTC5_DAY_OF_THE_WEEK_MONDAY 1
158#define RTC5_DAY_OF_THE_WEEK_TUESDAY 2
159#define RTC5_DAY_OF_THE_WEEK_WEDNESDAY 3
160#define RTC5_DAY_OF_THE_WEEK_THURSDAY 4
161#define RTC5_DAY_OF_THE_WEEK_FRIDAY 5
162#define RTC5_DAY_OF_THE_WEEK_SATURDAY 6
163#define RTC5_DAY_OF_THE_WEEK_SUNDAY 7
#define RTC5_RETVAL
Definition rtc5.h:80
void rtc5_set_time_sec(rtc5_t *ctx, uint8_t seconds)
Set seconds function.
void rtc5_set_day_of_the_week(rtc5_t *ctx, uint8_t w_day)
Set day of the week function.
void rtc5_set_counting(rtc5_t *ctx, uint8_t en_osc)
Enable counting function.
void rtc5_set_time_hours(rtc5_t *ctx, uint8_t hours)
Set hours function.
uint8_t rtc5_get_time_sec(rtc5_t *ctx)
Get seconds function.
void rtc5_generic_transfer(rtc5_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
uint8_t rtc5_get_date_day(rtc5_t *ctx)
Get day function.
void rtc5_get_time_and_date(rtc5_t *ctx, rtc5_timedate_t *timedate_data)
Get time and date function.
void rtc5_default_cfg(rtc5_t *ctx)
Click Default Configuration function.
void rtc5_set_time_min(rtc5_t *ctx, uint8_t minutes)
Set minutes function.
uint8_t rtc5_generic_read(rtc5_t *ctx, uint8_t reg)
Click Default Configuration function.
uint8_t rtc5_get_date_year(rtc5_t *ctx)
Get year function.
uint8_t rtc5_get_time_hun_of_sec(rtc5_t *ctx)
Get hundred of seconds function.
uint8_t rtc5_get_day_of_the_week(rtc5_t *ctx)
Get day of the week function.
uint8_t rtc5_get_leap_year(rtc5_t *ctx)
Get leap year function.
RTC5_RETVAL rtc5_init(rtc5_t *ctx, rtc5_cfg_t *cfg)
Initialization function.
void rtc5_set_date_day(rtc5_t *ctx, uint8_t date_day)
Set day function.
void rtc5_cfg_setup(rtc5_cfg_t *cfg)
Config Object Initialization function.
void rtc5_clear(rtc5_t *ctx)
Clear RTCC and SRAM memory function.
void rtc5_set_date(rtc5_t *ctx, uint8_t date_day, uint8_t date_month, uint16_t date_year)
Set date hours, minutes and seconds function.
uint8_t rtc5_get_time_min(rtc5_t *ctx)
Get minutes function.
void rtc5_set_date_year(rtc5_t *ctx, uint16_t date_year)
Set year function.
void rtc5_generic_write(rtc5_t *ctx, uint8_t reg, uint8_t tx_data)
Click Default Configuration function.
void rtc5_set_time_hun_of_sec(rtc5_t *ctx, uint8_t hun_sec)
Set hundred of seconds function.
uint8_t rtc5_get_time_hours(rtc5_t *ctx)
Get hours function.
void rtc5_set_time(rtc5_t *ctx, uint8_t time_hours, uint8_t time_min, uint8_t time_sec)
Set time hours, minutes and seconds function.
void rtc5_set_date_month(rtc5_t *ctx, uint8_t date_month)
Set month function.
uint8_t rtc5_get_date_month(rtc5_t *ctx)
Get month function.
Click configuration structure definition.
Definition rtc5.h:195
pin_name_t mfp
Definition rtc5.h:205
spi_master_chip_select_polarity_t cs_polarity
Definition rtc5.h:211
pin_name_t sck
Definition rtc5.h:200
spi_master_mode_t spi_mode
Definition rtc5.h:210
pin_name_t mosi
Definition rtc5.h:199
uint32_t spi_speed
Definition rtc5.h:209
pin_name_t miso
Definition rtc5.h:198
pin_name_t cs
Definition rtc5.h:201
Click ctx object definition.
Definition rtc5.h:177
digital_out_t cs
Definition rtc5.h:178
spi_master_t spi
Definition rtc5.h:186
digital_in_t mfp
Definition rtc5.h:182
pin_name_t chip_select
Definition rtc5.h:187
Time and date structure definition.
Definition rtc5.h:219
uint8_t hours
Definition rtc5.h:225
uint8_t month
Definition rtc5.h:230
uint8_t hun_of_sec
Definition rtc5.h:222
uint8_t day
Definition rtc5.h:229
uint8_t year
Definition rtc5.h:231
uint8_t w_day
Definition rtc5.h:232
uint8_t min
Definition rtc5.h:224
uint8_t sec
Definition rtc5.h:223