rtc18 2.0.0.0
rtc18.h File Reference

This file contains API for RTC 18 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  rtc18_t
 RTC 18 Click context object. More...
 
struct  rtc18_cfg_t
 RTC 18 Click configuration object. More...
 
struct  rtc18_time_t
 RTC 18 Click time object. More...
 
struct  rtc18_date_t
 RTC 18 Click date object. More...
 

Macros

#define RTC18_REG_100TH_SECONDS   0x00
 RTC 18 register map.
 
#define RTC18_REG_SECONDS   0x01
 
#define RTC18_REG_MINUTES   0x02
 
#define RTC18_REG_HOURS   0x03
 
#define RTC18_REG_WEEKDAY   0x04
 
#define RTC18_REG_DATE   0x05
 
#define RTC18_REG_MONTH   0x06
 
#define RTC18_REG_YEAR   0x07
 
#define RTC18_REG_MINUTES_ALARM   0x08
 
#define RTC18_REG_HOURS_ALARM   0x09
 
#define RTC18_REG_DATE_ALARM   0x0A
 
#define RTC18_REG_TIMER_VALUE_0   0x0B
 
#define RTC18_REG_TIMER_VALUE_1   0x0C
 
#define RTC18_REG_STATUS   0x0D
 
#define RTC18_REG_TEMPERATURE_LSB   0x0E
 
#define RTC18_REG_TEMPERATURE_MSB   0x0F
 
#define RTC18_REG_CONTROL_1   0x10
 
#define RTC18_REG_CONTROL_2   0x11
 
#define RTC18_REG_CONTROL_3   0x12
 
#define RTC18_REG_TIME_STAMP_CONTROL   0x13
 
#define RTC18_REG_CLOCK_INT_MASK   0x14
 
#define RTC18_REG_EVI_CONTROL   0x15
 
#define RTC18_REG_TLOW_THRESHOLD   0x16
 
#define RTC18_REG_THIGH_THRESHOLD   0x17
 
#define RTC18_REG_TS_TLOW_COUNT   0x18
 
#define RTC18_REG_TS_TLOW_SECONDS   0x19
 
#define RTC18_REG_TS_TLOW_MINUTES   0x1A
 
#define RTC18_REG_TS_TLOW_HOURS   0x1B
 
#define RTC18_REG_TS_TLOW_DATE   0x1C
 
#define RTC18_REG_TS_TLOW_MONTH   0x1D
 
#define RTC18_REG_TS_TLOW_YEAR   0x1E
 
#define RTC18_REG_TS_THIGH_COUNT   0x1F
 
#define RTC18_REG_TS_THIGH_SECONDS   0x20
 
#define RTC18_REG_TS_THIGH_MINUTES   0x21
 
#define RTC18_REG_TS_THIGH_HOURS   0x22
 
#define RTC18_REG_TS_THIGH_DATE   0x23
 
#define RTC18_REG_TS_THIGH_MONTH   0x24
 
#define RTC18_REG_TS_THIGH_YEAR   0x25
 
#define RTC18_REG_TS_EVI_COUNT   0x26
 
#define RTC18_REG_TS_EVI_100TH_SECONDS   0x27
 
#define RTC18_REG_TS_EVI_SECONDS   0x28
 
#define RTC18_REG_TS_EVI_MINUTES   0x29
 
#define RTC18_REG_TS_EVI_HOURS   0x2A
 
#define RTC18_REG_TS_EVI_DATE   0x2B
 
#define RTC18_REG_TS_EVI_MONTH   0x2C
 
#define RTC18_REG_TS_EVI_YEAR   0x2D
 
#define RTC18_REG_PASSWORD_0   0x39
 
#define RTC18_REG_PASSWORD_1   0x3A
 
#define RTC18_REG_PASSWORD_2   0x3B
 
#define RTC18_REG_PASSWORD_3   0x3C
 
#define RTC18_REG_EEPROM_ADDRESS   0x3D
 
#define RTC18_REG_EEPROM_DATA   0x3E
 
#define RTC18_REG_EEPROM_COMMAND   0x3F
 
#define RTC18_REG_USER_RAM_16B   0x40
 
#define RTC18_EEPROM_PMU   0xC0
 RTC 18 EEPROM config register map.
 
#define RTC18_EEPROM_OFFSET   0xC1
 
#define RTC18_EEPROM_CLKOUT_1   0xC2
 
#define RTC18_EEPROM_CLKOUT_2   0xC3
 
#define RTC18_EEPROM_TREF_0   0xC4
 
#define RTC18_EEPROM_TREF_1   0xC5
 
#define RTC18_EEPROM_PASSWORD_0   0xC6
 
#define RTC18_EEPROM_PASSWORD_1   0xC7
 
#define RTC18_EEPROM_PASSWORD_2   0xC8
 
#define RTC18_EEPROM_PASSWORD_3   0xC9
 
#define RTC18_EEPROM_PW_ENABLE   0xCA
 
#define RTC18_EEPROM_USER_MEMORY_32B   0xCB
 
#define RTC18_STATUS_THF   0x80
 RTC 18 status register settings.
 
#define RTC18_STATUS_TLF   0x40
 
#define RTC18_STATUS_UF   0x20
 
#define RTC18_STATUS_TF   0x10
 
#define RTC18_STATUS_AF   0x08
 
#define RTC18_STATUS_EVF   0x04
 
