API  2.2
TSmarT Software Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions

Functions

void TSMART_I2C_ConfigInit (tsmart_i2c_config_t *TSMART_I2C_config)
 Writes a default configuration for I2C. More...
 
int8_t TSMART_I2C_Init (tsmart_i2c_t *TSMART_I2C)
 Initialize the I2C bus. More...
 
int8_t TSMART_I2C_SlaveInit (tsmart_i2c_t *TSMART_I2C, tsmart_i2c_config_t tsmart_i2c_config)
 Initialize the I2C bus in Slave Mode. More...
 
int8_t TSMART_I2C_ReadDeviceRegister (tsmart_i2c_t *TSMART_I2C, tsmart_i2c_config_t *TSMART_I2C_cfg, uint8_t TSMART_I2C_DeviceAddr, uint8_t TSMART_I2C_RegisterAddr, uint8_t *TSMART_I2C_buf, portTickType TSMART_I2C_xticks)
 Reads several consecutive registers. More...
 
int8_t TSMART_I2C_ReadDeviceRegisters (tsmart_i2c_t *TSMART_I2C, tsmart_i2c_config_t *TSMART_I2C_cfg, uint8_t TSMART_I2C_DeviceAddr, uint8_t TSMART_I2C_RegisterAddr, uint8_t TSMART_I2C_num_reg, uint8_t *TSMART_I2C_buf, portTickType TSMART_I2C_xticks)
 Reads several consecutive registers. More...
 
int8_t TSMART_I2C_WriteDeviceRegister (tsmart_i2c_t *TSMART_I2C, tsmart_i2c_config_t *TSMART_I2C_cfg, uint8_t TSMART_I2C_DeviceAddr, uint8_t TSMART_I2C_RegisterAddr, uint8_t TSMART_I2C_RegisterValue, portTickType TSMART_I2C_xticks)
 Writes on register. More...
 
int8_t TSMART_I2C_WriteDeviceRegisters (tsmart_i2c_t *TSMART_I2C, tsmart_i2c_config_t *TSMART_I2C_cfg, uint8_t TSMART_I2C_DeviceAddr, uint8_t TSMART_I2C_RegisterAddr, uint8_t *TSMART_I2C_RegistersValues, uint8_t TSMART_I2C_num_reg, portTickType TSMART_I2C_xticks)
 Writes on registers. More...
 

Detailed Description

Function Documentation

void TSMART_I2C_ConfigInit ( tsmart_i2c_config_t TSMART_I2C_config)

Writes a default configuration for I2C.

Parameters
TSMART_I2C_configConfiguration to be filled (output parameter)
Examples:
i2c_slave.c.
int8_t TSMART_I2C_Init ( tsmart_i2c_t TSMART_I2C)

Initialize the I2C bus.

This functions initializes the hardware configuration of the selected I2C bus and the associated OS mechanisms.

Note
The I2C2 Bus is incompatible with Ethernet Hardware
Parameters
TSMART_I2CI2C structure handler.
Returns
  • TSMART_PASS - OK
Examples:
db_i2c.c, i2c.c, i2c_master.c, and i2c_slave.c.
int8_t TSMART_I2C_ReadDeviceRegister ( tsmart_i2c_t TSMART_I2C,
tsmart_i2c_config_t TSMART_I2C_cfg,
uint8_t  TSMART_I2C_DeviceAddr,
uint8_t  TSMART_I2C_RegisterAddr,
uint8_t *  TSMART_I2C_buf,
portTickType  TSMART_I2C_xticks 
)

Reads several consecutive registers.

Reads registers in a remote device using the I2C bus.

