i2cextend 2.0.0.0
I2C Extend Click Driver

API for configuring and manipulating I2C Extend Click driver. More...

Topics

 I2C Extend Registers List
 List of registers of I2C Extend Click driver.
 
 I2C Extend Registers Settings
 Settings for registers of I2C Extend Click driver.
 
 I2C Extend MikroBUS Map
 MikroBUS pin mapping of I2C Extend Click driver.
 

Functions

void i2cextend_cfg_setup (i2cextend_cfg_t *cfg)
 I2C Extend configuration object setup function.
 
err_t i2cextend_init (i2cextend_t *ctx, i2cextend_cfg_t *cfg)
 I2C Extend initialization function.
 
void i2cextend_generic_write (i2cextend_t *ctx, uint8_t reg, uint8_t tx_data)
 Generic write data function.
 
uint8_t i2cextend_generic_read (i2cextend_t *ctx, uint8_t reg)
 Generic read data function.
 
void i2cextend_rmt_write (i2cextend_t *ctx, uint8_t rmt_slave_addr, uint8_t reg, uint8_t tx_data)
 Generic write data in Remote Mode function.
 
uint8_t i2cextend_rmt_read (i2cextend_t *ctx, uint8_t rmt_slave_addr, uint8_t reg)
 Generic read data in Remote Mode function.
 
void i2cextend_rmt_multi_write (i2cextend_t *ctx, uint8_t rmt_slave_addr, uint8_t reg, uint8_t *p_tx_data, uint8_t n_bytes)
 Generic multi write data in Remote Mode function.
 
void i2cextend_rmt_multi_read (i2cextend_t *ctx, uint8_t rmt_slave_addr, uint8_t reg, uint8_t *p_rx_data, uint8_t n_bytes)
 Generic multi read data in Remote Mode function.
 
void i2cextend_set_config (i2cextend_t *ctx, uint8_t intr_mode, uint8_t ctrl_sel)
 Set the configuration function.
 
void i2cextend_status (i2cextend_t *ctx, i2cextend_status_data_t *status_data)
 Check the status function.
 
void i2cextend_enable_alerts (i2cextend_t *ctx, uint8_t link_good, uint8_t link_lost, uint8_t fault)
 Set enable alerts function.
 
void i2cextend_fault (i2cextend_t *ctx, i2cextend_fault_data_t *fault_data)
 Check the fault state function.
 
uint8_t i2cextend_get_scratch (i2cextend_t *ctx)
 Get scratch function.
 
void i2cextend_set_out_slave_address (i2cextend_t *ctx, uint8_t out_slave_address)
 Set out slave address function.
 
void i2cextend_set_out_ctrl (i2cextend_t *ctx, uint8_t out_ctrl)
 Set out CTRL function.
 
void i2cextend_set_rst (i2cextend_t *ctx, uint8_t en_rst)
 Set RTS pin state function.
 
void i2cextend_set_cs (i2cextend_t *ctx, uint8_t en_cs)
 Set CS pin state function.
 
void i2cextend_set_on (i2cextend_t *ctx, uint8_t on_state)
 Set ON pin state function.
 
uint8_t i2cextend_check_int (i2cextend_t *ctx)
 Check interrupt ststus function.
 

Detailed Description

API for configuring and manipulating I2C Extend 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

◆ i2cextend_cfg_setup()

void i2cextend_cfg_setup ( i2cextend_cfg_t * cfg)

I2C Extend configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ i2cextend_check_int()

uint8_t i2cextend_check_int ( i2cextend_t * ctx)

Check interrupt ststus function.

Function check interrupt state by return state of the INT pin of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
Returns
Interrupt state.

◆ i2cextend_enable_alerts()

void i2cextend_enable_alerts ( i2cextend_t * ctx,
uint8_t link_good,
uint8_t link_lost,
uint8_t fault )

Set enable alerts function.

Function enable alerts of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]link_good: The local and remote I2C networks alert.
[in]link_lost: The local and remote I2C networks have lost link communication:
[in]fault: Check fault state:
Returns
Nothing.

◆ i2cextend_fault()

void i2cextend_fault ( i2cextend_t * ctx,
i2cextend_fault_data_t * fault_data )

Check the fault state function.

Function read fault register and update fault state data structe of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[out]fault_data: Pointer to the memory location where data be stored.
Returns
Nothing.

◆ i2cextend_generic_read()

uint8_t i2cextend_generic_read ( i2cextend_t * ctx,
uint8_t reg )

Generic read data function.

Function read a byte of data from the targeted 8-bit register address of the LTC4331 I2C Slave Device Extender Over Rugged Differential Link on the I2c Extend click board.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]reg: 8-bit register address.
Returns
8-bit read data.

◆ i2cextend_generic_write()

void i2cextend_generic_write ( i2cextend_t * ctx,
uint8_t reg,
uint8_t tx_data )

Generic write data function.

