![]() |
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... | |
Driver for the Simple IIC on SCI.
This module supports the SCI in I2C mode. It implements the following interfaces:
| 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.
| SSP_SUCCESS | Device closed without issue. |
| SSP_ERR_ASSERTION | The parameter p_ctrl is NULL. |
| SSP_ERR_ABORTED | Device was closed while a transfer was in-progress. |
| SSP_ERR_NOT_OPEN | Device was not even opened. |
Abort an in-progress transfer with this device only
The device is now considered closed
De-configure everything.
| 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.
| SSP_SUCCESS | Requested baud rate was valid. |
| SSP_ERR_ASSERTION | The parameter p_ctrl or p_cfg is NULL or if clock rate greater than 400KHz. |
| SSP_ERR_INVALID_RATE | The requested rate cannot be set. |
| SSP_ERR_IN_USE | Lock was not acquired |
| SSP_ERR_IRQ_BSP_DISABLED | Event information could not be found. |
Disable, clear and configure interrupts
Open the hardware in master mode
| 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.
| SSP_SUCCESS | Function executed without issue. |
| SSP_ERR_ASSERTION | The parameter p_ctrl, p_dest is NULL, bytes is 0. |
| SSP_ERR_INVALID_SIZE | Provided number of bytes more than uint16_t size(65535) while DTC is used for data transfer. |
| SSP_ERR_IN_USE | Another transfer was in-progress. |
| SSP_ERR_NOT_OPEN | Device was not even opened. |
Record the new information about this transfer
Handle the different addressing modes
Kickoff the read operation as a master
| 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.
| SSP_SUCCESS | Channel was reset without issue. |
| SSP_ERR_ASSERTION | p_ctrl is NULL. |
| SSP_ERR_ABORTED | A transfer was aborted while resetting the hardware. |
| SSP_ERR_NOT_OPEN | Device was not even opened. |
Abort any transfer happening on the channel
| 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.
| SSP_SUCCESS | Address of the slave is set correctly. |
| SSP_ERR_ASSERTION | p_ctrl or address is NULL. |
| SSP_ERR_IN_USE | Another transfer was in-progress. |
| SSP_ERR_NOT_OPEN | Device was not even opened. |
Sets the address of the slave device
Sets the mode of addressing
| ssp_err_t R_SCI_SIIC_MasterVersionGet | ( | ssp_version_t *const | p_version | ) |
Sets driver version based on compile time macros.
| SSP_SUCCESS | Successful version get. |
| SSP_ERR_ASSERTION | The parameter p_version is NULL. |
Verify parameter is valid
| 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.
| SSP_SUCCESS | Function executed without issue. |
| SSP_ERR_ASSERTION | p_ctrl, p_src is NULL. |
| SSP_ERR_INVALID_SIZE | Provided number of bytes more than uint16_t size(65535) while DTC is used for data transfer. |
| SSP_ERR_IN_USE | Another transfer was in-progress. |
| SSP_ERR_NOT_OPEN | Device was not even opened. |
Record the new information about this transfer
Handle the different addressing modes
Kickoff the write operation as a master