To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 00148cd9 authored by mikolajr's avatar mikolajr
Browse files

In TiePieOscilloscope: factor out nested trigger kind enum to fix style

parent 30c26c78
Pipeline #51545 failed with stages
in 35 minutes and 55 seconds
......@@ -94,6 +94,7 @@ class TiePieConfig:
#
# device_type: (str, DeviceType) = DeviceType.ANY
def _is_number_in_range(x, min=None, max=None, number_type=Real) -> bool:
"""
Check if given input is a real number between `min` and `max` (inclusive), if
......@@ -121,6 +122,17 @@ class TiePieOscilloscopeChannelCoupling(NameEnum):
ACA = ltp.CK_ACA, "AC current"
TiePieOscilloscopeTriggerKind = NameEnum(
value="TiePieOscilloscopeTriggerKind",
names=(
("Rising", ltp.TK_RISINGEDGE),
("Falling", ltp.TK_FALLINGEDGE),
("Any", ltp.TK_ANYEDGE),
("Rising or Falling", ltp.TK_ANYEDGE), # just for `[]` lookup
),
)
class TiePieOscilloscope(SingleCommDevice):
"""
TiePie oscilloscope device.
......@@ -574,7 +586,7 @@ class TiePieOscilloscope(SingleCommDevice):
self._libtiepie_dev_channel(channel).coupling = coupling.value
@wrap_libtiepie_exception
def get_coupling(self, channel: int) -> ChannelCoupling:
def get_coupling(self, channel: int) -> TiePieOscilloscopeChannelCoupling:
"""
Get coupling for specified channel.
......@@ -645,15 +657,7 @@ class TiePieOscilloscope(SingleCommDevice):
self.channel_validation(channel)
return self._libtiepie_dev_channel(channel).trigger.hystereses[0]
TriggerKind = NameEnum(
value="TriggerKind",
names=(
("Rising", ltp.TK_RISINGEDGE),
("Falling", ltp.TK_FALLINGEDGE),
("Any", ltp.TK_ANYEDGE),
("Rising or Falling", ltp.TK_ANYEDGE), # just for `[]` lookup
),
)
TriggerKind = TiePieOscilloscopeTriggerKind
@wrap_libtiepie_exception
def set_trigger_kind(
......@@ -673,7 +677,7 @@ class TiePieOscilloscope(SingleCommDevice):
self._libtiepie_dev_channel(channel).trigger.kind = trigger_kind.value
@wrap_libtiepie_exception
def get_trigger_kind(self, channel: int) -> TriggerKind:
def get_trigger_kind(self, channel: int) -> TiePieOscilloscopeTriggerKind:
"""
Get trigger kind for a specified channel.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment