44 #ifndef _HAL_I2C_MASTER_H_
45 #define _HAL_I2C_MASTER_H_
322 uint8_t *write_data_buf,
323 size_t len_write_data,
324 uint8_t *read_data_buf,
325 size_t len_read_data);
void hal_i2c_master_configure_default(hal_i2c_master_config_t *config)
Configure I2C Master HAL configuration structure.
Definition: hal_i2c_master.c:341
void hal_i2c_master_set_timeout(handle_t *handle, hal_i2c_master_config_t *config)
Set I2C master timeout value.
Definition: hal_i2c_master.c:377
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.
Definition: hal_i2c_master.c:143
void hal_i2c_master_set_slave_address(handle_t *handle, hal_i2c_master_config_t *config)
Set I2C slave address.
Definition: hal_i2c_master.c:138
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.
Definition: hal_i2c_master.c:248
err_t hal_i2c_master_set_speed(handle_t *handle, hal_i2c_master_config_t *config)
Set I2C master module speed.
Definition: hal_i2c_master.c:352
err_t hal_i2c_master_open(handle_t *handle, bool hal_obj_open_state)
Open the I2C Master HAL object.
Definition: hal_i2c_master.c:88
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.
Definition: hal_i2c_master.c:189
err_t hal_i2c_master_close(handle_t *handle)
Closes I2C Master HAL object.
Definition: hal_i2c_master.c:313
hal_i2c_master_timeout_t
Definition: hal_i2c_master.h:86
@ HAL_I2C_MASTER_TIMEOUT_INIT
I2C HW initialization failed.
Definition: hal_i2c_master.h:92
@ HAL_I2C_MASTER_ARBITRATION_LOST
I2C Master arbitration lost.
Definition: hal_i2c_master.h:91
@ HAL_I2C_MASTER_TIMEOUT_WRITE
I2C bus write failed.
Definition: hal_i2c_master.h:89
@ HAL_I2C_MASTER_TIMEOUT_READ
I2C bus read failed.
Definition: hal_i2c_master.h:90
@ HAL_I2C_MASTER_TIMEOUT_START
Start signal generation failed.
Definition: hal_i2c_master.h:87
@ HAL_I2C_MASTER_TIMEOUT_STOP
Stop signal generation failed.
Definition: hal_i2c_master.h:88
hal_i2c_master_err_t
Definition: hal_i2c_master.h:74
@ HAL_I2C_MASTER_ERROR
Error.
Definition: hal_i2c_master.h:79
@ HAL_I2C_MASTER_MODULE_ERROR
Object wasn't closed.
Definition: hal_i2c_master.h:77
@ HAL_I2C_MASTER_SUCCESS
Success.
Definition: hal_i2c_master.h:75
@ HAL_I2C_MASTER_WRONG_PINS
Wrong pins selected.
Definition: hal_i2c_master.h:76
hal_i2c_master_speed_t
Definition: hal_i2c_master.h:99
@ HAL_I2C_MASTER_SPEED_STANDARD
Speed set at 100K.
Definition: hal_i2c_master.h:100
@ HAL_I2C_MASTER_SPEED_FAST
Speed set at 1M.
Definition: hal_i2c_master.h:102
@ HAL_I2C_MASTER_SPEED_FULL
Speed set at 400K.
Definition: hal_i2c_master.h:101
HAL target macros and typedefs.
uintptr_t handle_t
Definition: hal_target.h:58
int32_t err_t
General error type.
Definition: hal_target.h:77
hal_ll_pin_name_t hal_pin_name_t
Pin type, which is size dependant on the architecture.
Definition: hal_target.h:73
I2C Master HAL init configuration structure, consisted of the following fields :
Definition: hal_i2c_master.h:129
uint32_t speed
I2C transmission rate.
Definition: hal_i2c_master.h:135
uint8_t addr
Slave address.
Definition: hal_i2c_master.h:130
hal_pin_name_t sda
SDA pin.
Definition: hal_i2c_master.h:132
hal_pin_name_t scl
SCL pin.
Definition: hal_i2c_master.h:133
uint16_t timeout_pass_count
I2C timeout value ( number of retries for each operation ).
Definition: hal_i2c_master.h:137
Definition: hal_i2c_master.h:64
handle_t * hal_i2c_master_handle
I2C Master HAL level handle.
Definition: hal_i2c_master.h:65
handle_t * drv_i2c_master_handle
I2C Master DRV level handle.
Definition: hal_i2c_master.h:66
bool init_state
I2C Master HAL object init state.
Definition: hal_i2c_master.h:67
I2C Master HAL context structure, consisted of the following fields :
Definition: hal_i2c_master.h:154
hal_i2c_master_config_t config
I2C Master HAL configuration structure.
Definition: hal_i2c_master.h:156
handle_t handle
I2C Master HAL handle.
Definition: hal_i2c_master.h:155