rtc6 2.0.0.0
Public function

Functions

void rtc6_cfg_setup (rtc6_cfg_t *cfg)
 Config Object Initialization function.
 
RTC6_RETVAL rtc6_init (rtc6_t *ctx, rtc6_cfg_t *cfg)
 Initialization function.
 
void rtc6_default_cfg (rtc6_t *ctx, int8_t time_zone, rtc6_time_t *utc_time, rtc6_time_t *alarm_time)
 Click Default Configuration function.
 
void rtc6_generic_write (rtc6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void rtc6_generic_read (rtc6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t rtc6_init_fun (rtc6_t *ctx, int8_t time_zone)
 
void rtc6_enable_swo (rtc6_t *ctx, uint8_t swo)
 Enable Square Wave Output.
 
void rtc6_disable_swo (rtc6_t *ctx)
 Disables Square Wave Output.
 
void rtc6_battery_enable (rtc6_t *ctx)
 Enables automatic switch to battery.
 
void rtc6_get_gmt_time (rtc6_t *ctx, rtc6_time_t *gmt_time)
 Gets the current GMT time set in the RTC.
 
void rtc6_set_gmt_time (rtc6_t *ctx, rtc6_time_t *set_time)
 Sets the UTC GMT time.
 
void rtc6_get_local_time (rtc6_t *ctx, rtc6_time_t *local_time)
 Calculates the current local time.
 
uint32_t rtc6_get_gmt_unix_time (rtc6_t *ctx)
 Calculates the current GMT time in UNIX epoch time.
 
uint32_t rtc6_get_local_unix_time (rtc6_t *ctx)
 Calculates the current local time in UNIX epoch time.
 
uint8_t rtc6_is_leap_year (rtc6_t *ctx)
 Checks if the current year is a leap one.
 
uint8_t rtc6_is_power_failure (rtc6_t *ctx)
 Checks if a power failure has occured.
 
void rtc6_get_last_power_failure (rtc6_t *ctx, rtc6_time_t *last_time)
 Gets the time of the last power failure.
 
void rtc6_set_alarm (rtc6_t *ctx, uint8_t alarm, uint8_t trigger, rtc6_time_t *time)
 Sets the desired alarm.
 
void rtc6_disable_alarm (rtc6_t *ctx, uint8_t alarm)
 Disables the alarm.
 
void rtc6_read_alarm (rtc6_t *ctx, uint8_t alarm, rtc6_time_t *get_alarm)
 Reads the alarm time.
 
uint8_t rtc6_is_active_alarm (rtc6_t *ctx)
 Check if the alarm is activated.
 
void rtc6_repeat_alarm (rtc6_t *ctx, uint8_t alarm, uint32_t sec)
 Repeat Alarm.
 
void rtc6_write_sram (rtc6_t *ctx, uint8_t addr, uint8_t data_in)
 Writes data to the SRAM.
 
uint8_t rtc6_read_sram (rtc6_t *ctx, uint8_t addr)
 Reads data from an SRAM.
 
void rtc6_write_eeprom_protect_on (rtc6_t *ctx)
 Write protect on.
 
void rtc6_write_eeprom_protect_off (rtc6_t *ctx)
 Write protect off.
 
uint8_t rtc6_eeprom_is_locked (rtc6_t *ctx)
 Lock check function.
 
void rtc6_write_eeprom (rtc6_t *ctx, uint8_t addr, uint8_t *data_in, uint8_t data_size)
 Writes data to EEPROM.
 
void rtc6_read_eeprom (rtc6_t *ctx, uint8_t addr, uint8_t *data_out, uint8_t data_size)
 Reads data from EEPROM.
 
void rtc6_read_unique_id (rtc6_t *ctx, uint8_t *unique_id)
 Reads unique ID.
 

Detailed Description

Function Documentation

◆ rtc6_battery_enable()

void rtc6_battery_enable ( rtc6_t * ctx)

Enables automatic switch to battery.

Parameters
ctxClick object.

@description This function enables automatic switch to battery on VCC failure.

◆ rtc6_cfg_setup()

void rtc6_cfg_setup ( rtc6_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ rtc6_default_cfg()

void rtc6_default_cfg ( rtc6_t * ctx,
int8_t time_zone,
rtc6_time_t * utc_time,
rtc6_time_t * alarm_time )

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Rtc6 click.

◆ rtc6_disable_alarm()

void rtc6_disable_alarm ( rtc6_t * ctx,
uint8_t alarm )

Disables the alarm.

Parameters
ctxClick object.
alarmDesired alarm to be disabled (alarm 0 or alarm 1)

@description This function disables the alarm.

◆ rtc6_disable_swo()

void rtc6_disable_swo ( rtc6_t * ctx)

Disables Square Wave Output.

Parameters
ctxClick object.

@description This function deisables square wave output.

◆ rtc6_eeprom_is_locked()

uint8_t rtc6_eeprom_is_locked ( rtc6_t * ctx)

Lock check function.

Parameters
ctxClick object.

@description This function checks if EEPROM is locked.

◆ rtc6_enable_swo()

void rtc6_enable_swo ( rtc6_t * ctx,
uint8_t swo )

Enable Square Wave Output.

Parameters
ctxClick object.
swoFrequency of output

@description This function enables and sets square wave output. Available options:

  - RTC6_SWO_1HZ
  - RTC6_SWO_4_096KHZ
  - RTC6_SWO_8_192KHZ
  - RTC6_SWO_32_768KHZ

◆ rtc6_generic_read()

void rtc6_generic_read ( rtc6_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ rtc6_generic_write()

void rtc6_generic_write ( rtc6_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ rtc6_get_gmt_time()

void rtc6_get_gmt_time ( rtc6_t * ctx,
rtc6_time_t * gmt_time )

Gets the current GMT time set in the RTC.

Parameters
ctxClick object.
gmt_timeA buffer in which GMT time values will be stored

@description This function gets current GMT time and sets it in the RTC.

◆ rtc6_get_gmt_unix_time()

uint32_t rtc6_get_gmt_unix_time ( rtc6_t * ctx)

Calculates the current GMT time in UNIX epoch time.

Parameters
ctxClick object.
Return values
GMTtime converted to UNIX epoch time

@description This function calculates and returns current GMT time in UNIX epoch time.

◆ rtc6_get_last_power_failure()

void rtc6_get_last_power_failure ( rtc6_t * ctx,
rtc6_time_t * last_time )

Gets the time of the last power failure.

Parameters
ctxClick object.
last_timetime of the power failure

@description This functions gets the of the last power faulure.

◆ rtc6_get_local_time()

void rtc6_get_local_time ( rtc6_t * ctx,
rtc6_time_t * local_time )

Calculates the current local time.

Parameters
ctxClick object.
local_timeA buffer in which local time values will be stored

@description This function calculates current local time.

◆ rtc6_get_local_unix_time()

uint32_t rtc6_get_local_unix_time ( rtc6_t * ctx)

Calculates the current local time in UNIX epoch time.

Parameters
ctxClick object.
Return values
localtime converted to UNIX epoch time

@description This function calculates and returns current local time in UNIX epoch time.

◆ rtc6_init()

RTC6_RETVAL rtc6_init ( rtc6_t * ctx,
rtc6_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ rtc6_init_fun()

uint8_t rtc6_init_fun ( rtc6_t * ctx,
int8_t time_zone )

◆ rtc6_is_active_alarm()

uint8_t rtc6_is_active_alarm ( rtc6_t * ctx)

Check if the alarm is activated.

Parameters
ctxClick object.
Return values
0- if not active alarm or 1 - if active alarm

@description This function checks if the alarm is activated by checking the state of the int_pin pin.

◆ rtc6_is_leap_year()

uint8_t rtc6_is_leap_year ( rtc6_t * ctx)

Checks if the current year is a leap one.

Parameters
ctxClick object.
Return values
0- on a leap year or 1 - if not a leap year

@description This function checks if current year is a leap year and returns an appropriate value.

◆ rtc6_is_power_failure()

uint8_t rtc6_is_power_failure ( rtc6_t * ctx)

Checks if a power failure has occured.

Parameters
ctxClick object.
Return values
0if a power failure detected or 1 if no power failure was detected

@description This function checks if power failure has occured and returns an appropriate value.

◆ rtc6_read_alarm()

void rtc6_read_alarm ( rtc6_t * ctx,
uint8_t alarm,
rtc6_time_t * get_alarm )

Reads the alarm time.

Parameters
ctxClick object.
alarmDesired alarm to be read (alarm 0 or alarm 1)
get_alarmStruct in which Alarm time values will be stored

@description This function reads the alarm time.

◆ rtc6_read_eeprom()

void rtc6_read_eeprom ( rtc6_t * ctx,
uint8_t addr,
uint8_t * data_out,
uint8_t data_size )

Reads data from EEPROM.

Parameters
ctxClick object.
addrAddress from where to start reading
data_outVariable which will hold the read data
data_sizeNumber of bytes to be read

@description This functiom reads data from EEPROM registers of the RTC

◆ rtc6_read_sram()

uint8_t rtc6_read_sram ( rtc6_t * ctx,
uint8_t addr )

Reads data from an SRAM.

Parameters
ctxClick object.
addrRegister address
Return values
readdata byte

@description This function reads data from an SRAM register

◆ rtc6_read_unique_id()

void rtc6_read_unique_id ( rtc6_t * ctx,
uint8_t * unique_id )

Reads unique ID.

Parameters
ctxClick object.
Return values
uniqueID (8 bytes)

@description This funciton reads unique ID from EEPROM registers of the RTC

◆ rtc6_repeat_alarm()

void rtc6_repeat_alarm ( rtc6_t * ctx,
uint8_t alarm,
uint32_t sec )

Repeat Alarm.

Parameters
ctxClick object.
alarmDesired alarm to be read (alarm 0 or alarm 1)
secNumber of seconds for which the alarm will repeat

@description This funtion sets up repeats for the alarm.

◆ rtc6_set_alarm()

void rtc6_set_alarm ( rtc6_t * ctx,
uint8_t alarm,
uint8_t trigger,
rtc6_time_t * time )

Sets the desired alarm.

Parameters
ctxClick object.
alarmDesired alarm to be set (alarm 0 or alarm 1)
triggerDesired trigger for the alarm
timeDesired alarm time to be set

@description This function sets the desired alarm.

◆ rtc6_set_gmt_time()

void rtc6_set_gmt_time ( rtc6_t * ctx,
rtc6_time_t * set_time )

Sets the UTC GMT time.

Parameters
ctxClick object.
set_timeGMT time to be set.

@description This function sets GMT/UTC time.

◆ rtc6_write_eeprom()

void rtc6_write_eeprom ( rtc6_t * ctx,
uint8_t addr,
uint8_t * data_in,
uint8_t data_size )

Writes data to EEPROM.

Parameters
ctxClick object.
addrAddress from where to start writing
data_inData to be written
data_sizeNumber of bytes to be written

@description This function writes data to EEPROM registers of RTC

◆ rtc6_write_eeprom_protect_off()

void rtc6_write_eeprom_protect_off ( rtc6_t * ctx)

Write protect off.

Parameters
ctxClick object.

@description This function turns EEPROM write protection off.

◆ rtc6_write_eeprom_protect_on()

void rtc6_write_eeprom_protect_on ( rtc6_t * ctx)

Write protect on.

Parameters
ctxClick object.

@description This function turns EEPROM write protection on.

◆ rtc6_write_sram()

void rtc6_write_sram ( rtc6_t * ctx,
uint8_t addr,
uint8_t data_in )

Writes data to the SRAM.

Parameters
ctxClick object.
addrAddress of the desired register
data_inData to be written

@description This function writes data to the SRAM registers of the RTC