rtc  2.0.0.0
Functions
Public function

Functions

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

Detailed Description

Function Documentation

◆ rtc_c_cfg_setup()

void rtc_c_cfg_setup ( rtc_c_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.

◆ rtc_c_check_leap_year()

uint8_t rtc_c_check_leap_year ( rtc_c_t ctx)

Check if it's a leap year function.

Parameters
ctxClick object.
Returns
result
  • 0 : Is't Leap Year - February has 28 days.
  • 1 : Is Leap Year - February has 29 days.

Function check if it's a leap year by read from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_enable_disable_alarm()

void rtc_c_enable_disable_alarm ( rtc_c_t ctx,
uint8_t  en_dis 
)

Enable/Disable alarm function.

Parameters
ctxClick object.
en_disEnable/Disable switch flag.

Function enable alarm by set alarm control bit register to the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_enable_disable_counting()

void rtc_c_enable_disable_counting ( rtc_c_t ctx,
uint8_t  en_dis 
)

Enable/Disable counting function.

Parameters
ctxClick object.
en_disEnable/Disable flag.

Function that enables or disables counting on RTC Click.

◆ rtc_c_enable_disable_interrupt()

void rtc_c_enable_disable_interrupt ( rtc_c_t ctx,
uint8_t  flag 
)

Enable alarm interrupt function.

Parameters
ctxClick object.
flagEnable/Disable switch flag.

Function enables/disables alarm interrupt by setting alarm interrupt bit register to the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_generic_read()

err_t rtc_c_generic_read ( rtc_c_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

RTC I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See rtc_c_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rtc_c_generic_write()

err_t rtc_c_generic_write ( rtc_c_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

RTC I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See rtc_c_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rtc_c_get_alarm_value()

uint8_t rtc_c_get_alarm_value ( rtc_c_t ctx,
uint8_t  alarm_addr 
)

Get alarm time value function.

Parameters
ctxClick object.
alarm_addrAddress of the corresponding alarm time register
Returns
alarm time in hours [ 0 h - 23 h ], minutes [ 0 min - 59 min ], seconds [ 0 sec - 59 sec ], or hunreths of a second [ 0 ms - 99 ms ].

Function getx alarm time value ( hundredth of a second, seconds, minutes or hours ) by reading time value from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_date()

void rtc_c_get_date ( rtc_c_t ctx)

Get time hours, minutes and seconds function.

Parameters
ctxClick object.

Function gets date: day of the week, day, month and year data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_date_day()

uint8_t rtc_c_get_date_day ( rtc_c_t ctx)

Get day function.

Parameters
ctxClick object.
Returns
Date day [ 1 - 31 ]

Function gets day data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_date_month()

uint8_t rtc_c_get_date_month ( rtc_c_t ctx)

Get month function.

Parameters
ctxClick object.
Returns
Month [ 1 - 12 ]

Function gets month data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_date_year()

uint8_t rtc_c_get_date_year ( rtc_c_t ctx)

Get year function.

Parameters
ctxClick object.
Returns
Year [ 00 - 99 ]

Function gets year data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_day_of_the_week()

uint8_t rtc_c_get_day_of_the_week ( rtc_c_t ctx)

Get day of the week function.

Parameters
ctxClick object.
Returns
Day of the week [ 1 - 7 ]

Function gets day of the week data from tne target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_interrupt()

uint8_t rtc_c_get_interrupt ( rtc_c_t ctx)

Get state of interrupt pin function.

Parameters
ctxClick object.
Returns
state of INT pin
  • 0: not active;
  • 1: active

Function get state of interrupt ( INT ) pin.

◆ rtc_c_get_time()

void rtc_c_get_time ( rtc_c_t ctx)

Get time hours, minutes, seconds and hundredth of a seconds function.

Parameters
ctxClick object.

Function gets time: hours, minutes and seconds data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_time_alarm()

void rtc_c_get_time_alarm ( rtc_c_t ctx)

Get the alarm time hours, minutes, seconds and hundredth of a seconds function.

Parameters
ctxClick object.

Function gets the alarm time: hours, minutes and seconds data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_get_time_value()

uint8_t rtc_c_get_time_value ( rtc_c_t ctx,
uint8_t  time_part 
)

Get time value function.

Parameters
ctxClick object.
time_partTime part register address.
Returns
Part of the current time in hours [ 0 h - 23 h ], minutes [ 0 min - 59 min ], seconds [ 0 sec - 59 sec ], or hunreths of a second [ 0 ms - 99 ms ].

Function gets hundredths of a second, seconds, minutes or hours data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_init()

err_t rtc_c_init ( rtc_c_t ctx,
rtc_c_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

This function initializes all necessary pins and peripherals used for this Click.

◆ rtc_c_read_date()

void rtc_c_read_date ( rtc_c_t ctx)

Set control register to read date function.

Parameters
ctxClick object.

Function sets control register to read time by setting read location bit of PCF8583 chip on RTC Click.

◆ rtc_c_read_time()

void rtc_c_read_time ( rtc_c_t ctx)

Set control register to read time function.

Parameters
ctxClick object.

Function sets control register to read time by clearing read location bit of PCF8583 chip on RTC Click.

◆ rtc_c_set_alarm_value()

void rtc_c_set_alarm_value ( rtc_c_t ctx,
uint8_t  al_time_val,
uint8_t  al_time_type 
)

Set alarm time value.

Parameters
ctxClick object.
al_time_valAlarm time part value ( hours, minutes, seconds, hundreths of a second )
al_time_typeAlarm time register address.

Function set alarm time - hundredth of a seconds, seconds, minutes or hours by writing time part value to the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_date()

void rtc_c_set_date ( rtc_c_t ctx)

Set date hours, minutes and seconds function.

Parameters
ctxClick object.

Function sets date: day of the week, day, month and year data to the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_date_day()

void rtc_c_set_date_day ( rtc_c_t ctx,
uint8_t  date_day 
)

Set day function.

Parameters
ctxClick object.
date_dayDate day data [ 1 - 31 ]

Function sets day data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_date_month()

void rtc_c_set_date_month ( rtc_c_t ctx,
uint8_t  date_month 
)

Set month function.

Parameters
ctxClick object.
date_monthDate month data [ 1 - 12 ]

Function sets month data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_date_year()

void rtc_c_set_date_year ( rtc_c_t ctx,
uint16_t  date_year 
)

Set year function.

Parameters
ctxClick object.
date_yearDate year data [ 00 - 99 ]

Function sets year data from the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_day_of_the_week()

void rtc_c_set_day_of_the_week ( rtc_c_t ctx,
uint8_t  w_day 
)

Set day of the week function.

Parameters
ctxClick object.
w_dayDay of the week data [ 1 - 7 ]
  • 1 : Monday;
  • 2 : Tuesday;
  • 3 : Wednesday;
  • 4 : Thursday;
  • 5 : Friday;
  • 6 : Saturday;
  • 7 : Sunday;

Function sets day of the week data to the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_time()

void rtc_c_set_time ( rtc_c_t ctx)

Set time hours, minutes, seconds and hundredth of a seconds function.

Parameters
ctxClick object.

Function sets time: hours, minutes and seconds data to the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_time_alarm()

void rtc_c_set_time_alarm ( rtc_c_t ctx)

Set alarm time - minutes function.

Parameters
ctxClick object.

Function set alarm time - minutes by write minutes value to the target register address of PCF8583 chip on RTC Click.

◆ rtc_c_set_time_value()

void rtc_c_set_time_value ( rtc_c_t ctx,
uint8_t  time_part,
uint8_t  time_addr 
)

Set time values function.

Parameters
ctxClick object.
time_partPart of time format ( hours, minutes, seconds or hundreths of a second ).
time_addrRegister address of the corresponding part of the time format.

Function sets seconds data to the target register address of PCF8583 chip on RTC Click.