i2ctocan 2.0.0.0
I2C to CAN Click Driver

API for configuring and manipulating I2C to CAN Click driver. More...

Topics

 I2C to CAN Registers Settings
 Settings for registers of I2C to CAN Click driver.
 
 I2C to CAN MikroBUS Map
 MikroBUS pin mapping of I2C to CAN Click driver.
 

Functions

void i2ctocan_cfg_setup (i2ctocan_cfg_t *cfg)
 I2C to CAN configuration object setup function.
 
err_t i2ctocan_init (i2ctocan_t *ctx, i2ctocan_cfg_t *cfg)
 I2C to CAN initialization function.
 
err_t i2ctocan_default_cfg (i2ctocan_t *ctx)
 I2C to CAN default configuration function.
 
err_t i2ctocan_enable_device (i2ctocan_t *ctx)
 I2C to CAN enable the device function.
 
err_t i2ctocan_shutdown (i2ctocan_t *ctx)
 I2C to CAN shutdown the device function.
 
err_t i2ctocan_set_slave_address (i2ctocan_t *ctx, uint8_t slave_addr)
 Set I2C Slave address function.
 
err_t i2ctocan_generic_write (i2ctocan_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 I2C to CAN I2C writing function.
 
err_t i2ctocan_generic_read (i2ctocan_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 I2C to CAN I2C reading function.
 

Detailed Description

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

◆ i2ctocan_cfg_setup()

void i2ctocan_cfg_setup ( i2ctocan_cfg_t * cfg)

I2C to CAN configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ i2ctocan_default_cfg()

err_t i2ctocan_default_cfg ( i2ctocan_t * ctx)

I2C to CAN default configuration function.

This function executes a default configuration of I2C to CAN click board.

Parameters
[in]ctx: Click context object. See i2ctocan_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.

◆ i2ctocan_enable_device()

err_t i2ctocan_enable_device ( i2ctocan_t * ctx)

I2C to CAN enable the device function.

This function enable the LT3960, I2C to CAN-Physical Transceiver on the I2C to CAN click boardâ„¢.

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

◆ i2ctocan_generic_read()

err_t i2ctocan_generic_read ( i2ctocan_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

I2C to CAN 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 i2ctocan_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ i2ctocan_generic_write()

err_t i2ctocan_generic_write ( i2ctocan_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

I2C to CAN 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 i2ctocan_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ i2ctocan_init()

err_t i2ctocan_init ( i2ctocan_t * ctx,
i2ctocan_cfg_t * cfg )

I2C to CAN initialization function.

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

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

◆ i2ctocan_set_slave_address()

err_t i2ctocan_set_slave_address ( i2ctocan_t * ctx,
uint8_t slave_addr )

Set I2C Slave address function.

Sets I2C address of the subordinate I2C device to address which is targeted by read and write operations.

Parameters
[in]ctx: Click context object. See i2ctocan_t object definition for detailed explanation.
[in]addressSpecified I2C slave address.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
It is recommended to check return value for error.

◆ i2ctocan_shutdown()

err_t i2ctocan_shutdown ( i2ctocan_t * ctx)

I2C to CAN shutdown the device function.

This function turn off the LT3960, I2C to CAN-Physical Transceiver on the I2C to CAN click boardâ„¢.

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