I2C 32 位元暫存器目標¶
PxI2C32BitRegisterTarget 代表具有一組 32 位元可定址暫存器的通用 I2C 目標裝置,適合模擬感測器、記憶體裝置或其他週邊。
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. |
remove_event_handler |
Remove an event handler. |
get_event_handlers |
Retreive handlers registerd on this device. |
on_event |
Add an event handler to the instance by decorator. |
set_config |
Set the config of the target. |
detach_from_bus |
Detach the device from the bus. |
perform_operation |
Send an operation. |
attach_to_bus |
Attach the target to a bus. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
available_events_map |
A reverse mapping of |
is_attached |
Check if the device is attached to a bus.
TYPE:
|
state |
Get the state of the device.
TYPE:
|
name |
Get the name of the device.
TYPE:
|
additional_data |
Get the opaque additional data blob associated with this device.
TYPE:
|
config |
Get the config of the device.
TYPE:
|
cts_op_name |
Get the name of CTS operation. Currently not available now.
TYPE:
|
address |
Static address of the device.
TYPE:
|
sub_address_type |
Sub-address type of the device.
TYPE:
|
register_value |
Get the register value of the target.
TYPE:
|
available_events_map
¶
A reverse mapping of field_name_by_number, which uses field name as key.
additional_data
¶
additional_data: bytes
Get the opaque additional data blob associated with this device.
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.
get_event_handlers
¶
Retreive handlers registerd on this device.
on_event
¶
Add an event handler to the instance by decorator.
detach_from_bus
¶
Detach the device from the bus.
The opposite of the attach_to_bus method.
perform_operation
¶
Send an operation.
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 |