rtc20 2.1.0.0
RTC 20 Click Driver

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

Topics

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

Functions

void rtc20_cfg_setup (rtc20_cfg_t *cfg)
 RTC 20 configuration object setup function.
 
err_t rtc20_init (rtc20_t *ctx, rtc20_cfg_t *cfg)
 RTC 20 initialization function.
 
err_t rtc20_generic_write (rtc20_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 RTC 20 I2C writing function.
 
err_t rtc20_generic_read (rtc20_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 RTC 20 I2C reading function.
 
void rtc20_wdi_pin_state (rtc20_t *ctx, uint8_t pin_state)
 RTC 20 I2C reading function.
 
void rtc20_ext_pin_state (rtc20_t *ctx, uint8_t pin_state)
 RTC 20 I2C reading function.
 
err_t rtc20_set_time (rtc20_t *ctx, rtc20_time_t rtc_time)
 RTC 20 set time function.
 
err_t rtc20_get_time (rtc20_t *ctx, rtc20_time_t *rtc_time)
 RTC 20 get time function.
 
err_t rtc20_set_date (rtc20_t *ctx, rtc20_date_t rtc_date)
 RTC 20 set date function.
 
err_t rtc20_get_date (rtc20_t *ctx, rtc20_date_t *rtc_date)
 RTC 20 get date function.
 
err_t rtc20_set_alarm (rtc20_t *ctx, rtc20_time_t rtc_alarm_time, rtc20_date_t rtc_alarm_date)
 RTC 20 set alarm function.
 
err_t rtc20_get_alarm (rtc20_t *ctx, rtc20_time_t *rtc_alarm_time, rtc20_date_t *rtc_alarm_date)
 RTC 20 get alarm function.
 
err_t rtc20_get_status (rtc20_t *ctx, uint8_t *status)
 RTC 20 get status function.
 
err_t rtc20_set_ctrl_signals (rtc20_t *ctx, rtc20_ctrl_signals_t ctrl_signals)
 RTC 20 set ctrl signals function.
 
err_t rtc20_get_ctrl_signals (rtc20_t *ctx, rtc20_ctrl_signals_t *ctrl_signals)
 RTC 20 get ctrl signals function.
 
uint8_t rtc20_get_ir1_pin (rtc20_t *ctx)
 RTC 20 get IR1 pin function.
 
uint8_t rtc20_get_ir2_pin (rtc20_t *ctx)
 RTC 20 get IR2 pin function.
 

Detailed Description

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

◆ rtc20_cfg_setup()

void rtc20_cfg_setup ( rtc20_cfg_t * cfg)

RTC 20 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ rtc20_ext_pin_state()

void rtc20_ext_pin_state ( rtc20_t * ctx,
uint8_t pin_state )

RTC 20 I2C reading function.

This function sets the EXT pin logic state of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

Parameters
[in]ctx: Click context object. See rtc20_t object definition for detailed explanation.
[in]pin_state: EXT pin logic state.
Returns
Nothing.
Note
External interrupt input connection. It may be used to generate an External 1 interrupt with polarity selected by the EX1P bit if enabled by the EX1E bit. The value of the EXTI pin may be read in the EXIN register bit. This pin does not have an internal pull-up or pull-down resistor and so one must be added externally. It must not be left floating or the RTC may consume higher current.

◆ rtc20_generic_read()

err_t rtc20_generic_read ( rtc20_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

RTC 20 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 rtc20_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.

◆ rtc20_generic_write()

err_t rtc20_generic_write ( rtc20_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

RTC 20 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 rtc20_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.

◆ rtc20_get_alarm()

err_t rtc20_get_alarm ( rtc20_t * ctx,
rtc20_time_t * rtc_alarm_time,
rtc20_date_t * rtc_alarm_date )

RTC 20 get alarm function.

This function reads the current RTC alarm time and date data
of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

Parameters
[in]ctx: Click context object. See rtc20_t object definition for detailed explanation.
[out]rtc_alarm_time: RTC time object structure.
[out]rtc_alarm_date: RTC date object structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rtc20_get_ctrl_signals()

err_t rtc20_get_ctrl_signals ( rtc20_t * ctx,
rtc20_ctrl_signals_t * ctrl_signals )

RTC 20 get ctrl signals function.

This function reads the control signals data
of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

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

◆ rtc20_get_date()

err_t rtc20_get_date ( rtc20_t * ctx,
rtc20_date_t * rtc_date )

RTC 20 get date function.

This function reads the current RTC date data
of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

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

◆ rtc20_get_ir1_pin()

uint8_t rtc20_get_ir1_pin ( rtc20_t * ctx)

RTC 20 get IR1 pin function.

This function get primary interrupt pin stste of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

Parameters
[in]ctx: Click context object. See rtc20_t object definition for detailed explanation.
Returns
IR1 pin logic state.
Note
Primary interrupt output connection.
  • 1. FOUT/nIRQ can drive the value of the OUT bit.
  • 2. FOUT/nIRQ can drive the inverse of the combined interrupt signal IRQ (see Interrupts).
  • 3. FOUT/nIRQ can drive the square wave output (see 0x13 - SQW) if enabled by SQWE.
  • 4. FOUT/nIRQ can drive the inverse of the alarm interrupt signal AIRQ (see Interrupts).

◆ rtc20_get_ir2_pin()

uint8_t rtc20_get_ir2_pin ( rtc20_t * ctx)

RTC 20 get IR2 pin function.

This function get secondary interrupt pin stste of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

Parameters
[in]ctx: Click context object. See rtc20_t object definition for detailed explanation.
Returns
IR2 pin logic state.
Note
Secondary interrupt output connection. It is an open drain output.
  • 1. nIRQ2 may be configured to generate several signals as a function of the OUT2S field (see 0x11 - Control2). nIRQ2 can drive the value of the OUTB bit.
  • 2. nIRQ2 can drive the square wave output (see 0x13 - SQW) if enabled by SQWE.
  • 3. nIRQ2 can drive the inverse of the combined interrupt signal IRQ(see Interrupts).
  • 4. nIRQ2 can drive the inverse of the alarm interrupt signal AIRQ(see Interrupts).
  • 5. nIRQ2 can drive either sense of the timer interrupt signal TIRQ.

◆ rtc20_get_status()

err_t rtc20_get_status ( rtc20_t * ctx,
uint8_t * status )

RTC 20 get status function.

This function reads the status data
of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

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

◆ rtc20_get_time()

err_t rtc20_get_time ( rtc20_t * ctx,
rtc20_time_t * rtc_time )

RTC 20 get time function.

This function reads the current RTC time data of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

Parameters
[in]ctx: Click context object. See rtc20_t object definition for detailed explanation.
[out]rtc_time: RTC time object structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rtc20_init()

err_t rtc20_init ( rtc20_t * ctx,
rtc20_cfg_t * cfg )

RTC 20 initialization function.

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

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

◆ rtc20_set_alarm()

err_t rtc20_set_alarm ( rtc20_t * ctx,
rtc20_time_t rtc_alarm_time,
rtc20_date_t rtc_alarm_date )

RTC 20 set alarm function.

This function sets the desired RTC alarm time and date data
of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

Parameters
[in]ctx: Click context object. See rtc20_t object definition for detailed explanation.
[in]rtc_alarm_time: RTC time object structure.
[in]rtc_alarm_date: RTC date object structure.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ rtc20_set_ctrl_signals()

err_t rtc20_set_ctrl_signals ( rtc20_t * ctx,
rtc20_ctrl_signals_t ctrl_signals )

RTC 20 set ctrl signals function.

This function set the control signals data of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

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

◆ rtc20_set_date()

err_t rtc20_set_date ( rtc20_t * ctx,
rtc20_date_t rtc_date )

RTC 20 set date function.

This function sets the desired RTC date data
of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

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

◆ rtc20_set_time()

err_t rtc20_set_time ( rtc20_t * ctx,
rtc20_time_t rtc_time )

RTC 20 set time function.

This function sets the desired RTC time data
of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

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

◆ rtc20_wdi_pin_state()

void rtc20_wdi_pin_state ( rtc20_t * ctx,
uint8_t pin_state )

RTC 20 I2C reading function.

This function sets the WDI pin logic state of the AB08X5 Real-Time Clock on the RTC 20 Click board™.

Parameters
[in]ctx: Click context object. See rtc20_t object definition for detailed explanation.
[in]pin_state: WDI pin logic state.
Returns
Nothing.
Note
Watchdog Timer reset input connection. It may also be used to generate an External 2 interrupt with polarity selected by the EX2P bit if enabled by the EX2E bit. The value of the WDI pin may be read in the WDI register bit. This pin does not have an internal pull-up or pull-down resistor and so one must be added externally. It must not be left floating or the RTC may consume higher current.