rtc4 2.0.0.0
RTC 4 Click Driver

API for configuring and manipulating RTC 4 Click driver. More...

Topics

 RTC 4 Commands List
 List of commands of RTC 4 Click driver.
 
 RTC 4 time values list.
 List of time values.
 
 RTC 4 Settings
 Settings of RTC 4 Click driver.
 
 RTC 4 MikroBUS Map
 MikroBUS pin mapping of RTC 4 Click driver.
 

Functions

void rtc4_cfg_setup (rtc4_cfg_t *cfg)
 RTC 4 configuration object setup function.
 
void rtc4_gpio_selection (rtc4_cfg_t *cfg, rtc4_gpio_sel_t gpio_sel)
 RTC 4 driver interface setup function.
 
err_t rtc4_init (rtc4_t *ctx, rtc4_cfg_t *cfg)
 RTC 4 initialization function.
 
err_t rtc4_check_communication (rtc4_t *ctx)
 RTC 4 check communication function.
 
uint8_t rtc4_get_interrupt (rtc4_t *ctx)
 RTC 4 get interrupt function.
 
err_t rtc4_set_unix_and_int (rtc4_t *ctx, uint32_t unix_time, uint8_t int_interval)
 RTC 4 set unix and interrupt interval function.
 
err_t rtc4_get_unix_time (rtc4_t *ctx, uint32_t *unix_time)
 RTC 4 get unix time function.
 
void rtc4_unix_to_date_time (uint32_t unix_time, rtc4_time_t *time, rtc4_date_t *date)
 RTC 4 unix to date time function.
 
void rtc4_date_time_to_unix (rtc4_date_t *date, rtc4_time_t *time, uint32_t *unix_time)
 RTC 4 date time to unix function.
 
err_t rtc4_set_date_time (rtc4_t *ctx, rtc4_date_t *date, rtc4_time_t *time, uint8_t int_interval)
 RTC 4 set date time function.
 
err_t rtc4_get_date_time (rtc4_t *ctx, rtc4_date_t *date, rtc4_time_t *time)
 RTC 4 get date time function.
 

Detailed Description

API for configuring and manipulating RTC 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ rtc4_cfg_setup()

void rtc4_cfg_setup ( rtc4_cfg_t * cfg)

RTC 4 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See rtc4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ rtc4_check_communication()

err_t rtc4_check_communication ( rtc4_t * ctx)

RTC 4 check communication function.

This function checks the communication by reading the ROM address as well as verifying family code and Maxim CRC 8.

Parameters
[in]ctx: Click context object. See rtc4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rtc4_date_time_to_unix()

void rtc4_date_time_to_unix ( rtc4_date_t * date,
rtc4_time_t * time,
uint32_t * unix_time )

RTC 4 date time to unix function.

This function converts date time to the unix time.

Parameters
[in]date: Pointing to the address from where to get date. See rtc4_date_t object definition for detailed explanation.
[in]time: Pointing to the address from where to get time. See rtc4_time_t object definition for detailed explanation.
[out]unix_time: Pointing to the address where to store unix time.
Returns
Nothing.
Note
None.

◆ rtc4_get_date_time()

err_t rtc4_get_date_time ( rtc4_t * ctx,
rtc4_date_t * date,
rtc4_time_t * time )

RTC 4 get date time function.

This function gets RTC4 time and date structure.

Parameters
[in]ctx: Click context object.
[out]date: Pointing to the address where to store date. See rtc4_date_t object definition for detailed explanation.
[out]time: Pointing to the address where to store time. See rtc4_time_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rtc4_get_interrupt()

uint8_t rtc4_get_interrupt ( rtc4_t * ctx)

RTC 4 get interrupt function.

This function checks the interrupt state of the DS2417 Real time clock/calendar.

Parameters
[in]ctx: Click context object. See rtc4_t object definition for detailed explanation.
Returns
  • 0 - INT pin state low,
  • 1 - INT pin state high.
Note
None.

◆ rtc4_get_unix_time()

err_t rtc4_get_unix_time ( rtc4_t * ctx,
uint32_t * unix_time )

RTC 4 get unix time function.

This function gets unix time of the DS2417 Real time clock/calender.

Parameters
[in]ctx: Click context object. See rtc4_t object definition for detailed explanation.
[out]unix_time: Pointing to the address where to store unix time.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ rtc4_gpio_selection()

void rtc4_gpio_selection ( rtc4_cfg_t * cfg,
rtc4_gpio_sel_t gpio_sel )

RTC 4 driver interface setup function.

This function sets a communication GPIO pin which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See rtc4_cfg_t object definition for detailed explanation.
[in]gpio_sel: GPIO pin selection. See rtc4_gpio_sel_t object definition for detailed explanation.
Returns
Nothing.
Note
This gpio selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ rtc4_init()

err_t rtc4_init ( rtc4_t * ctx,
rtc4_cfg_t * cfg )

RTC 4 initialization function.

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

Parameters
[out]ctx: Click context object. See rtc4_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See rtc4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ rtc4_set_date_time()

err_t rtc4_set_date_time ( rtc4_t * ctx,
rtc4_date_t * date,
rtc4_time_t * time,
uint8_t int_interval )

RTC 4 set date time function.

This function sets date and time structure along with interrupt interval.

Parameters
[in]ctx: Click context object.
[in]date: Pointing to the address from where to set date. See rtc4_date_t object definition for detailed explanation.
[in]time: Pointing to the address from where to set date. See rtc4_time_t object definition for detailed explanation.
[in]int_interval: Interrupt interval.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rtc4_set_unix_and_int()

err_t rtc4_set_unix_and_int ( rtc4_t * ctx,
uint32_t unix_time,
uint8_t int_interval )

RTC 4 set unix and interrupt interval function.

This function sets both unix time and interrupt interval.

Parameters
[in]ctx: Click context object. See rtc4_t object definition for detailed explanation.
[in]unix_time: Unix time we want to set.
[in]int_interval: Interrupt interval we want to set.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rtc4_unix_to_date_time()

void rtc4_unix_to_date_time ( uint32_t unix_time,
rtc4_time_t * time,
rtc4_date_t * date )

RTC 4 unix to date time function.

This function converts unix time to the human-readable format.

Parameters
[in]unix_time: Unix time we want to convert.
[out]time: Pointing to the address where to store time. See rtc4_time_t object definition for detailed explanation.
[out]date: Pointing to the address where to store date. See rtc4_date_t object definition for detailed explanation.
Returns
Nothing.
Note
None.