rtc8 2.0.0.0
rtc8.h File Reference

This file contains API for RTC 8 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  rtc8_t
 Click ctx object definition. More...
 
struct  rtc8_cfg_t
 Click configuration structure definition. More...
 
struct  rtc8_time_t
 Time structure definition. More...
 
struct  rtc8_date_t
 Date structure definition. More...
 
struct  rtc8_alarm_t
 Alarm structure definition. More...
 

Macros

#define RTC8_MAP_MIKROBUS(cfg, mikrobus)
 
#define RTC8_OK   0
 
#define RTC8_ERROR   -1
 
#define RTC8_REG_SECONDS   0x00
 
#define RTC8_REG_MINUTES   0x01
 
#define RTC8_REG_HOURS   0x02
 
#define RTC8_REG_WEEKDAY   0x03
 
#define RTC8_REG_DATE   0x04
 
#define RTC8_REG_MONTH   0x05
 
#define RTC8_REG_YEAR   0x06
 
#define RTC8_REG_MINUTES_ALARM   0x07
 
#define RTC8_REG_HOURS_ALARM   0x08
 
#define RTC8_REG_WEEKDAY_ALARM   0x09
 
#define RTC8_REG_TIMER_VALUE_0   0x0A
 
#define RTC8_REG_TIMER_VALUE_1   0x0B
 
#define RTC8_REG_TIMER_STATUS_0   0x0C
 
#define RTC8_REG_TIMER_STATUS_1   0x0D
 
#define RTC8_REG_STATUS   0x0E
 
#define RTC8_REG_CONTROL1   0x0F
 
#define RTC8_REG_CONTROL2   0x10
 
#define RTC8_REG_GP_BITS   0x11
 
#define RTC8_REG_CLOCK_INT_MASK   0x12
 
#define RTC8_REG_EVENT_CONTROL   0x13
 
#define RTC8_REG_COUNT_TS   0x14
 
#define RTC8_REG_SECONDS_TS   0x15
 
#define RTC8_REG_MINUTES_TS   0x16
 
#define RTC8_REG_HOURS_TS   0x17
 
#define RTC8_REG_DATE_TS   0x18
 
#define RTC8_REG_MONTH_TS   0x19
 
#define RTC8_REG_YEAR_TS   0x1A
 
#define RTC8_REG_UNIX0   0x1B
 
#define RTC8_REG_UNIX1   0x1C
 
#define RTC8_REG_UNIX2   0x1D
 
#define RTC8_REG_UNIX3   0x1E
 
#define RTC8_REG_USER_RAM_1   0x1F
 
#define RTC8_REG_USER_RAM_2   0x20
 
#define RTC8_REG_PASSWORD_0   0x21
 
#define RTC8_REG_PASSWORD_1   0x22
 
#define RTC8_REG_PASSWORD_2   0x23
 
#define RTC8_REG_PASSWORD_3   0x24
 
#define RTC8_REG_EEPROM_ADDRESS   0x25
 
#define RTC8_REG_EEPROM_DATA   0x26
 
#define RTC8_REG_EEPROM_COM   0x27
 
#define RTC8_REG_ID   0x28
 
#define RTC8_REG_EEPROM_BACKUP   0x37
 
#define RTC8_STATUS_EEPROM_BUSY   0x80
 
#define RTC8_STATUS_CLOCK_INT_FLAG   0x40
 
#define RTC8_STATUS_BACKUP_SWITCH_FLAG   0x20
 
#define RTC8_STATUS_UPDATE_FLAG   0x10
 
#define RTC8_STATUS_TIMER_FLAG   0x08
 
#define RTC8_STATUS_ALARM_FLAG   0x04
 
#define RTC8_STATUS_EVENT_FLAG   0x02
 
#define RTC8_STATUS_POR_FLAG   0x01
 
#define RTC8_STATUS_REG_CLEAR   0x00
 
#define RTC8_CTRL1_TRPT_SINGLE_MODE   0x00
 
#define RTC8_CTRL1_TRPT_REPEAT_MODE   0x80
 
#define RTC8_CTRL1_WADA_WEEKDAY_ALARM   0x00
 
#define RTC8_CTRL1_WADA_DATE_ALARM   0x20
 
#define RTC8_CTRL1_USEL_SECOND_UPDATE   0x00
 
#define RTC8_CTRL1_USEL_MINUTE_UPDATE   0x10
 
#define RTC8_CTRL1_EERD_REFRESH_ACTIVE   0x00
 
#define RTC8_CTRL1_EERD_REFRESH_NO_ACTIVE   0x08
 
#define RTC8_CTRL1_TE_TIMER_STOPS   0x00
 
#define RTC8_CTRL1_TE_TIMER_STARTS   0x04
 
#define RTC8_CTRL1_TD_TIMER_CLK_4096Hz   0x00
 
#define RTC8_CTRL1_TD_TIMER_CLK_64Hz   0x01
 
#define RTC8_CTRL1_TD_TIMER_CLK_1Hz   0x02
 
#define RTC8_CTRL1_TD_TIMER_CLK_1_60Hz   0x03
 
#define RTC8_CTRL2_TIME_STAMP_DISABLE   0x00
 
#define RTC8_CTRL2_TIME_STAMP_ENABLE   0x80
 
#define RTC8_CTRL2_INT_CLOCK_DISABLE   0x00
 
