mikroSDK Reference Manual
hal_i2c_master.h File Reference

Go to the source code of this file.

Data Structures

struct  hal_i2c_master_handle_register_t
 
struct  hal_i2c_master_config_t
 I2C Master HAL init configuration structure, consisted of the following fields : More...
 
struct  hal_i2c_master_t
 I2C Master HAL context structure, consisted of the following fields : More...
 

Enumerations

enum  hal_i2c_master_err_t
 
enum  hal_i2c_master_timeout_t
 
enum  hal_i2c_master_speed_t
 

Functions

void hal_i2c_master_configure_default (hal_i2c_master_config_t *config)
 Configure I2C Master HAL configuration structure. More...
 
err_t hal_i2c_master_open (handle_t *handle, bool hal_obj_open_state)
 Open the I2C Master HAL object. More...
 
err_t hal_i2c_master_set_speed (handle_t *handle, hal_i2c_master_config_t *config)
 Set I2C master module speed. More...
 
void hal_i2c_master_set_timeout (handle_t *handle, hal_i2c_master_config_t *config)
 Set I2C master timeout value. More...
 
void hal_i2c_master_set_slave_address (handle_t *handle, hal_i2c_master_config_t *config)
 Set I2C slave address. More...
 
err_t hal_i2c_master_write (handle_t handle, uint8_t *write_data_buf, size_t len_write_data)
 Write data to the I2C bus. More...
 
err_t hal_i2c_master_read (handle_t handle, uint8_t *read_data_buf, size_t len_read_data)
 Read data from the I2C bus. More...
 
err_t hal_i2c_master_write_then_read (handle_t handle, uint8_t *write_data_buf, size_t len_write_data, uint8_t *read_data_buf, size_t len_read_data)
 Write data followed by read. More...
 
err_t hal_i2c_master_close (handle_t *handle)
 Closes I2C Master HAL object. More...
 

Enumeration Type Documentation

◆ hal_i2c_master_err_t

Return values.

Enumerator
HAL_I2C_MASTER_SUCCESS 

Success.

HAL_I2C_MASTER_WRONG_PINS 

Wrong pins selected.

HAL_I2C_MASTER_MODULE_ERROR 

Object wasn't closed.

HAL_I2C_MASTER_ERROR 

Error.

◆ hal_i2c_master_timeout_t

Predefined enum values for timeout occurrences.

Enumerator
HAL_I2C_MASTER_TIMEOUT_START 

Start signal generation failed.

HAL_I2C_MASTER_TIMEOUT_STOP 

Stop signal generation failed.

HAL_I2C_MASTER_TIMEOUT_WRITE 

I2C bus write failed.

HAL_I2C_MASTER_TIMEOUT_READ 

I2C bus read failed.

HAL_I2C_MASTER_ARBITRATION_LOST 

I2C Master arbitration lost.

HAL_I2C_MASTER_TIMEOUT_INIT 

I2C HW initialization failed.

◆ hal_i2c_master_speed_t

Predefined enum values for I2C transmission rates.

Enumerator
HAL_I2C_MASTER_SPEED_STANDARD 

Speed set at 100K.

HAL_I2C_MASTER_SPEED_FULL 

Speed set at 400K.

HAL_I2C_MASTER_SPEED_FAST 

Speed set at 1M.