rtc24 2.2.0
Loading...
Searching...
No Matches
RTC 24 Click Driver

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

Topics

 RTC 24 Registers List
 List of registers of RTC 24 Click driver.
 RTC 24 Registers Settings
 Settings for registers of RTC 24 Click driver.
 RTC 24 MikroBUS Map
 MikroBUS pin mapping of RTC 24 Click driver.

Functions

void rtc24_cfg_setup (rtc24_cfg_t *cfg)
 RTC 24 configuration object setup function.
err_t rtc24_init (rtc24_t *ctx, rtc24_cfg_t *cfg)
 RTC 24 initialization function.
err_t rtc24_default_cfg (rtc24_t *ctx)
 RTC 24 default configuration function.
err_t rtc24_write_regs (rtc24_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 RTC 24 write multiple registers function.
err_t rtc24_read_regs (rtc24_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 RTC 24 read multiple registers function.
err_t rtc24_write_reg (rtc24_t *ctx, uint8_t reg, uint8_t data_in)
 RTC 24 write single register function.
err_t rtc24_read_reg (rtc24_t *ctx, uint8_t reg, uint8_t *data_out)
 RTC 24 read single register function.
uint8_t rtc24_get_sqw_pin (rtc24_t *ctx)
 RTC 24 get square wave pin function.
err_t rtc24_check_communication (rtc24_t *ctx)
 RTC 24 check communication function.
err_t rtc24_set_time (rtc24_t *ctx, rtc24_time_t *time)
 RTC 24 set time function.
err_t rtc24_read_time (rtc24_t *ctx, rtc24_time_t *time)
 RTC 24 read time function.
err_t rtc24_set_date (rtc24_t *ctx, rtc24_date_t *date)
 RTC 24 set date function.
err_t rtc24_read_date (rtc24_t *ctx, rtc24_date_t *date)
 RTC 24 read date function.

Detailed Description

API for configuring and manipulating RTC 24 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

◆ rtc24_cfg_setup()

void rtc24_cfg_setup ( rtc24_cfg_t * cfg)

RTC 24 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ rtc24_check_communication()

err_t rtc24_check_communication ( rtc24_t * ctx)

RTC 24 check communication function.

This function performs a write-read test on the RAM register to verify communication.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
Returns
  • 0 - Success (communication established),
  • -1 - Error.
Note
None.

◆ rtc24_default_cfg()

err_t rtc24_default_cfg ( rtc24_t * ctx)

RTC 24 default configuration function.

This function executes a default configuration of RTC 24 Click board.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ rtc24_get_sqw_pin()

uint8_t rtc24_get_sqw_pin ( rtc24_t * ctx)

RTC 24 get square wave pin function.

This function returns the logic state of the SQW pin.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ rtc24_init()

err_t rtc24_init ( rtc24_t * ctx,
rtc24_cfg_t * cfg )

RTC 24 initialization function.

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

Parameters
[out]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See rtc24_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rtc24_read_date()

err_t rtc24_read_date ( rtc24_t * ctx,
rtc24_date_t * date )

RTC 24 read date function.

This function reads the current date (day, day of week, month, year) from the RTC.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[out]date: Pointer to the date structure to store the read values. See rtc24_date_t object definition for structure fields.
Returns
  • 0 - Success,
  • -1 - Error.
Note
Date values are returned in decimal format.

◆ rtc24_read_reg()

err_t rtc24_read_reg ( rtc24_t * ctx,
uint8_t reg,
uint8_t * data_out )

RTC 24 read single register function.

This function reads a single byte from the selected register.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to the memory to store the read byte.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rtc24_read_regs()

err_t rtc24_read_regs ( rtc24_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

RTC 24 read multiple registers function.

This function reads a sequence of bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Pointer to the buffer to store read data.
[in]len: Number of bytes to read.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rtc24_read_time()

err_t rtc24_read_time ( rtc24_t * ctx,
rtc24_time_t * time )

RTC 24 read time function.

This function reads the current time (hours, minutes, seconds) from the RTC.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[out]time: Pointer to the time structure to store the read values. See rtc24_time_t object definition for structure fields.
Returns
  • 0 - Success,
  • -1 - Error.
Note
Time values are returned in decimal format.

◆ rtc24_set_date()

err_t rtc24_set_date ( rtc24_t * ctx,
rtc24_date_t * date )

RTC 24 set date function.

This function sets the current date (day, day of week, month, year) in the RTC.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[in]date: Pointer to the date structure. See rtc24_date_t object definition for structure fields.
Returns
  • 0 - Success,
  • -1 - Error.
Note
Date values must be provided in decimal format.

◆ rtc24_set_time()

err_t rtc24_set_time ( rtc24_t * ctx,
rtc24_time_t * time )

RTC 24 set time function.

This function sets the current time (hours, minutes, seconds) in the RTC.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[in]time: Pointer to the time structure. See rtc24_time_t object definition for structure fields.
Returns
  • 0 - Success,
  • -1 - Error.
Note
Time values must be provided in decimal format.

◆ rtc24_write_reg()

err_t rtc24_write_reg ( rtc24_t * ctx,
uint8_t reg,
uint8_t data_in )

RTC 24 write single register function.

This function writes a single byte to the selected register.

Parameters
[in]ctx: Click context object. See rtc24_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data byte to write.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ rtc24_write_regs()

err_t rtc24_write_regs ( rtc24_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

RTC 24 write multiple registers function.

This function writes a sequence of bytes starting from the selected register.

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