Digital Port

Instances of port that represent Digital devices.

class pymoa.device.digital.DigitalChannel(name='', **kwargs)

Bases: pymoa.device.port.Channel

A abstract single channel digital device.

state: Optional[bool] = None

The state of the channel.

state is a BooleanProperty and defaults to None.

await write_state(state: bool, **kwargs)

A stub method defining the prototype for write_state() of derived classes.

Parameters
state: bool

The value to set the state to.

Note

When called, it raises a NotImplementedError if not overwritten.

class pymoa.device.digital.DigitalPort(name='', **kwargs)

Bases: pymoa.device.port.Port

A abstract multi-channel digital device.

await write_state(channel: str, state: bool, **kwargs)

A abstract method for setting the state. See ChannelBase for details.

Note

If supported, the method needs to be overwritten by a base class otherwise, it raises a NotImplementedError.

await write_states(high: Iterable[str] = (), low: Iterable[str] = (), **kwargs)

A stub method defining the prototype for write_state() of derived classes.

For devices that support it, the properties passed in high and low can be set to the requested state simultaneously.

Parameters
high: list

A list of the names of the properties to set to high (True)

low: list

A list of the names of the properties to set to low (False)

Note

When called, it raises a NotImplementedError if not overwritten.

class pymoa.device.digital.RandomDigitalChannel(name='', **kwargs)

Bases: pymoa.device.digital.DigitalChannel

A channel that generates random digital values. Mainly useful as a testing device.

await read_state()

A abstract method causing a read of the state. This method should not return the state, but rather cause the device to read the state and update the appropriate instance property with the current state.

Note

If supported, the method needs to be overwritten by a base class otherwise, it raises a NotImplementedError.

await write_state(state: bool, **kwargs)

A stub method defining the prototype for write_state() of derived classes.

Parameters
state: bool

The value to set the state to.

Note

When called, it raises a NotImplementedError if not overwritten.

class pymoa.device.digital.RandomDigitalPort(name='', **kwargs)

Bases: pymoa.device.digital.DigitalPort

A port that generates random digital values. Mainly useful as a testing device.

await read_state()

A abstract method causing a read of the state. This method should not return the state, but rather cause the device to read the state and update the appropriate instance property with the current state.

Note

If supported, the method needs to be overwritten by a base class otherwise, it raises a NotImplementedError.

await write_states(**kwargs: bool)

A stub method defining the prototype for write_state() of derived classes.

For devices that support it, the properties passed in high and low can be set to the requested state simultaneously.

Parameters
high: list

A list of the names of the properties to set to high (True)

low: list

A list of the names of the properties to set to low (False)

Note

When called, it raises a NotImplementedError if not overwritten.