#define RTC18_STATUS_PORF   0x02
 
#define RTC18_STATUS_VLF   0x01
 
#define RTC18_CONTROL1_RESERVED   0x20
 RTC 18 control 1 register settings.
 
#define RTC18_CONTROL1_USEL   0x10
 
#define RTC18_CONTROL1_TE   0x08
 
#define RTC18_CONTROL1_EERD   0x04
 
#define RTC18_CONTROL1_TD_4096HZ   0x00
 
#define RTC18_CONTROL1_TD_64HZ   0x01
 
#define RTC18_CONTROL1_TD_1HZ   0x02
 
#define RTC18_CONTROL1_TD_1_60HZ   0x03
 
#define RTC18_CONTROL1_TD_BIT_MASK   0x03
 
#define RTC18_CONTROL2_CLKIE   0x40
 RTC 18 control 2 register settings.
 
#define RTC18_CONTROL2_UIE   0x20
 
#define RTC18_CONTROL2_TIE   0x10
 
#define RTC18_CONTROL2_AIE   0x08
 
#define RTC18_CONTROL2_EIE   0x04
 
#define RTC18_CONTROL2_STOP   0x01
 
#define RTC18_CONTROL3_BSIE   0x10
 RTC 18 control 3 register settings.
 
#define RTC18_CONTROL3_THE   0x08
 
#define RTC18_CONTROL3_TLE   0x04
 
#define RTC18_CONTROL3_THIE   0x02
 
#define RTC18_CONTROL3_TLIE   0x01
 
#define RTC18_MONDAY   0x00
 RTC 18 day of week values.
 
#define RTC18_TUESDAY   0x01
 
#define RTC18_WEDNESDAY   0x02
 
#define RTC18_THURSDAY   0x03
 
#define RTC18_FRIDAY   0x04
 
#define RTC18_SATURDAY   0x05
 
#define RTC18_SUNDAY   0x06
 
#define RTC18_TEMPERATURE_RESOLUTION   0.0625
 RTC 18 temperature settings.
 
#define RTC18_TEMPERATURE_LSB_TEMP_BIT_MASK   0xF0
 
#define RTC18_TEMPERATURE_LSB_EEF   0x08
 
#define RTC18_TEMPERATURE_LSB_EEBUSY   0x04
 
#define RTC18_TEMPERATURE_LSB_CLKF   0x02
 
#define RTC18_TEMPERATURE_LSB_BSF   0x01
 
#define RTC18_EECMD_UPDATE   0x11
 RTC 18 EEPROM commands list.
 
#define RTC18_EECMD_REFRESH   0x12
 
#define RTC18_EECMD_WRITE_ONE_BYTE   0x21
 
#define RTC18_EECMD_READ_ONE_BYTE   0x22
 
#define RTC18_DEVICE_ADDRESS   0x51
 RTC 18 device address setting.
 
#define RTC18_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  rtc18_return_value_t { RTC18_OK = 0 , RTC18_ERROR = -1 }
 RTC 18 Click return value data. More...
 

Functions

void rtc18_cfg_setup (rtc18_cfg_t *cfg)
 RTC 18 configuration object setup function.
 
err_t rtc18_init (rtc18_t *ctx, rtc18_cfg_t *cfg)
 RTC 18 initialization function.
 
err_t rtc18_default_cfg (rtc18_t *ctx)
 RTC 18 default configuration function.
 
err_t rtc18_generic_write (rtc18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 RTC 18 I2C writing function.
 
err_t rtc18_generic_read (rtc18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 RTC 18 I2C reading function.
 
err_t rtc18_write_register (rtc18_t *ctx, uint8_t reg, uint8_t data_in)
 RTC 18 write register function.
 
err_t rtc18_read_register (rtc18_t *ctx, uint8_t reg, uint8_t *data_out)
 RTC 18 read register function.
 
void rtc18_set_evi_pin (rtc18_t *ctx, uint8_t state)
 RTC 18 set EVI pin function.
 
uint8_t rtc18_get_int_pin (rtc18_t *ctx)
 RTC 18 get int pin function.
 
err_t rtc18_clear_periodic_interrupt (rtc18_t *ctx)
 RTC 18 clear periodic interrupt function.
 
err_t rtc18_set_time (rtc18_t *ctx, rtc18_time_t *time)
 RTC 18 set time function.
 
err_t rtc18_read_time (rtc18_t *ctx, rtc18_time_t *time)
 RTC 18 read time function.
 
err_t rtc18_set_date (rtc18_t *ctx, rtc18_date_t *date)
 RTC 18 set date function.
 
err_t rtc18_read_date (rtc18_t *ctx, rtc18_date_t *date)
 RTC 18 read date function.
 
err_t rtc18_read_temperature (rtc18_t *ctx, float *temperature)
 RTC 18 read temperature function.
 
err_t rtc18_write_eeprom (rtc18_t *ctx, uint8_t address, uint8_t data_in)
 RTC 18 write eeprom function.
 
err_t rtc18_read_eeprom (rtc18_t *ctx, uint8_t address, uint8_t *data_out)
 RTC 18 read eeprom function.
 

Detailed Description

This file contains API for RTC 18 Click Driver.

Enumeration Type Documentation

◆ rtc18_return_value_t

RTC 18 Click return value data.

Predefined enum values for driver return values.

Enumerator
RTC18_OK 
RTC18_ERROR