|
Post by lbendlin on Jan 28, 2019 8:16:54 GMT -8
def enablePowerChannel(self, channel, enable):
if (enable == self.QuadPower_DISABLE):
value = self._QuadPower_DIREction | channel
else:
# assume output
value = self._QuadPower_direction & ((~channel) &0xFF)
self._QuadPower_direction = value;
self.wireWriteRegister(self.QuadPower_REGDIR_ADDR, value);
#print ("ePC value= %x ") % value
return self._QuadPower_direction; I am trying to understand what the purpose of enablePowerChannel is. Isn't the initialization of the QPM done when the instance is created? Do I have to use enablePowerChannel every time I want to switch a channel? Will it impact any other channels?
It also seems to me that there is a typo in line 3. Is that not an issue because "QuadPower_DISABLE" is never used?
|
|
|
Post by lbendlin on Jan 29, 2019 6:07:15 GMT -8
This part here also seems rather unusual
QuadPower_INPUT = (0x01) # 0 means input
QuadPower_OUTPUT = (0x00) # 1 means output
QuadPower_OFF = (0x00) # 0 means off
QuadPower_ON = (0x01) # 1 means on
QuadPower_DISABLE = (0x01) # 0 means off
QuadPower_ENABLE = (0x00) # 1 means on
|
|
|
Post by SDL on Jan 29, 2019 8:54:27 GMT -8
Lutz,
Yes, that is a Typo. Dang Python weak typing. You never have these problems with a strongly typed language like C/C++. Fixed.
Remember thee QPBM board is driven by an 8 Pin I2C GPIO board. That's why you have inputs and outputs. Obviously, you have to program the pins (done in the driver) as outputs to drive the solid state relays.
It is a little mysterious but it makes sense to define those things.
BP
|
|