Parameters
TSMART_I2CI2C structure handler.
TSMART_I2C_cfgIndicates the mode of operation, clock speed, duty cycle, host address, ACK mode and ACK address.
TSMART_I2C_DeviceAddrI2C device address.
TSMART_I2C_RegisterAddrI2C Device register.
TSMART_I2C_bufData buffer to store data.
TSMART_I2C_xticksMaximum waiting timeout
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Failure
Examples:
i2c_master.c.
int8_t TSMART_I2C_ReadDeviceRegisters ( tsmart_i2c_t TSMART_I2C,
tsmart_i2c_config_t TSMART_I2C_cfg,
uint8_t  TSMART_I2C_DeviceAddr,
uint8_t  TSMART_I2C_RegisterAddr,
uint8_t  TSMART_I2C_num_reg,
uint8_t *  TSMART_I2C_buf,
portTickType  TSMART_I2C_xticks 
)

Reads several consecutive registers.

Reads registers in a remote device using the I2C bus.

Parameters
TSMART_I2CI2C structure handler.
TSMART_I2C_cfgIndicates the mode of operation, clock speed, duty cycle, host address, ACK mode and ACK address.
TSMART_I2C_DeviceAddrI2C device address.
TSMART_I2C_RegisterAddrI2C Device register.
TSMART_I2C_num_regNumber of register to read.
TSMART_I2C_bufData buffer to store data.
TSMART_I2C_xticksMaximum waiting timeout
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Failure
Examples:
db_i2c.c, i2c.c, and i2c_master.c.
int8_t TSMART_I2C_SlaveInit ( tsmart_i2c_t TSMART_I2C,
tsmart_i2c_config_t  tsmart_i2c_config 
)

Initialize the I2C bus in Slave Mode.

This functions initializes the hardware configuration of the selected I2C bus and the associated OS mechanisms to work in Slave Mode.

Note
The I2C2 Bus is incompatible with Ethernet Hardware
Parameters
TSMART_I2CI2C structure handler.
tsmart_i2c_configIndicates the mode of operation, clock speed, duty cycle, host address, ACK mode and ACK address.
Returns
  • TSMART_PASS - OK
Examples:
i2c_slave.c.
int8_t TSMART_I2C_WriteDeviceRegister ( tsmart_i2c_t TSMART_I2C,
tsmart_i2c_config_t TSMART_I2C_cfg,
uint8_t  TSMART_I2C_DeviceAddr,
uint8_t  TSMART_I2C_RegisterAddr,
uint8_t  TSMART_I2C_RegisterValue,
portTickType  TSMART_I2C_xticks 
)

Writes on register.

Writes one register in a remote device using the I2C bus.

Parameters
TSMART_I2CI2C structure handler.
TSMART_I2C_cfgIndicates the mode of operation, clock speed, duty cycle, host address, ACK mode and ACK address.
TSMART_I2C_DeviceAddrI2C device address.
TSMART_I2C_RegisterAddrI2C Device register.
TSMART_I2C_RegisterValueData to write
TSMART_I2C_xticksMaximum waiting timeout.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Failure
Examples:
db_i2c.c, i2c.c, and i2c_master.c.
int8_t TSMART_I2C_WriteDeviceRegisters ( tsmart_i2c_t TSMART_I2C,
tsmart_i2c_config_t TSMART_I2C_cfg,
uint8_t  TSMART_I2C_DeviceAddr,
uint8_t  TSMART_I2C_RegisterAddr,
uint8_t *  TSMART_I2C_RegistersValues,
uint8_t  TSMART_I2C_num_reg,
portTickType  TSMART_I2C_xticks 
)

Writes on registers.

Writes multiple registers in a remote device using the I2C bus.

Parameters
TSMART_I2CI2C structure handler.
TSMART_I2C_cfgIndicates the mode of operation, clock speed, duty cycle, host address, ACK mode and ACK address.
TSMART_I2C_DeviceAddrI2C device address.
TSMART_I2C_RegisterAddrI2C Device register.
TSMART_I2C_RegistersValuesData to write
TSMART_I2C_num_regNumber of register to write.
TSMART_I2C_xticksMaximum waiting timeout.
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Failure
Examples:
i2c_master.c.