RA Flexible Software Package Documentation
Release v5.6.0
|
|
Interface for I2C master communication.
The I2C master interface provides a common API for I2C HAL drivers. The I2C master interface supports:
Data Structures | |
struct | i2c_master_callback_args_t |
struct | i2c_master_status_t |
struct | i2c_master_cfg_t |
struct | i2c_master_api_t |
struct | i2c_master_instance_t |
Typedefs | |
typedef void | i2c_master_ctrl_t |
Enumerations | |
enum | i2c_master_rate_t |
enum | i2c_master_addr_mode_t |
enum | i2c_master_event_t |
struct i2c_master_callback_args_t |
I2C callback parameter definition
Data Fields | ||
---|---|---|
void const * | p_context | Pointer to user-provided context. |
i2c_master_event_t | event | Event code. |
struct i2c_master_cfg_t |
I2C configuration block
Data Fields | |
uint8_t | channel |
Identifier recognizable by implementation. More... | |
i2c_master_rate_t | rate |
Device's maximum clock rate from enum i2c_rate_t. | |
uint32_t | slave |
The address of the slave device. | |
i2c_master_addr_mode_t | addr_mode |
Indicates how slave fields should be interpreted. | |
uint8_t | ipl |
Interrupt priority level. Same for RXI, TXI, TEI and ERI. | |
IRQn_Type | rxi_irq |
Receive IRQ number. | |
IRQn_Type | txi_irq |
Transmit IRQ number. | |
IRQn_Type | tei_irq |
Transmit end IRQ number. | |
IRQn_Type | eri_irq |
Error IRQ number. | |
transfer_instance_t const * | p_transfer_tx |
Transfer instance for I2C transmit. Set to NULL if unused. More... | |
transfer_instance_t const * | p_transfer_rx |
Transfer instance for I2C receive. Set to NULL if unused. | |
void(* | p_callback )(i2c_master_callback_args_t *p_args) |
Pointer to callback function. More... | |
void const * | p_context |
Pointer to the user-provided context. | |
void const * | p_extend |
Any configuration data needed by the hardware. More... | |
uint8_t i2c_master_cfg_t::channel |
Identifier recognizable by implementation.
Generic configuration
transfer_instance_t const* i2c_master_cfg_t::p_transfer_tx |
Transfer instance for I2C transmit. Set to NULL if unused.
Transfer API support
void(* i2c_master_cfg_t::p_callback) (i2c_master_callback_args_t *p_args) |
Pointer to callback function.
Parameters to control software behavior
void const* i2c_master_cfg_t::p_extend |
Any configuration data needed by the hardware.
Implementation-specific configuration
struct i2c_master_api_t |
Interface definition for I2C access as master
Data Fields | |
fsp_err_t(* | open )(i2c_master_ctrl_t *const p_ctrl, i2c_master_cfg_t const *const p_cfg) |
fsp_err_t(* | read )(i2c_master_ctrl_t *const p_ctrl, uint8_t *const p_dest, uint32_t const bytes, bool const restart) |
fsp_err_t(* | write )(i2c_master_ctrl_t *const p_ctrl, uint8_t *const p_src, uint32_t const bytes, bool const restart) |
fsp_err_t(* | abort )(i2c_master_ctrl_t *const p_ctrl) |
fsp_err_t(* | slaveAddressSet )(i2c_master_ctrl_t *const p_ctrl, uint32_t const slave, i2c_master_addr_mode_t const addr_mode) |
fsp_err_t(* | callbackSet )(i2c_master_ctrl_t *const p_ctrl, void(*p_callback)(i2c_master_callback_args_t *), void const *const p_context, i2c_master_callback_args_t *const p_callback_memory) |
fsp_err_t(* | statusGet )(i2c_master_ctrl_t *const p_ctrl, i2c_master_status_t *p_status) |
fsp_err_t(* | close )(i2c_master_ctrl_t *const p_ctrl) |
fsp_err_t(* i2c_master_api_t::open) (i2c_master_ctrl_t *const p_ctrl, i2c_master_cfg_t const *const p_cfg) |
Opens the I2C Master driver and initializes the hardware.
[in] | p_ctrl | Pointer to control block. Must be declared by user. Elements are set here. |
[in] | p_cfg | Pointer to configuration structure. |
fsp_err_t(* i2c_master_api_t::read) (i2c_master_ctrl_t *const p_ctrl, uint8_t *const p_dest, uint32_t const bytes, bool const restart) |
Performs a read operation on an I2C Master device.
[in] | p_ctrl | Pointer to control block set in i2c_master_api_t::open call. |
[in] | p_dest | Pointer to the location to store read data. |
[in] | bytes | Number of bytes to read. |
[in] | restart | Specify if the restart condition should be issued after reading. |
fsp_err_t(* i2c_master_api_t::write) (i2c_master_ctrl_t *const p_ctrl, uint8_t *const p_src, uint32_t const bytes, bool const restart) |
Performs a write operation on an I2C Master device.
[in] | p_ctrl | Pointer to control block set in i2c_master_api_t::open call. |
[in] | p_src | Pointer to the location to get write data from. |
[in] | bytes | Number of bytes to write. |
[in] | restart | Specify if the restart condition should be issued after writing. |
fsp_err_t(* i2c_master_api_t::abort) (i2c_master_ctrl_t *const p_ctrl) |
Performs a reset of the peripheral.
[in] | p_ctrl | Pointer to control block set in i2c_master_api_t::open call. |
fsp_err_t(* i2c_master_api_t::slaveAddressSet) (i2c_master_ctrl_t *const p_ctrl, uint32_t const slave, i2c_master_addr_mode_t const addr_mode) |
Sets address of the slave device without reconfiguring the bus.
[in] | p_ctrl | Pointer to control block set in i2c_master_api_t::open call. |
[in] | slave_address | Address of the slave device. |
[in] | address_mode | Addressing mode. |
fsp_err_t(* i2c_master_api_t::callbackSet) (i2c_master_ctrl_t *const p_ctrl, void(*p_callback)(i2c_master_callback_args_t *), void const *const p_context, i2c_master_callback_args_t *const p_callback_memory) |
Specify callback function and optional context pointer and working memory pointer.
[in] | p_ctrl | Pointer to the IIC Master control block. |
[in] | p_callback | Callback function |
[in] | p_context | Pointer to send to callback function |
[in] | p_working_memory | Pointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback. |
fsp_err_t(* i2c_master_api_t::statusGet) (i2c_master_ctrl_t *const p_ctrl, i2c_master_status_t *p_status) |
Gets the status of the configured I2C device.
[in] | p_ctrl | Pointer to the IIC Master control block. |
[out] | p_status | Pointer to store current status. |
fsp_err_t(* i2c_master_api_t::close) (i2c_master_ctrl_t *const p_ctrl) |
Closes the driver and releases the I2C Master device.
[in] | p_ctrl | Pointer to control block set in i2c_master_api_t::open call. |
struct i2c_master_instance_t |
This structure encompasses everything that is needed to use an instance of this interface.
Data Fields | ||
---|---|---|
i2c_master_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
i2c_master_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
i2c_master_api_t const * | p_api | Pointer to the API structure for this instance. |
typedef void i2c_master_ctrl_t |
I2C control block. Allocate an instance specific control block to pass into the I2C API calls.
enum i2c_master_rate_t |
enum i2c_master_event_t |
Callback events