Class Transmission¶
Defined in File BlackBox_I2C.hpp
Class Documentation¶
-
class
I2C
::
Transmission
¶ RAII wrapper for ESP-IDFs i2c commands.
Public Functions
-
Transmission
()¶ Construct a new clean Transmission object.
-
explicit
Transmission
(i2c_cmd_handle_t)¶ Construct a new Transmission object from existing handle.
-
Transmission
(Transmission&&)¶
-
Transmission &
operator=
(Transmission&&)¶
-
~Transmission
()¶
-
esp_err_t
startBit
()¶ Queue start bit into transmission.
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
-
esp_err_t
stopBit
()¶ Queue stop bit into transmission.
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
-
esp_err_t
writeByte
(std::uint8_t data, bool ACKCheck = EnableACKCheck)¶ Add write of 1 byte into transmission.
- Parameters
data – data byte to write
ackCheck – enable ack checks
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
-
esp_err_t
readByte
(std::uint8_t *data, ACKValue = ACK)¶ Add read of 1 byte into transmission.
- Parameters
data – buffer to put read data into
ackValue – ack value for read command
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
-
esp_err_t
write
(std::uint8_t *data, size_t dataLength, bool ackCheck = EnableACKCheck)¶ Add write of buffer into transmission.
- Parameters
data – data byte to write
dataLength – length of data
ackCheck – enable ack checks
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
-
esp_err_t
read
(std::uint8_t *data, size_t dataLength, ACKValue = ACK)¶ Add read of buffer into transmission.
- Parameters
data – buffer to put read data into
dataLength – length of data
ackType – ack value for read command
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
-
esp_err_t
send
(i2c_port_t i2cNum, TickType_t ticksToWait = 1000 / portTICK_RATE_MS)¶ Send queued commands.
- Parameters
i2cNum – I2C port
ticksToWait – maximum wait ticks
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Parameter error
ESP_FAIL Sending command error, slave doesn’t ACK the transfer.
ESP_ERR_INVALID_STATE I2C driver not installed or not in master mode.
ESP_ERR_TIMEOUT Operation timeout because the bus is busy.
-
void
reset
()¶ Reset this transmission for future use.
-
i2c_cmd_handle_t
raw
()¶ Get the raw handle to I2C_cmd.
- Returns
raw handle
-
void
detach
()¶ Detach the RAII object from i2c_cmd_handle.
-