#define RTC8_CTRL2_INT_CLOCK_ENABLE   0x40
 
#define RTC8_CTRL2_TIME_UPDATE_INTERRUPT   0x20
 
#define RTC8_CTRL2_TIME_UPDATE_NO_INTERRUPT   0x00
 
#define RTC8_CTRL2_TIMER_INTERRUPT   0x10
 
#define RTC8_CTRL2_TIMER_NO_INTERRUPT   0x00
 
#define RTC8_CTRL2_ALARM_INTERRUPT   0x08
 
#define RTC8_CTRL2_ALARM_NO_INTERRUPT   0x00
 
#define RTC8_CTRL2_EVENT_INTERRUPT   0x04
 
#define RTC8_CTRL2_EVENT_NO_INTERRUPT   0x00
 
#define RTC8_CTRL2_HOUR_MODE_12   0x02
 
#define RTC8_CTRL2_HOUR_MODE_24   0x00
 
#define RTC8_CTRL2_RESET_ACTIVE   0x01
 
#define RTC8_CTRL2_NO_RESET   0x00
 
#define RTC8_CLKIM_EVENT_INT_ENABLE   0x08
 
#define RTC8_CLKIM_EVENT_INT_DISABLE   0x00
 
#define RTC8_CLKIM_ALARM_INT_ENABLE   0x04
 
#define RTC8_CLKIM_ALARM_INT_DISABLE   0x00
 
#define RTC8_CLKIM_TIMER_INT_ENABLE   0x02
 
#define RTC8_CLKIM_TIMER_INT_DISABLE   0x00
 
#define RTC8_CLKIM_TIME_UPDATE_INT_ENABLE   0x01
 
#define RTC8_CLKIM_TIME_UPDATE_INT_DISABLE   0x00
 
#define RTC8_EC_EVENT_LOW_LEVEL   0x00
 
#define RTC8_EC_EVENT_HIGH_LEVEL   0x40
 
#define RTC8_EC_EVENT_PERIOD_256Hz   0x10
 
#define RTC8_EC_EVENT_PERIOD_64Hz   0x20
 
#define RTC8_EC_EVENT_PERIOD_8Hz   0x30
 
#define RTC8_EC_EVENT_NO_FILTERING   0x00
 
#define RTC8_EC_TIME_STAMP_RESET_ENABLE   0x04
 
#define RTC8_EC_TIME_STAMP_RESET_DISABLE   0x00
 
#define RTC8_EC_TSOW_EVF_CLEARED   0x00
 
#define RTC8_EC_TSOW_EVF_NO_CLEARED   0x02
 
#define RTC8_EC_TSS_TSE_ON_EVI   0x00
 
#define RTC8_EC_TSS_TSE_ON_VBACKUP   0x01
 
#define RTC8_EECMD_WRITE_ALL_EEPROM_REG   0x11
 
#define RTC8_EECMD_READ_ALL_EEPROM_REG   0x12
 
#define RTC8_EECMD_WRITE_ONE_EEPROM_REG   0x21
 
#define RTC8_EECMD_READ_ONE_EEPROM_REG   0x22
 
#define RTC8_ALARM_IS_ACTIVE   0x01
 
#define RTC8_ALARM_NO_ACTIVE   0x00
 

Functions

void rtc8_cfg_setup (rtc8_cfg_t *cfg)
 Config Object Initialization function.
 
err_t rtc8_init (rtc8_t *ctx, rtc8_cfg_t *cfg)
 Initialization function.
 
err_t rtc8_default_cfg (rtc8_t *ctx)
 Click Default Configuration function.
 
err_t rtc8_generic_write (rtc8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
err_t rtc8_generic_read (rtc8_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
err_t rtc8_write_data (rtc8_t *ctx, uint8_t reg, uint8_t data_in)
 Write data ( Convert and send data in BCD format )
 
err_t rtc8_read_data (rtc8_t *ctx, uint8_t reg, uint8_t *data_out)
 Read one byte data from register in DEC format.
 
err_t rtc8_get_uinx_time (rtc8_t *ctx, uint32_t *unix_time)
 Get current UNIX time.
 
err_t rtc8_set_unix_time (rtc8_t *ctx, uint32_t unix_time)
 Set UNIX time.
 
err_t rtc8_set_time (rtc8_t *ctx, rtc8_time_t *time_s)
 Set new time - 24 hour format.
 
err_t rtc8_set_date (rtc8_t *ctx, rtc8_date_t *date_s)
 Set new date.
 
err_t rtc8_set_alarm (rtc8_t *ctx, rtc8_alarm_t *alarm_s)
 Set Alarm.
 
uint8_t rtc8_get_int_pin (rtc8_t *ctx)
 Get interrupt state.
 
void rtc8_set_evi_pin (rtc8_t *ctx, uint8_t state)
 Set EVI(External Event Input) pin.
 
err_t rtx8_get_time_and_date (rtc8_t *ctx, rtc8_time_t *time_s, rtc8_date_t *date_s)
 Get RTC data ( Time and Data )
 
err_t rtc8_reset_alarm_flag (rtc8_t *ctx)
 Reset alarm.
 
err_t rtc8_get_status (rtc8_t *ctx, uint8_t *status)
 Get status.
 
err_t rtc8_get_alarm_flag (rtc8_t *ctx, uint8_t *alarm_flag)
 Get Alarm flag.
 

Detailed Description

This file contains API for RTC 8 Click driver.