Python client for GEX
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gex-client-py/gex/units/DIn.py

19 lines
443 B

import gex
class DIn(gex.Unit):
"""
Digital input port.
Pins are represented by bits of a control word, right-aligned.
For example, if pins C6, C5 and C0 are selected for the unit,
the read word has the format (bits) |<C6><C5><C0>|
"""
def _type(self):
return 'DI'
def read(self):
""" Read pins """
msg = self._query(0x00)
pp = gex.PayloadParser(msg)
return pp.u16()