diff --git a/adafruit_emc2101/__init__.py b/adafruit_emc2101/__init__.py index 109fb10..1fb7ed0 100644 --- a/adafruit_emc2101/__init__.py +++ b/adafruit_emc2101/__init__.py @@ -189,9 +189,9 @@ def __init__(self, i2c_bus): raise RuntimeError("No EMC2101 (part={}.{})".format(part, mfg)) self._full_speed_lsb = None # See _calculate_full_speed(). - self.initialize() + self.emec2101_initialize() - def initialize(self): + def emec2101_initialize(self): """Reset the controller to an initial default configuration""" self._tach_mode_enable = True self._enabled_forced_temp = False @@ -214,6 +214,15 @@ def devconfig(self): """ return self._config + def _get_internal_temperature(self): + """The temperature as measured by the EMC2101's internal 8-bit + temperature sensor, which validly ranges from 0 to 85 and does not + support fractions (unlike the external readings). + + :return: int temperature in Celsius. + """ + return self._int_temp + @property def devstatus(self): """Read device status (alerts) register. See the STATUS_* bit @@ -224,16 +233,11 @@ def devstatus(self): @property def internal_temperature(self): - """The temperature as measured by the EMC2101's internal 8-bit - temperature sensor, which validly ranges from 0 to 85 and does not - support fractions (unlike the external readings). + """internal temperature property""" - :return: int temperature in degrees centigrade. - """ return self._int_temp - @property - def external_temperature(self): + def _get_external_temperature(self): """The temperature measured using the external diode. The value is read as a fixed-point 11-bit value ranging from -64 to approx 126, with fractional part of 1/8 degree. @@ -259,10 +263,16 @@ def external_temperature(self): return full_tmp @property - def fan_speed(self): + def external_temperature(self): + """External temperature Property""" + + return self._get_external_temperature() + + def _get_fan_speed(self): """The current speed in Revolutions per Minute (RPM). :return: float fan speed rounded to 2dp. + """ val = self._tach_read_lsb val |= self._tach_read_msb << 8 @@ -270,6 +280,12 @@ def fan_speed(self): raise OSError("Connection") return round(emc2101_regs.FAN_RPM_DIVISOR / val, 2) + @property + def fan_speed(self): + """fan speed property""" + + return self._get_fan_speed() + def _calculate_full_speed(self, pwm_f=None, dac=None): """Determine the LSB value for a 100% fan setting""" if dac is None: diff --git a/adafruit_emc2101/emc2101_ext.py b/adafruit_emc2101/emc2101_ext.py index 3b9627c..f4a2d65 100644 --- a/adafruit_emc2101/emc2101_ext.py +++ b/adafruit_emc2101/emc2101_ext.py @@ -139,13 +139,13 @@ class EMC2101_EXT(EMC2101): # pylint: disable=too-many-instance-attributes def __init__(self, i2c_bus): super().__init__(i2c_bus) - self.initialize() - def initialize(self): + self.emc2101_ext_initialize() + + def emc2101_ext_initialize(self): """Reset the controller to an initial default configuration.""" self.auto_check_status = False self._last_status = 0 - super().initialize() def _check_status(self): if self.auto_check_status: @@ -201,7 +201,7 @@ def internal_temperature(self): :return: int temperature in degrees centigrade. """ self._check_status() - return super().internal_temperature + return self._get_internal_temperature() @property def external_temperature(self): @@ -218,7 +218,7 @@ def external_temperature(self): (not behaving like a diode). """ self._check_status() - return super().external_temperature + return self._get_external_temperature() @property def fan_speed(self): @@ -227,7 +227,7 @@ def fan_speed(self): :return: float speed in RPM. """ self._check_status() - return super().fan_speed + return self._get_fan_speed() @property def dev_temp_critical_limit(self): diff --git a/adafruit_emc2101/emc2101_lut.py b/adafruit_emc2101/emc2101_lut.py index 5d03261..beccae4 100644 --- a/adafruit_emc2101/emc2101_lut.py +++ b/adafruit_emc2101/emc2101_lut.py @@ -77,7 +77,6 @@ def initialize(self): self.lut_enabled = True # pylint: disable=attribute-defined-outside-init self._fan_clk_ovr = True - super().initialize() self._check_status() def set_pwm_clock(self, use_preset=False, use_slow=False): diff --git a/docs/conf.py b/docs/conf.py index 5c50c13..8177075 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,7 +26,7 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -# autodoc_mock_imports = ["digitalio", "busio"] +autodoc_mock_imports = ["adafruit_register"] intersphinx_mapping = {