Skip to content

Commit aea50b1

Browse files
committed
Change dac_output_enabled to a property.
Recalculate the full speed LSB setting when this property is changed too.
1 parent 92921bf commit aea50b1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

adafruit_emc2101/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ class to add those features, at the cost of increased memory usage.
209209
"""When set to True, the magnitude of the fan output signal is inverted, making 0 the maximum
210210
value and 100 the minimum value"""
211211

212-
dac_output_enabled = RWBit(_REG_CONFIG, 4)
213-
"""When set, the fan control signal is output as a DC voltage instead of a PWM signal"""
214-
212+
_dac_output_enabled = RWBit(_REG_CONFIG, 4)
215213
_conversion_rate = RWBits(4, 0x04, 0)
216214
# fan spin-up
217215
_spin_drive = RWBits(2, _FAN_SPINUP, 3)
@@ -299,6 +297,16 @@ def manual_fan_speed(self, fan_speed):
299297
self._fan_setting = fan_speed_lsb
300298
self._fan_lut_prog = lut_disabled
301299

300+
@property
301+
def dac_output_enabled(self):
302+
"""When set, the fan control signal is output as a DC voltage instead of a PWM signal"""
303+
return self._dac_output_enabled
304+
305+
@dac_output_enabled.setter
306+
def dac_output_enabled(self, value):
307+
self._dac_output_enabled = value
308+
self._calculate_full_speed(dac=value)
309+
302310
@property
303311
def lut_enabled(self):
304312
"""Enable or disable the internal look up table used to map a given temperature

0 commit comments

Comments
 (0)