PWM Tx¶
PxPwmTx 用來設定 PWM 傳送器。以 period_ns 與 duty_cycle_ns 定義波形。控制器掛載或重新設定後,輸出會自動開始。
PxPwmTx
¶
PxPwmTx(
exerciser: AqProtocolExerciser,
config: PwmTxConfig | None = None,
period_ns: int = 40000,
duty_cycle_ns: int = 20000,
*args,
**kwargs
)
A PWM transmitter controller device class.
This class provides a high-level interface to a PWM TX device on the PWM bus.
Timing is configured with period_ns and duty_cycle_ns. Output starts
automatically on attach/configure.
| 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 controller. |
detach_from_bus |
Detach the device from the bus. |
perform_operation |
Send an operation. |
attach_to_bus |
Attach the controller 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.
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.
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 controller 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 |