#include <ESP32_I2C_master.h>
|
| ESP32_I2C_master (i2c_port_t i2c_num, const i2c_config_t *i2c_conf) |
|
| ~ESP32_I2C_master () |
|
| I2C_master () |
|
| ~I2C_master () |
|
err_t | write (uint8_t address, uint8_t reg, uint8_t *data, size_t data_size) |
| Write data to the I²C bus. More...
|
|
err_t | write (uint8_t address, uint8_t reg, uint8_t data) |
| Write single byte to the I²C bus. More...
|
|
err_t | read (uint8_t address, uint8_t reg, uint8_t *buffer, size_t buffer_size) |
| Read data from I²C slave. More...
|
|
err_t | read (uint8_t address, uint8_t reg, uint8_t &buffer) |
| Read single byte from I²C slave. More...
|
|
err_t | lock (uint8_t i2c_address) |
|
err_t | try_lock (uint8_t i2c_address) |
|
err_t | unlock (uint8_t i2c_address) |
|
|
err_t | _write (uint8_t address, uint8_t reg, uint8_t *data, size_t data_size) override |
|
err_t | _read (uint8_t address, uint8_t reg, uint8_t *buffer, size_t buffer_size) override |
|
Definition at line 13 of file ESP32_I2C_master.h.
◆ ESP32_I2C_master()
ESP32_I2C_master::ESP32_I2C_master |
( |
i2c_port_t |
i2c_num, |
|
|
const i2c_config_t * |
i2c_conf |
|
) |
| |
Definition at line 11 of file ESP32_I2C_master.cpp.
14 ESP_ERROR_CHECK(i2c_driver_install(
i2c_num, I2C_MODE_MASTER, 0, 0, ESP_INTR_FLAG_IRAM));
const i2c_config_t * i2c_conf
i2c_cmd_handle_t i2c_cmd_handler
◆ ~ESP32_I2C_master()
ESP32_I2C_master::~ESP32_I2C_master |
( |
| ) |
|
◆ _read()
err_t ESP32_I2C_master::_read |
( |
uint8_t |
address, |
|
|
uint8_t |
reg, |
|
|
uint8_t * |
buffer, |
|
|
size_t |
buffer_size |
|
) |
| |
|
overrideprivatevirtual |
Implements aruna::driver::I2C_master.
Definition at line 44 of file ESP32_I2C_master.cpp.
47 ESP_ERROR_CHECK(i2c_master_write_byte(
i2c_cmd_handler, (address << 1) | I2C_MASTER_WRITE, I2C_MASTER_ACK));
48 ESP_ERROR_CHECK(i2c_master_write_byte(
i2c_cmd_handler, (uint8_t) reg, I2C_MASTER_ACK));
50 ESP_ERROR_CHECK(i2c_master_write_byte(
i2c_cmd_handler, (address << 1) | I2C_MASTER_READ,
true));
51 ESP_ERROR_CHECK(i2c_master_read(
i2c_cmd_handler, buffer, buffer_size, I2C_MASTER_ACK));
57 case ESP_ERR_INVALID_ARG:
61 case ESP_ERR_INVALID_STATE:
i2c_cmd_handle_t i2c_cmd_handler
◆ _write()
err_t ESP32_I2C_master::_write |
( |
uint8_t |
address, |
|
|
uint8_t |
reg, |
|
|
uint8_t * |
data, |
|
|
size_t |
data_size |
|
) |
| |
|
overrideprivatevirtual |
Implements aruna::driver::I2C_master.
Definition at line 22 of file ESP32_I2C_master.cpp.
25 ESP_ERROR_CHECK(i2c_master_write_byte(
i2c_cmd_handler, (address << 1) | I2C_MASTER_WRITE, I2C_MASTER_ACK));
26 ESP_ERROR_CHECK(i2c_master_write_byte(
i2c_cmd_handler, (uint8_t) reg, I2C_MASTER_ACK));
27 ESP_ERROR_CHECK(i2c_master_write(
i2c_cmd_handler, data, data_size, I2C_MASTER_ACK));
33 case ESP_ERR_INVALID_ARG:
37 case ESP_ERR_INVALID_STATE:
i2c_cmd_handle_t i2c_cmd_handler
◆ i2c_cmd_handler
i2c_cmd_handle_t aruna::driver::ESP32_I2C_master::i2c_cmd_handler |
|
private |
◆ i2c_conf
const i2c_config_t* aruna::driver::ESP32_I2C_master::i2c_conf |
|
private |
◆ i2c_num
i2c_port_t aruna::driver::ESP32_I2C_master::i2c_num |
|
private |
The documentation for this class was generated from the following files: