I2CDevice
上游未提供类型说明。
构造与析构
1~I2CDevice
virtual I2CDevice::~I2CDevice ()=default
虚析构函数
services/i2c_update_manager/I2CDevice.hpp:30成员函数
20address7bit
virtual uint8_t I2CDevice::address7bit () const =0
获取设备的 7 位 I2C 地址 设备地址
services/i2c_update_manager/I2CDevice.hpp:42consecutiveFailures
uint8_t I2CDevice::consecutiveFailures () const
获取连续失败次数 当前累计的连续失败次数
services/i2c_update_manager/I2CDevice.hpp:108conversionDeadlineMs
uint32_t I2CDevice::conversionDeadlineMs () const
获取本轮转换的预期完成时刻 conversionMs() trigger_ms_ +
services/i2c_update_manager/I2CDevice.hpp:65conversionMs
virtual uint32_t I2CDevice::conversionMs () const
获取触发后需要等待的最短转换时间 转换等待时间,单位毫秒;返回 0 表示可直接进入读取阶段
services/i2c_update_manager/I2CDevice.hpp:123hasValidData
bool I2CDevice::hasValidData () const
查询设备当前是否持有有效数据 最近一次成功更新后数据是否仍有效
services/i2c_update_manager/I2CDevice.hpp:81init
virtual bool I2CDevice::init (I2CBusDMA &bus, uint32_t timeout_ms)=0
执行一次初始化或探活流程 bus 当前设备所在的 I2C 总线 timeout_ms 单次事务超时时间,单位毫秒 初始化是否成功
services/i2c_update_manager/I2CDevice.hpp:50isDataFresh
bool I2CDevice::isDataFresh (const uint32_t now_ms, const uint32_t stale_ms) const
查询设备数据是否仍然新鲜 now_ms 当前时间戳,单位毫秒 stale_ms 允许的数据陈旧阈值,单位毫秒 数据是否仍在可接受的新鲜时间窗口内
services/i2c_update_manager/I2CDevice.hpp:88isInitialized
bool I2CDevice::isInitialized () const
查询设备是否已经初始化成功 当前是否已经成功初始化
services/i2c_update_manager/I2CDevice.hpp:71isOnline
bool I2CDevice::isOnline () const
查询设备当前是否在线 最近一次访问后设备是否在线
services/i2c_update_manager/I2CDevice.hpp:76lastAttemptMs
uint32_t I2CDevice::lastAttemptMs () const
获取最近一次尝试访问设备的时间 最近一次访问尝试的时间戳
services/i2c_update_manager/I2CDevice.hpp:93lastFailureMs
uint32_t I2CDevice::lastFailureMs () const
获取最近一次更新失败的时间 最近一次失败时间戳
services/i2c_update_manager/I2CDevice.hpp:103lastSuccessMs
uint32_t I2CDevice::lastSuccessMs () const
获取最近一次成功更新设备的时间 最近一次成功更新时间戳
services/i2c_update_manager/I2CDevice.hpp:98markFailure
void I2CDevice::markFailure (uint32_t now_ms)
记录一次失败更新 now_ms 当前时间戳,单位毫秒
services/i2c_update_manager/I2CDevice.hpp:169markInitialized
void I2CDevice::markInitialized (uint32_t now_ms)
上游未提供说明。
services/i2c_update_manager/I2CDevice.hpp:154markSuccess
void I2CDevice::markSuccess (uint32_t now_ms)
记录一次成功更新 now_ms 当前时间戳,单位毫秒
services/i2c_update_manager/I2CDevice.hpp:143name
virtual const char * I2CDevice::name () const =0
获取设备名称 设备名字符串,仅用于日志或调试显示
services/i2c_update_manager/I2CDevice.hpp:36onDataInvalidated
virtual void I2CDevice::onDataInvalidated ()
当父类判定数据失效时,同步清理子类缓存标记
services/i2c_update_manager/I2CDevice.hpp:137onRead
virtual bool I2CDevice::onRead (I2CBusDMA &bus, uint32_t now_ms, uint32_t timeout_ms)=0
读取一次设备数据并更新内部缓存 bus 当前设备所在的 I2C 总线 now_ms 当前时间戳,单位毫秒 timeout_ms 单次事务超时时间,单位毫秒 本轮读取是否成功
services/i2c_update_manager/I2CDevice.hpp:132onTrigger
virtual bool I2CDevice::onTrigger (I2CBusDMA &, uint32_t)
发送一次“开始转换”或“开始采样”命令 bus 当前设备所在的 I2C 总线 timeout_ms 单次事务超时时间,单位毫秒 触发是否成功
services/i2c_update_manager/I2CDevice.hpp:117update
UpdateStatus I2CDevice::update (I2CBusDMA &bus, uint32_t now_ms, uint32_t timeout_ms)
推进一次设备状态机 bus 当前设备所在的 I2C 总线 now_ms 当前时间戳,单位毫秒 timeout_ms 单次事务超时时间,单位毫秒 本次推进后的状态结果
services/i2c_update_manager/I2CDevice.hpp:59成员变量
9consecutive_failures_
uint8_t I2CDevice::consecutive_failures_
当前连续失败次数
services/i2c_update_manager/I2CDevice.hpp:194data_valid_
bool I2CDevice::data_valid_
当前缓存的数据是否有效
services/i2c_update_manager/I2CDevice.hpp:190initialized_
bool I2CDevice::initialized_
设备是否已经成功初始化
services/i2c_update_manager/I2CDevice.hpp:188last_attempt_ms_
uint32_t I2CDevice::last_attempt_ms_
最近一次尝试访问设备的时间戳
services/i2c_update_manager/I2CDevice.hpp:191last_failure_ms_
uint32_t I2CDevice::last_failure_ms_
最近一次失败时间戳
services/i2c_update_manager/I2CDevice.hpp:193last_success_ms_
uint32_t I2CDevice::last_success_ms_
最近一次成功更新时间戳
services/i2c_update_manager/I2CDevice.hpp:192online_
bool I2CDevice::online_
设备最近一次访问后是否在线
services/i2c_update_manager/I2CDevice.hpp:189phase_
Phase I2CDevice::phase_
当前状态机阶段
services/i2c_update_manager/I2CDevice.hpp:185trigger_ms_
uint32_t I2CDevice::trigger_ms_
最近一次触发采样的时间戳
services/i2c_update_manager/I2CDevice.hpp:186嵌套类型
1Phase
描述基类状态机当前处于哪个阶段
Read- 上游未提供说明。
Trigger- 上游未提供说明。
Wait- 上游未提供说明。