rtc 2.0.0.0
rtc.h File Reference

This file contains API for RTC Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  rtc_c_date_t
 Date data structure. More...
 
struct  rtc_c_time_t
 Time data structure. More...
 
struct  rtc_c_t
 Click ctx object definition. More...
 
struct  rtc_c_cfg_t
 Click configuration structure definition. More...
 

Macros

#define RTC_C_MAP_MIKROBUS(cfg, mikrobus)
 
#define RTC_C_OK   0
 
#define RTC_C_ERROR   -1
 
#define RTC_C_I2C_ADDRESS_0   0x50
 
#define RTC_C_I2C_ADDRESS_1   0x51
 
#define RTC_C_REG_CONTROL   0x00
 
#define RTC_C_REG_TIME_HUN_SEC   0x01
 
#define RTC_C_REG_TIME_SEC   0x02
 
#define RTC_C_REG_TIME_MIN   0x03
 
#define RTC_C_REG_TIME_HOUR   0x04
 
#define RTC_C_REG_TIME_DATE_DAY_AND_YEAR   0x05
 
#define RTC_C_REG_TIME_DAY_OF_THE_WEEK_AND_MONTH   0x06
 
#define RTC_C_REG_TIMER   0x07
 
#define RTC_C_REG_TIME_ALARM_CONTROL   0x08
 
#define RTC_C_REG_TIME_ALARM_HUN_SEC   0x09
 
#define RTC_C_REG_TIME_ALARM_SEC   0x0A
 
#define RTC_C_REG_TIME_ALARM_MIN   0x0B
 
#define RTC_C_REG_TIME_ALARM_HOUR   0x0C
 
#define RTC_C_REG_TIME_ALARM_DATE_DAY_AND_YEAR   0x0D
 
#define RTC_C_REG_TIME_ALARM_DAY_OF_THE_WEEK_AND_MONTH   0x0E
 
#define RTC_C_REG_TIME_ALARM_TIMER   0x0F
 

Functions

void rtc_c_cfg_setup (rtc_c_cfg_t *cfg)
 Config Object Initialization function.
 
err_t rtc_c_init (rtc_c_t *ctx, rtc_c_cfg_t *cfg)
 Initialization function.
 
err_t rtc_c_generic_write (rtc_c_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 RTC I2C writing function.
 
err_t rtc_c_generic_read (rtc_c_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 RTC I2C reading function.
 
void rtc_c_enable_disable_counting (rtc_c_t *ctx, uint8_t en_dis)
 Enable/Disable counting function.
 
void rtc_c_read_time (rtc_c_t *ctx)
 Set control register to read time function.
 
void rtc_c_read_date (rtc_c_t *ctx)
 Set control register to read date function.
 
uint8_t rtc_c_get_time_value (rtc_c_t *ctx, uint8_t time_part)
 Get time value function.
 
void rtc_c_set_time_value (rtc_c_t *ctx, uint8_t time_part, uint8_t time_addr)
 Set time values function.
 
uint8_t rtc_c_get_date_day (rtc_c_t *ctx)
 Get day function.
 
void rtc_c_set_date_day (rtc_c_t *ctx, uint8_t date_day)
 Set day function.
 
uint8_t rtc_c_get_date_year (rtc_c_t *ctx)
 Get year function.
 
void rtc_c_set_date_year (rtc_c_t *ctx, uint16_t date_year)
 Set year function.
 
uint8_t rtc_c_check_leap_year (rtc_c_t *ctx)
 Check if it's a leap year function.
 
uint8_t rtc_c_get_day_of_the_week (rtc_c_t *ctx)
 Get day of the week function.
 
void rtc_c_set_day_of_the_week (rtc_c_t *ctx, uint8_t w_day)
 Set day of the week function.
 
uint8_t rtc_c_get_date_month (rtc_c_t *ctx)
 Get month function.
 
void rtc_c_set_date_month (rtc_c_t *ctx, uint8_t date_month)
 Set month function.
 
void rtc_c_set_time (rtc_c_t *ctx)
 Set time hours, minutes, seconds and hundredth of a seconds function.
 
void rtc_c_get_time (rtc_c_t *ctx)
 Get time hours, minutes, seconds and hundredth of a seconds function.
 
void rtc_c_set_date (rtc_c_t *ctx)
 Set date hours, minutes and seconds function.
 
void rtc_c_get_date (rtc_c_t *ctx)
 Get time hours, minutes and seconds function.
 
void rtc_c_enable_disable_alarm (rtc_c_t *ctx, uint8_t en_dis)
 Enable/Disable alarm function.
 
void rtc_c_set_alarm_value (rtc_c_t *ctx, uint8_t al_time_val, uint8_t al_time_type)
 Set alarm time value.
 
uint8_t rtc_c_get_alarm_value (rtc_c_t *ctx, uint8_t alarm_addr)
 Get alarm time value function.
 
void rtc_c_set_time_alarm (rtc_c_t *ctx)
 Set alarm time - minutes function.
 
void rtc_c_get_time_alarm (rtc_c_t *ctx)
 Get the alarm time hours, minutes, seconds and hundredth of a seconds function.
 
void rtc_c_enable_disable_interrupt (rtc_c_t *ctx, uint8_t flag)
 Enable alarm interrupt function.
 
uint8_t rtc_c_get_interrupt (rtc_c_t *ctx)
 Get state of interrupt pin function.
 

Detailed Description

This file contains API for RTC Click driver.