mikroSDK Reference Manual
hal_i2c_master_config_t Struct Reference

I2C Master HAL init configuration structure, consisted of the following fields : More...

Data Fields

uint8_t addr
 
hal_pin_name_t sda
 
hal_pin_name_t scl
 
uint32_t speed
 
uint16_t timeout_pass_count
 

Detailed Description

User needs to specify values herein.

Note
Take into consideration that any value can be changed explicitly by the user.
Warning
The following example includes pins mapping. Take into consideration that different hardware might not have the same pins. Make sure to accommodate pin name based on your hardware specifics.

Example

// I2C Master HAL driver configuration structure
static hal_i2c_master_config_t hal_i2c_master_cfg;
// Fill structure with default values
hal_i2c_master_configure_default(&hal_i2c_master_cfg);
// Specify desired SCL pin
hal_i2c_master_cfg.scl = PB3;
// Specify desired SDA pin
hal_i2c_master_cfg.sda = PB4;

Field Documentation

◆ addr

uint8_t hal_i2c_master_config_t::addr

Slave address.

◆ sda

hal_pin_name_t hal_i2c_master_config_t::sda

SDA pin.

◆ scl

hal_pin_name_t hal_i2c_master_config_t::scl

SCL pin.

◆ speed

uint32_t hal_i2c_master_config_t::speed

I2C transmission rate. See hal_i2c_master_speed_t for valid values.

◆ timeout_pass_count

uint16_t hal_i2c_master_config_t::timeout_pass_count

I2C timeout value ( number of retries for each operation ). See hal_i2c_master_timeout_t for valid values.

hal_i2c_master_config_t::scl
hal_pin_name_t scl
Definition: hal_i2c_master.h:129
hal_i2c_master_config_t::sda
hal_pin_name_t sda
Definition: hal_i2c_master.h:128
hal_i2c_master_config_t
I2C Master HAL init configuration structure, consisted of the following fields :
Definition: hal_i2c_master.h:124
hal_i2c_master_configure_default
void hal_i2c_master_configure_default(hal_i2c_master_config_t *config)
Configure I2C Master HAL configuration structure.