hololink::emulation::sensors::TestSensor
hololink::emulation::sensors::TestSensor
I2C-controlled test sensor for validation and development.
Register map (16-bit big-endian address, same transaction format as Vb1940Emulator):
Inherits from: hololink::emulation::I2CPeripheral (public)
Constructors
TestSensor
Destructor
~TestSensor
Methods
reset
attach_to_i2c
python:
def attach_to_i2c(self: hemu.I2CPeripheral, i2c_controller: hemu.I2CController, bus_address: int)
attach the peripheral to the I2C controller. This should be called by client code before start() is called
Parameters
The I2C controller to attach to. Retrieved from HSBEmulator with get_i2c(controller_address)
The bus address of the peripheral.
i2c_transaction
python:
def i2c_transaction(self: hemu.I2CPeripheral, peripheral_address: int, write_bytes: List[int], read_bytes: List[int]) -> hemu.I2CStatus
perform an I2C transaction. This will be called by the I2CController when a transaction is requested.
read request size is the size of the read_bytes vector as initialized by the caller
Returns: I2CStatus The status of the transaction.
Parameters
The peripheral address to communicate with.
The bytes to write to the peripheral.
The size of the write bytes
The bytes to read from the peripheral. This shall be filled with 0s to the requested read size and replaced by peripheral. This is to ensure peripheral can get the read count from read_bytes.size() and enough valid data is returned for no-ops.
The size of the read bytes
is_streaming
get_frame_size
get_frame_rate_hz
get_pattern_mode
get_constant_byte
fill_frame
Fill a frame buffer according to the current pattern configuration.
Parameters
Destination buffer (must be at least get_frame_size() bytes).
Frame sequence number used by the incrementing pattern.
start
start the peripheral.
This will be called when I2CController itself starts and should not be done by the client code
stop
stop the peripheral.
This will be called when the I2CController is stopped and should not be done by the client code
Peripheral should release all resources in case a subsequent start() is called.