#include <MockI2c.h>
|
| | MockI2c (uint16_t device_address=0x20) noexcept |
| |
| | ~MockI2c () noexcept override=default |
| |
| bool | Initialize () noexcept override |
| |
| bool | Deinitialize () noexcept override |
| |
| hf_i2c_err_t | Write (const hf_u8_t *data, hf_u16_t length, hf_u32_t timeout_ms=0) noexcept override |
| |
| hf_i2c_err_t | Read (hf_u8_t *data, hf_u16_t length, hf_u32_t timeout_ms=0) noexcept override |
| |
| hf_i2c_err_t | WriteRead (const hf_u8_t *tx_data, hf_u16_t tx_length, hf_u8_t *rx_data, hf_u16_t rx_length, hf_u32_t timeout_ms=0) noexcept override |
| |
| hf_u16_t | GetDeviceAddress () const noexcept override |
| |
| void | SetDeviceAddress (uint16_t address) noexcept |
| |
| void | SetInitializeResult (bool ok) noexcept |
| |
| void | QueueRead (std::vector< uint8_t > bytes, hf_i2c_err_t result=hf_i2c_err_t::I2C_SUCCESS) |
| |
| void | FailNext (hf_i2c_err_t error, size_t count=1) noexcept |
| |
| void | SetResponder (Responder responder) |
| |
| void | EnableRegisterModel (bool enable=true) noexcept |
| |
| void | SetRegister (uint8_t reg, uint8_t value) noexcept |
| |
| uint8_t | GetRegister (uint8_t reg) const noexcept |
| |
| void | SetReadOnly (uint8_t reg, bool read_only=true) noexcept |
| |
| const std::vector< I2cTransaction > & | Transactions () const noexcept |
| |
| void | ClearTransactions () noexcept |
| |
| size_t | CountOf (I2cTransaction::Kind kind) const noexcept |
| |
| size_t | WritesTo (uint8_t reg) const noexcept |
| |
| int | InitializeCalls () const noexcept |
| |
◆ Responder
Responder: fill rx (rx_length bytes) for a Read/WriteRead, or observe a Write.
◆ MockI2c()
| hf::host::MockI2c::MockI2c |
( |
uint16_t |
device_address = 0x20 | ) |
|
|
explicitnoexcept |
◆ ~MockI2c()
| hf::host::MockI2c::~MockI2c |
( |
| ) |
|
|
overridedefaultnoexcept |
◆ ClearTransactions()
| void hf::host::MockI2c::ClearTransactions |
( |
| ) |
|
|
inlinenoexcept |
◆ Complete()
| hf_i2c_err_t hf::host::MockI2c::Complete |
( |
I2cTransaction & |
txn, |
|
|
uint8_t * |
rx |
|
) |
| |
|
private |
◆ CountOf()
◆ Deinitialize()
| bool hf::host::MockI2c::Deinitialize |
( |
| ) |
|
|
overridenoexcept |
◆ EnableRegisterModel()
| void hf::host::MockI2c::EnableRegisterModel |
( |
bool |
enable = true | ) |
|
|
inlinenoexcept |
◆ FailNext()
| void hf::host::MockI2c::FailNext |
( |
hf_i2c_err_t |
error, |
|
|
size_t |
count = 1 |
|
) |
| |
|
noexcept |
◆ GetDeviceAddress()
| hf_u16_t hf::host::MockI2c::GetDeviceAddress |
( |
| ) |
const |
|
inlineoverridenoexcept |
◆ GetRegister()
| uint8_t hf::host::MockI2c::GetRegister |
( |
uint8_t |
reg | ) |
const |
|
inlinenoexcept |
◆ Initialize()
| bool hf::host::MockI2c::Initialize |
( |
| ) |
|
|
overridenoexcept |
◆ InitializeCalls()
| int hf::host::MockI2c::InitializeCalls |
( |
| ) |
const |
|
inlinenoexcept |
◆ ModelRead()
| void hf::host::MockI2c::ModelRead |
( |
uint8_t * |
rx, |
|
|
uint16_t |
length |
|
) |
| |
|
privatenoexcept |
◆ ModelWrite()
| void hf::host::MockI2c::ModelWrite |
( |
const std::vector< uint8_t > & |
tx | ) |
|
|
privatenoexcept |
◆ QueueRead()
| void hf::host::MockI2c::QueueRead |
( |
std::vector< uint8_t > |
bytes, |
|
|
hf_i2c_err_t |
result = hf_i2c_err_t::I2C_SUCCESS |
|
) |
| |
◆ Read()
| hf_i2c_err_t hf::host::MockI2c::Read |
( |
hf_u8_t * |
data, |
|
|
hf_u16_t |
length, |
|
|
hf_u32_t |
timeout_ms = 0 |
|
) |
| |
|
overridenoexcept |
◆ SetDeviceAddress()
| void hf::host::MockI2c::SetDeviceAddress |
( |
uint16_t |
address | ) |
|
|
inlinenoexcept |
◆ SetInitializeResult()
| void hf::host::MockI2c::SetInitializeResult |
( |
bool |
ok | ) |
|
|
inlinenoexcept |
◆ SetReadOnly()
| void hf::host::MockI2c::SetReadOnly |
( |
uint8_t |
reg, |
|
|
bool |
read_only = true |
|
) |
| |
|
inlinenoexcept |
Writes to a read-only register are recorded but do not change it.
◆ SetRegister()
| void hf::host::MockI2c::SetRegister |
( |
uint8_t |
reg, |
|
|
uint8_t |
value |
|
) |
| |
|
inlinenoexcept |
◆ SetResponder()
| void hf::host::MockI2c::SetResponder |
( |
Responder |
responder | ) |
|
|
inline |
◆ Transactions()
| const std::vector< I2cTransaction > & hf::host::MockI2c::Transactions |
( |
| ) |
const |
|
inlinenoexcept |
◆ Write()
| hf_i2c_err_t hf::host::MockI2c::Write |
( |
const hf_u8_t * |
data, |
|
|
hf_u16_t |
length, |
|
|
hf_u32_t |
timeout_ms = 0 |
|
) |
| |
|
overridenoexcept |
◆ WriteRead()
| hf_i2c_err_t hf::host::MockI2c::WriteRead |
( |
const hf_u8_t * |
tx_data, |
|
|
hf_u16_t |
tx_length, |
|
|
hf_u8_t * |
rx_data, |
|
|
hf_u16_t |
rx_length, |
|
|
hf_u32_t |
timeout_ms = 0 |
|
) |
| |
|
overridenoexcept |
◆ WritesTo()
| size_t hf::host::MockI2c::WritesTo |
( |
uint8_t |
reg | ) |
const |
|
noexcept |
Number of single-register writes (Write of [reg, value...]) that targeted reg.
◆ address_
| uint16_t hf::host::MockI2c::address_ |
|
private |
◆ fail_count_
| size_t hf::host::MockI2c::fail_count_ {0} |
|
private |
◆ fail_error_
| hf_i2c_err_t hf::host::MockI2c::fail_error_ {hf_i2c_err_t::I2C_ERR_FAILURE} |
|
private |
◆ init_calls_
| int hf::host::MockI2c::init_calls_ {0} |
|
private |
◆ init_result_
| bool hf::host::MockI2c::init_result_ {true} |
|
private |
◆ log_
◆ queued_
| std::deque<Queued> hf::host::MockI2c::queued_ |
|
private |
◆ read_only_
| std::array<bool, 256> hf::host::MockI2c::read_only_ {} |
|
private |
◆ reg_pointer_
| uint8_t hf::host::MockI2c::reg_pointer_ {0} |
|
private |
◆ register_model_
| bool hf::host::MockI2c::register_model_ {false} |
|
private |
◆ registers_
| std::array<uint8_t, 256> hf::host::MockI2c::registers_ {} |
|
private |
◆ responder_
The documentation for this class was generated from the following files: