Synergy Software Package User's Manual

Driver for the Simple IIC on SCI. More...

Data Structures

struct  sci_i2c_instance_ctrl_t
 
struct  sci_i2c_extended_cfg
 

Functions

ssp_err_t R_SCI_SIIC_MasterVersionGet (ssp_version_t *const p_version)
 Sets driver version based on compile time macros. More...
 
ssp_err_t R_SCI_SIIC_MasterOpen (i2c_ctrl_t *const p_api_ctrl, i2c_cfg_t const *const p_cfg)
 Opens the I2C device. Power on I2C peripheral and perform initialization described in hardware manual. More...
 
ssp_err_t R_SCI_SIIC_MasterClose (i2c_ctrl_t *const p_api_ctrl)
 Closes the I2C device. Power down I2C peripheral. More...
 
ssp_err_t R_SCI_SIIC_MasterRead (i2c_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const bytes, bool const restart)
 Performs a read from the I2C device. More...
 
ssp_err_t R_SCI_SIIC_MasterWrite (i2c_ctrl_t *const p_api_ctrl, uint8_t *const p_src, uint32_t const bytes, bool const restart)
 Performs a write to the I2C device. More...
 
ssp_err_t R_SCI_SIIC_MasterReset (i2c_ctrl_t *const p_api_ctrl)
 Aborts any in-progress transfer and forces the I2C peripheral into a ready state. More...
 
ssp_err_t R_SCI_SIIC_MasterSlaveAddressSet (i2c_ctrl_t *const p_api_ctrl, uint16_t const slave, i2c_addr_mode_t const addr_mode)
 Sets address and addressing mode of the slave device. More...
 

Detailed Description

Driver for the Simple IIC on SCI.

This module supports the SCI in I2C mode. It implements the following interfaces:

Function Documentation

◆ R_SCI_SIIC_MasterClose()

ssp_err_t R_SCI_SIIC_MasterClose ( i2c_ctrl_t *const  p_api_ctrl)

Closes the I2C device. Power down I2C peripheral.

This function will safely terminate any in-progress I2C transfer with the device. If a transfer is aborted, the user will be notified via callback with an abort event. Since the callback is optional, this function will also return a specific error code in this situation.

Return values
SSP_SUCCESSDevice closed without issue.
SSP_ERR_ASSERTIONThe parameter p_ctrl is NULL.
SSP_ERR_ABORTEDDevice was closed while a transfer was in-progress.
SSP_ERR_NOT_OPENDevice was not even opened.

Abort an in-progress transfer with this device only

The device is now considered closed

De-configure everything.

◆ R_SCI_SIIC_MasterOpen()

ssp_err_t R_SCI_SIIC_MasterOpen ( i2c_ctrl_t *const  p_api_ctrl,
i2c_cfg_t const *const  p_cfg 
)

Opens the I2C device. Power on I2C peripheral and perform initialization described in hardware manual.

This function will reconfigure the clock settings of the peripheral when a device with a lower rate than previously configured is opened.

Return values
SSP_SUCCESSRequested baud rate was valid.
SSP_ERR_ASSERTIONThe parameter p_ctrl or p_cfg is NULL or if clock rate greater than 400KHz.
SSP_ERR_INVALID_RATEThe requested rate cannot be set.
SSP_ERR_IN_USELock was not acquired
SSP_ERR_IRQ_BSP_DISABLEDEvent information could not be found.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

Disable, clear and configure interrupts

Open the hardware in master mode

◆ R_SCI_SIIC_MasterRead()

ssp_err_t R_SCI_SIIC_MasterRead ( i2c_ctrl_t *const  p_api_ctrl,
uint8_t *const  p_dest,
uint32_t const  bytes,
bool const  restart 
)

Performs a read from the I2C device.

This function will fail if there is already an in-progress I2C transfer on the associated channel. Otherwise, the I2C read operation will begin. When no callback is provided by the user, this function performs a blocking read. Otherwise, the read operation is non-blocking and the caller will be notified when the operation has finished by an I2C_EVENT_RX_COMPLETE in the callback.

Return values
SSP_SUCCESSFunction executed without issue.
SSP_ERR_ASSERTIONThe parameter p_ctrl, p_dest is NULL, bytes is 0.
SSP_ERR_INVALID_SIZEProvided number of bytes more than uint16_t size(65535) while DTC is used for data transfer.
SSP_ERR_IN_USEAnother transfer was in-progress.
SSP_ERR_NOT_OPENDevice was not even opened.

Record the new information about this transfer

Handle the different addressing modes

Kickoff the read operation as a master

◆ R_SCI_SIIC_MasterReset()

ssp_err_t R_SCI_SIIC_MasterReset ( i2c_ctrl_t *const  p_api_ctrl)

Aborts any in-progress transfer and forces the I2C peripheral into a ready state.

This function will safely terminate any in-progress I2C transfer with the device. If a transfer is aborted, the user will be notified via callback with an abort event. Since the callback is optional, this function will also return a specific error code in this situation.

Return values
SSP_SUCCESSChannel was reset without issue.
SSP_ERR_ASSERTIONp_ctrl is NULL.
SSP_ERR_ABORTEDA transfer was aborted while resetting the hardware.
SSP_ERR_NOT_OPENDevice was not even opened.

Abort any transfer happening on the channel

◆ R_SCI_SIIC_MasterSlaveAddressSet()

ssp_err_t R_SCI_SIIC_MasterSlaveAddressSet ( i2c_ctrl_t *const  p_api_ctrl,
uint16_t const  slave,
i2c_addr_mode_t const  addr_mode 
)

Sets address and addressing mode of the slave device.

This function is used to set the device address and addressing mode of the slave without reconfiguring the entire bus.

Return values
SSP_SUCCESSAddress of the slave is set correctly.
SSP_ERR_ASSERTIONp_ctrl or address is NULL.
SSP_ERR_IN_USEAnother transfer was in-progress.
SSP_ERR_NOT_OPENDevice was not even opened.

Sets the address of the slave device

Sets the mode of addressing

◆ R_SCI_SIIC_MasterVersionGet()

ssp_err_t R_SCI_SIIC_MasterVersionGet ( ssp_version_t *const  p_version)

Sets driver version based on compile time macros.

Return values
SSP_SUCCESSSuccessful version get.
SSP_ERR_ASSERTIONThe parameter p_version is NULL.

Verify parameter is valid

◆ R_SCI_SIIC_MasterWrite()

ssp_err_t R_SCI_SIIC_MasterWrite ( i2c_ctrl_t *const  p_api_ctrl,
uint8_t *const  p_src,
uint32_t const  bytes,
bool const  restart 
)

Performs a write to the I2C device.

This function will fail if there is already an in-progress I2C transfer on the associated channel. Otherwise, the I2C write operation will begin. When no callback is provided by the user, this function performs a blocking write. Otherwise, the write operation is non-blocking and the caller will be notified when the operation has finished by an I2C_EVENT_TX_COMPLETE in the callback.

Return values
SSP_SUCCESSFunction executed without issue.
SSP_ERR_ASSERTIONp_ctrl, p_src is NULL.
SSP_ERR_INVALID_SIZEProvided number of bytes more than uint16_t size(65535) while DTC is used for data transfer.
SSP_ERR_IN_USEAnother transfer was in-progress.
SSP_ERR_NOT_OPENDevice was not even opened.

Record the new information about this transfer

Handle the different addressing modes

Kickoff the write operation as a master