Skip to content

Commit a4e0336

Browse files
committed
Improve docs.
1 parent 24eff56 commit a4e0336

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

adafruit_emc2101/__init__.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
2222
* Adafruit CircuitPython firmware for the supported boards:
2323
https://github.com/adafruit/circuitpython/releases
24-
25-
# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
26-
# * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
24+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
25+
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
2726
"""
2827

2928
from micropython import const
@@ -133,8 +132,13 @@ class SpinupTime(CV):
133132

134133

135134
class EMC2101: # pylint: disable=too-many-instance-attributes
136-
"""Driver for the EMC2101 Fan Controller.
135+
"""Basic driver for the EMC2101 Fan Controller.
136+
137137
:param ~busio.I2C i2c_bus: The I2C bus the EMC is connected to.
138+
139+
If you need control over PWM frequency and the controller's built in temperature/speed
140+
look-up table (LUT), you will need :class:`emc2101_lut.EMC2101_LUT` which extends this
141+
class to add those features, at the cost of increased memory usage.
138142
"""
139143

140144
_part_id = ROUnaryStruct(_REG_PARTID, "<B")
@@ -238,7 +242,12 @@ def manual_fan_speed(self, fan_speed):
238242
@property
239243
def lut_enabled(self):
240244
"""Enable or disable the internal look up table used to map a given temperature
241-
to a fan speed. When the LUT is disabled fan speed can be changed with `manual_fan_speed`"""
245+
to a fan speed.
246+
247+
When the LUT is disabled (the default), fan speed can be changed with `manual_fan_speed`.
248+
To actually set this to True and modify the LUT, you need to use the extended version of
249+
this driver, :class:`emc2101_lut.EMC2101_LUT`
250+
"""
242251
return not self._fan_lut_prog
243252

244253
@property

adafruit_emc2101/emc2101_lut.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ def _speed_to_lsb(percentage):
5656

5757
class FanSpeedLUT:
5858
"""A class used to provide a dict-like interface to the EMC2101's Temperature to Fan speed
59-
Look Up Table"""
59+
Look Up Table.
60+
61+
Keys are integer temperatures, values are fan duty cycles between 0 and 100.
62+
A max of 8 values may be stored.
63+
64+
To remove a single stored point in the LUT, assign it as `None`.
65+
"""
6066

6167
# 8 (Temperature, Speed) pairs in increasing order
6268
_fan_lut = StructArray(_LUT_BASE, "<B", 16)
@@ -136,6 +142,9 @@ def _set_lut_entry(self, idx, temp, speed):
136142

137143
class EMC2101_LUT(EMC2101): # pylint: disable=too-many-instance-attributes
138144
"""Driver for the EMC2101 Fan Controller, with PWM frequency and LUT control.
145+
146+
See :class:`adafruit_emc2101.EMC2101` for the base/common functionality.
147+
139148
:param ~busio.I2C i2c_bus: The I2C bus the EMC is connected to.
140149
"""
141150

0 commit comments

Comments
 (0)