Synergy Software Package User's Manual

Driver for the I2C Bus Slave Interface (IIC Slave). More...

Data Structures

struct  riic_slave_instance_ctrl_t
 

Macros

#define RIIC_SLAVE_ERROR_RETURN(a, err)   SSP_ERROR_RETURN((a), (err), &g_module_name[0], &g_riic_slave_version)
 
#define RIIC_SLAVE_OPEN   (0x49324353ULL)
 

Functions

ssp_err_t R_RIIC_SlaveVersionGet (ssp_version_t *const p_version)
 Gets version information and stores it in the provided version struct. More...
 
ssp_err_t R_RIIC_SlaveOpen (i2c_ctrl_t *const p_api_ctrl, i2c_cfg_t const *const p_cfg)
 Opens the I2C device. May power on IIC peripheral and perform initialization described in hardware manual. More...
 
ssp_err_t R_RIIC_SlaveClose (i2c_ctrl_t *const p_api_ctrl)
 Closes the I2C device. Power down IIC peripheral. More...
 
ssp_err_t R_RIIC_MasterWriteSlaveRead (i2c_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const bytes)
 Performs a read from the I2C Master device. More...
 
ssp_err_t R_RIIC_MasterReadSlaveWrite (i2c_ctrl_t *const p_api_ctrl, uint8_t *const p_src, uint32_t const bytes)
 Performs a write to the I2C Master device. More...
 

Variables

i2c_api_slave_t const g_i2c_slave_on_riic
 

Detailed Description

Driver for the I2C Bus Slave Interface (IIC Slave).

This module supports the Renesas Inter-Integrated Circuit (IIC) peripheral. It implements the following interfaces:

Macro Definition Documentation

◆ RIIC_SLAVE_ERROR_RETURN

#define RIIC_SLAVE_ERROR_RETURN (   a,
  err 
)    SSP_ERROR_RETURN((a), (err), &g_module_name[0], &g_riic_slave_version)

Macro for error logger.

◆ RIIC_SLAVE_OPEN

#define RIIC_SLAVE_OPEN   (0x49324353ULL)

"I2CS" in ASCII, used to determine if channel is open.

Function Documentation

◆ R_RIIC_MasterReadSlaveWrite()

ssp_err_t R_RIIC_MasterReadSlaveWrite ( i2c_ctrl_t *const  p_api_ctrl,
uint8_t *const  p_src,
uint32_t const  bytes 
)

Performs a write to the I2C Master 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; if no callback was provided, the process was kicked off
SSP_ERR_ASSERTIONp_api_ctrl or p_src is NULL.
SSP_ERR_IN_USEAnother transfer was in progress.
SSP_ERR_NOT_OPENdevice is not open.
SSP_ERR_ABORTEDIf transaction encounter an error.

Check if the device is open, return an error if not

Return an error if transfer is in progress

Record the new information about this transfer

Start the write operation as a slave

◆ R_RIIC_MasterWriteSlaveRead()

ssp_err_t R_RIIC_MasterWriteSlaveRead ( i2c_ctrl_t *const  p_api_ctrl,
uint8_t *const  p_dest,
uint32_t const  bytes 
)

Performs a read from the I2C Master 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; if no callback was provided, the process was kicked off
SSP_ERR_ASSERTIONp_api_ctrl, bytes or p_dest is NULL.
SSP_ERR_IN_USEAnother transfer was in progress.
SSP_ERR_NOT_OPENdevice is not open.
SSP_ERR_ABORTEDIf transaction encounter an error.

Check if the device is open, return an error if not

Return an error if transfer is in progress.

Record the new information about this transfer

Start the read operation as a slave

◆ R_RIIC_SlaveClose()

ssp_err_t R_RIIC_SlaveClose ( i2c_ctrl_t *const  p_api_ctrl)

Closes the I2C device. Power down IIC peripheral.

Return values
SSP_SUCCESSDevice closed without issue.
SSP_ERR_NOT_OPENDevice not opened.
SSP_ERR_ASSERTIONp_api_ctrl is NULL.
SSP_ERR_ABORTEDDevice was closed while a transfer was in progress.

Check if the device is even open, return an error if not

De-configure everything.

◆ R_RIIC_SlaveOpen()

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

Opens the I2C device. May power on IIC peripheral and perform initialization described in hardware manual.

Return values
SSP_SUCCESSOpened identical configuration of already open instance.
SSP_ERR_ASSERTIONp_api_ctrl or p_cfg is NULL.
SSP_ERR_IN_USEAttempted to open an already open device instance.
SSP_ERR_IRQ_BSP_DISABLEDInterrupt does not exist in the vector table.
SSP_ERR_INVALID_ARGUMENTIf fast mode plus is configured and the channel does not support it
Returns
See Common Error Codes for other possible return codes. This function calls

If rate is configured as Fast mode plus, check whether the channel supports it

Attempt to acquire hardware lock

Open the hardware in slave mode

Clear all interrupt bits

Enable both TXI and RXI interrupt sources

Set ACK as slave is now ready to serve requests from master

Enable all RIIC interrupts in NVIC, that need to be serviced

Release hardware lock on failure

◆ R_RIIC_SlaveVersionGet()

ssp_err_t R_RIIC_SlaveVersionGet ( ssp_version_t *const  p_version)

Gets version information and stores it in the provided version struct.

Return values
SSP_SUCCESSSuccessful version get.
SSP_ERR_ASSERTIONp_version is NULL.

Variable Documentation

◆ g_i2c_slave_on_riic

i2c_api_slave_t const g_i2c_slave_on_riic
Initial value:
=
{
.masterWriteSlaveRead = R_RIIC_MasterWriteSlaveRead,
.masterReadSlaveWrite = R_RIIC_MasterReadSlaveWrite,
.versionGet = R_RIIC_SlaveVersionGet
}

RIIC Implementation of I2C device slave interface