I2C 32-bit Register Target¶
The PxI2C32BitRegisterTarget class represents a generic I2C target device that exposes a set of 32-bit addressable registers. This is useful for emulating sensors, memory devices, or other peripherals.
PxI2C32BitRegisterTarget
¶
PxI2C32BitRegisterTarget(
exerciser: AqProtocolExerciser,
address: int = 0,
sub_address_type: SubAddressType = NONE,
config: I2C32BitRegisterTargetConfig | None = None,
*args,
**kwargs
)
Bases: PxAbstractTarget
I2C Base Target Class.
| CLASS | DESCRIPTION |
|---|---|
SubAddressType |
Sub-address type enumeration. |
| METHOD | DESCRIPTION |
|---|---|
add_event_handler |
Add an event handler to the current device instance. |
attach_to_bus |
Attach the target to a bus. |
config |
Set the config of the target. |
detach_from_bus |
Detach the device from the bus. |
get_event_handlers |
Retreive handlers registerd on this device. |
on_event |
Add an event handler to the instance by decorator. |
perform_operation |
Send an operation. |
remove_event_handler |
Remove an event handler. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
address |
Static address of the device.
TYPE:
|
available_events_map |
A reverse mapping of |
is_attached |
Check if the device is attached to a bus.
TYPE:
|
name |
Get the name of the device.
TYPE:
|
register_value |
Get the register value of the target.
TYPE:
|
state |
Get the state of the device.
TYPE:
|
sub_address_type |
Sub-address type of the device.
TYPE:
|
available_events_map
¶
A reverse mapping of field_name_by_number, which uses field name as key.
SubAddressType
¶
Bases: IntEnum
Sub-address type enumeration.
This is intended to avoid exporting protobuf enum to the interface.
add_event_handler
¶
Add an event handler to the current device instance.
attach_to_bus
¶
attach_to_bus(bus: PxAbstractBus) -> None
Attach the target to a bus.
This method is used to make the device aware of the bus it is connected to. It is used to set the bus attribute of the device.
Note
This method will not automatically create an actual instance on
the Protocol Exerciser until user call the attach_to_bus method.
| PARAMETER | DESCRIPTION |
|---|---|
|
The bus to attach the device to
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the device is already attached to a bus |
detach_from_bus
¶
Detach the device from the bus.
The opposite of the attach_to_bus method.
get_event_handlers
¶
Retreive handlers registerd on this device.
on_event
¶
Add an event handler to the instance by decorator.
perform_operation
¶
Send an operation.