Function writes a byte of data to the targeted 8-bit register address of the LTC4331 I2C Slave Device Extender Over Rugged Differential Link on the I2c Extend click board.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]reg: 8-bit register address.
[in]tx_data: Data to be written.
Returns
Nothing.

◆ i2cextend_get_scratch()

uint8_t i2cextend_get_scratch ( i2cextend_t * ctx)

Get scratch function.

Function read scratch register and return scratch data of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
Returns
8-bit scratch data ( default 0x08 );

◆ i2cextend_init()

err_t i2cextend_init ( i2cextend_t * ctx,
i2cextend_cfg_t * cfg )

I2C Extend initialization function.

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

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

◆ i2cextend_rmt_multi_read()

void i2cextend_rmt_multi_read ( i2cextend_t * ctx,
uint8_t rmt_slave_addr,
uint8_t reg,
uint8_t * p_rx_data,
uint8_t n_bytes )

Generic multi read data in Remote Mode function.

Function read a sequential data starting from the targeted register address of the click board connected to the I2c Extend click in Remote Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]rmt_slave_addr: 7-bit slave address.
[in]reg: 8-bit register address.
[out]p_rx_data: Pointer to the memory location where data be stored.
[in]n_bytes: Number of bytes to be read.
Returns
Nothing.

◆ i2cextend_rmt_multi_write()

void i2cextend_rmt_multi_write ( i2cextend_t * ctx,
uint8_t rmt_slave_addr,
uint8_t reg,
uint8_t * p_tx_data,
uint8_t n_bytes )

Generic multi write data in Remote Mode function.

Function writes a sequential data starting to the targeted register address of the click board connected to the I2c Extend click in Remote Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]rmt_slave_addr: 7-bit slave address.
[in]reg: 8-bit register address.
[in]p_tx_data: Pointer to the data to be written.
[in]n_bytes: Number of bytes to be written.
Returns
Nothing.

◆ i2cextend_rmt_read()

uint8_t i2cextend_rmt_read ( i2cextend_t * ctx,
uint8_t rmt_slave_addr,
uint8_t reg )

Generic read data in Remote Mode function.

Function read a byte of data from the targeted 8-bit register address of the click board connected to the I2c Extend click in Remote Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]rmt_slave_addr: 7-bit slave address.
[in]reg: 8-bit register address.
Returns
8-bit read data.

◆ i2cextend_rmt_write()

void i2cextend_rmt_write ( i2cextend_t * ctx,
uint8_t rmt_slave_addr,
uint8_t reg,
uint8_t tx_data )

Generic write data in Remote Mode function.

Function writes a byte of data to the targeted 8-bit register address of the click board connected to the I2c Extend click in Remote Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]rmt_slave_addr: 7-bit slave address.
[in]reg: 8-bit register address.
[in]tx_data: Data to be written.
Returns
Nothing.

◆ i2cextend_set_config()

void i2cextend_set_config ( i2cextend_t * ctx,
uint8_t intr_mode,
uint8_t ctrl_sel )

Set the configuration function.

Function set configuration of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]intr_mode: Internal slave interrupt behavior.
[in]ctrl_sel: CTRL settings:
Returns
Nothing.

◆ i2cextend_set_cs()

void i2cextend_set_cs ( i2cextend_t * ctx,
uint8_t en_cs )

Set CS pin state function.

Function set CS pin state of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]en_cs: CS pin state.
Returns
Nothing.

◆ i2cextend_set_on()

void i2cextend_set_on ( i2cextend_t * ctx,
uint8_t on_state )

Set ON pin state function.

Function set ON pin state of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]on_state: ON pin state.
Returns
Nothing.

◆ i2cextend_set_out_ctrl()

void i2cextend_set_out_ctrl ( i2cextend_t * ctx,
uint8_t out_ctrl )

Set out CTRL function.

Function set output value of the remote CTRL pin of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]out_ctrl: Output value of the remote CTRL.
Returns
Nothing.

◆ i2cextend_set_out_slave_address()

void i2cextend_set_out_slave_address ( i2cextend_t * ctx,
uint8_t out_slave_address )

Set out slave address function.

Function output slave address, incoming 7-bit I2C addresses are translated to the remote network by: out_slave_address = i2c_trans XOR in_slave_address of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]out_slave_address: 7-bit out slave address.
Returns
Nothing.

◆ i2cextend_set_rst()

void i2cextend_set_rst ( i2cextend_t * ctx,
uint8_t en_rst )

Set RTS pin state function.

Function set RTS pin state of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]en_rst: RST pin state.
Returns
Nothing.

◆ i2cextend_status()

void i2cextend_status ( i2cextend_t * ctx,
i2cextend_status_data_t * status_data )

Check the status function.

Function read status register and update status data structe of I2c Extend click in Local Mode.

Parameters
[in]ctx: Click context object. See i2cextend_t object definition for detailed explanation.
[in]status_data: Pointer to the memory location where data be stored.
Returns
Nothing.