rtc4 2.0.0.0
rtc4.h File Reference

This file contains API for RTC 4 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_one_wire.h"

Go to the source code of this file.

Data Structures

struct  rtc4_time_t
 RTC 4 Click time object. More...
 
struct  rtc4_date_t
 RTC 4 Click date object. More...
 
struct  rtc4_t
 RTC 4 Click context object. More...
 
struct  rtc4_cfg_t
 RTC 4 Click configuration object. More...
 

Macros

#define RTC4_CMD_READ_CLOCK   0x66
 RTC 4 commands list.
 
#define RTC4_CMD_WRITE_CLOCK   0x99
 
#define RTC4_SEC_PER_MINUTE   60
 Time values list.
 
#define RTC4_SEC_PER_HOUR   3600
 
#define RTC4_SEC_PER_DAY   86400
 
#define RTC4_START_YEAR   1970
 
#define RTC4_DAYS_PER_LEAP_YEAR   366
 
#define RTC4_DAYS_PER_YEAR   365
 
#define RTC4_DAYS_IN_FEB   29
 
#define RTC4_DCB_INT_ENABLE   0x80
 RTC 4 device control byte.
 
#define RTC4_DCB_OSC_ENABLE   0x0C
 
#define RTC4_DCB_INTERVAL_1S   0x00
 
#define RTC4_DCB_INTERVAL_4S   0x10
 
#define RTC4_DCB_INTERVAL_32S   0x20
 
#define RTC4_DCB_INTERVAL_64S   0x30
 
#define RTC4_DCB_INTERVAL_2048S   0x40
 
#define RTC4_DCB_INTERVAL_4096S   0x50
 
#define RTC4_DCB_INTERVAL_65536S   0x60
 
#define RTC4_DCB_INTERVAL_131072S   0x70
 
#define RTC4_FAMILY_CODE   0x27
 RTC 4 device control byte.
 
#define RTC4_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  rtc4_gpio_sel_t { RTC4_GPIO_0 , RTC4_GPIO_1 }
 RTC 4 Click gpio selector. More...
 
enum  rtc4_return_value_t { RTC4_OK = 0 , RTC4_ERROR = -1 }
 RTC 4 Click return value data. More...
 

Functions

void rtc4_cfg_setup (rtc4_cfg_t *cfg)
 RTC 4 configuration object setup function.
 
void rtc4_gpio_selection (rtc4_cfg_t *cfg, rtc4_gpio_sel_t gpio_sel)
 RTC 4 driver interface setup function.
 
err_t rtc4_init (rtc4_t *ctx, rtc4_cfg_t *cfg)
 RTC 4 initialization function.
 
err_t rtc4_check_communication (rtc4_t *ctx)
 RTC 4 check communication function.
 
uint8_t rtc4_get_interrupt (rtc4_t *ctx)
 RTC 4 get interrupt function.
 
err_t rtc4_set_unix_and_int (rtc4_t *ctx, uint32_t unix_time, uint8_t int_interval)
 RTC 4 set unix and interrupt interval function.
 
err_t rtc4_get_unix_time (rtc4_t *ctx, uint32_t *unix_time)
 RTC 4 get unix time function.
 
void rtc4_unix_to_date_time (uint32_t unix_time, rtc4_time_t *time, rtc4_date_t *date)
 RTC 4 unix to date time function.
 
void rtc4_date_time_to_unix (rtc4_date_t *date, rtc4_time_t *time, uint32_t *unix_time)
 RTC 4 date time to unix function.
 
err_t rtc4_set_date_time (rtc4_t *ctx, rtc4_date_t *date, rtc4_time_t *time, uint8_t int_interval)
 RTC 4 set date time function.
 
err_t rtc4_get_date_time (rtc4_t *ctx, rtc4_date_t *date, rtc4_time_t *time)
 RTC 4 get date time function.
 

Detailed Description

This file contains API for RTC 4 Click Driver.

Enumeration Type Documentation

◆ rtc4_gpio_sel_t

RTC 4 Click gpio selector.

Selects gpio pin of RTC 4 Click driver.

Enumerator
RTC4_GPIO_0 

GPIO 0 pin.

RTC4_GPIO_1 

GPIO 1 pin.

◆ rtc4_return_value_t

RTC 4 Click return value data.

Predefined enum values for driver return values.

Enumerator
RTC4_OK 
RTC4_ERROR