rtc8 2.0.0.0
Public function

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

Function Documentation

◆ rtc8_cfg_setup()

void rtc8_cfg_setup ( rtc8_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ rtc8_default_cfg()

err_t rtc8_default_cfg ( rtc8_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function executes default configuration for RTC 8 click.

◆ rtc8_generic_read()

err_t rtc8_generic_read ( rtc8_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
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function reads data from the desired register.

◆ rtc8_generic_write()

err_t rtc8_generic_write ( rtc8_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.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function writes data to the desired register.

◆ rtc8_get_alarm_flag()

err_t rtc8_get_alarm_flag ( rtc8_t * ctx,
uint8_t * alarm_flag )

Get Alarm flag.

Parameters
ctxClick object.
alarm_flagAlarm flage ( ALARM IS ACTIVE or ALARM ISN'T ACTIVE)
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ rtc8_get_int_pin()

uint8_t rtc8_get_int_pin ( rtc8_t * ctx)

Get interrupt state.

Parameters
ctxClick object.
Returns
Interrupt pin state

◆ rtc8_get_status()

err_t rtc8_get_status ( rtc8_t * ctx,
uint8_t * status )

Get status.

Parameters
ctxClick object.
statusStatus register data
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ rtc8_get_uinx_time()

err_t rtc8_get_uinx_time ( rtc8_t * ctx,
uint32_t * unix_time )

Get current UNIX time.

Parameters
ctxClick object.
unix_timeUNIX time.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ rtc8_init()

err_t rtc8_init ( rtc8_t * ctx,
rtc8_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
This function initializes all necessary pins and peripherals used for this click.

◆ rtc8_read_data()

err_t rtc8_read_data ( rtc8_t * ctx,
uint8_t reg,
uint8_t * data_out )

Read one byte data from register in DEC format.

Parameters
ctxClick object.
regRegister Address
data_outData output in decimal format
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Use this function when you need to read the register with converting data from BCD format to DEC format.

◆ rtc8_reset_alarm_flag()

err_t rtc8_reset_alarm_flag ( rtc8_t * ctx)

Reset alarm.

Parameters
ctxClick object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ rtc8_set_alarm()

err_t rtc8_set_alarm ( rtc8_t * ctx,
rtc8_alarm_t * alarm_s )

Set Alarm.

Parameters
ctxClick object.
alarm_sAlarm Structure ( weekdays, hours, minutes )
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Set the time at which the alarm active

◆ rtc8_set_date()

err_t rtc8_set_date ( rtc8_t * ctx,
rtc8_date_t * date_s )

Set new date.

Parameters
ctxClick object.
date_sDate Structure ( New Hours (0 - 31), New minutes (1 - 12), New secconds (0 - 99) 2000 year ... 2099 year)
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
If no new date is set - RTC continues to count where it stopped.

◆ rtc8_set_evi_pin()

void rtc8_set_evi_pin ( rtc8_t * ctx,
uint8_t state )

Set EVI(External Event Input) pin.

Parameters
ctxClick object.
state- EVI state

◆ rtc8_set_time()

err_t rtc8_set_time ( rtc8_t * ctx,
rtc8_time_t * time_s )

Set new time - 24 hour format.

Parameters
ctxClick object.
time_sTime Structure ( New Hours (0 - 23), New minutes (0 - 59), New secconds (0 - 59) )
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
If no new time is set - RTC continues to count where it stopped.

◆ rtc8_set_unix_time()

err_t rtc8_set_unix_time ( rtc8_t * ctx,
uint32_t unix_time )

Set UNIX time.

Parameters
ctxClick object.
unix_time4 byte unix time
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.

◆ rtc8_write_data()

err_t rtc8_write_data ( rtc8_t * ctx,
uint8_t reg,
uint8_t data_in )

Write data ( Convert and send data in BCD format )

Parameters
ctxClick object.
regRegister Address
data_inData in decimal format
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Use this function when you need to write the data in the register in decimal format.

◆ rtx8_get_time_and_date()

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 )

Parameters
ctxClick object.
time_sTime Structure ( New Hours (0 - 23), New minutes (0 - 59), New secconds (0 - 59) )
date_sDate Structure ( New Hours (0 - 31), New minutes (1 - 12), New secconds (0 - 99) 2000 year ... 2099 year)
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.