Skip to content

Commit b539443

Browse files
authored
Merge pull request #16 from jposada202020/verifying_references
Improving_docs
2 parents 5698adc + 01350a9 commit b539443

File tree

7 files changed

+53
-18
lines changed

7 files changed

+53
-18
lines changed

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ Usage Example
6464
6565
import time
6666
import board
67-
import busio
6867
from adafruit_emc2101 import EMC2101
6968
70-
i2c = busio.I2C(board.SCL, board.SDA)
69+
i2c = board.I2C() # uses board.SCL and board.SDA
7170
7271
emc = EMC2101(i2c)
7372
print("Setting fan speed to 25%")

adafruit_emc2101/__init__.py

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@
1515
1616
**Hardware:**
1717
18-
* `Adafruit EMC2101 Breakout <https://adafruit.com/product/4808>`_
18+
* `Adafruit EMC2101 Breakout
19+
<https://adafruit.com/product/4808>`_ (Product ID: 4808)
1920
2021
**Software and Dependencies:**
2122
2223
* Adafruit CircuitPython firmware for the supported boards:
23-
https://github.com/adafruit/circuitpython/releases
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
24+
https://circuitpython.org/downloads
25+
26+
* Adafruit's Bus Device library:
27+
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28+
29+
* Adafruit's Register library:
30+
https://github.com/adafruit/Adafruit_CircuitPython_Register
31+
2632
"""
2733

2834
from micropython import const
@@ -136,6 +142,34 @@ class EMC2101: # pylint: disable=too-many-instance-attributes
136142
137143
:param ~busio.I2C i2c_bus: The I2C bus the EMC is connected to.
138144
145+
146+
**Quickstart: Importing and using the device**
147+
148+
Here is an example of using the :class:`EMC2101` class.
149+
First you will need to import the libraries to use the sensor
150+
151+
.. code-block:: python
152+
153+
import board
154+
from adafruit_emc2101.emc2101_lut import EMC2101_LUT as EMC2101
155+
156+
Once this is done you can define your `board.I2C` object and define your sensor object
157+
158+
.. code-block:: python
159+
160+
i2c = board.I2C() # uses board.SCL and board.SDA
161+
emc = EMC2101(i2c)
162+
163+
Now you have access to the :attr:`manual_fan_speed` attribute to setup the
164+
desired fanspeed
165+
166+
.. code-block:: python
167+
168+
emc.manual_fan_speed = 25
169+
170+
171+
172+
139173
If you need control over PWM frequency and the controller's built in temperature/speed
140174
look-up table (LUT), you will need :class:`emc2101_lut.EMC2101_LUT` which extends this
141175
class to add those features, at the cost of increased memory usage.
@@ -282,7 +316,7 @@ def spinup_time(self, spin_time):
282316

283317
@property
284318
def spinup_drive(self):
285-
"""The drive strengh of the fan on spinup in % max RPM"""
319+
"""The drive strength of the fan on spinup in % max RPM"""
286320
return self._spin_drive
287321

288322
@spinup_drive.setter

adafruit_emc2101/emc2101_lut.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@
1515
1616
**Hardware:**
1717
18-
* `Adafruit EMC2101 Breakout <https://adafruit.com/product/4808>`_
18+
* `Adafruit EMC2101 Breakout <https://adafruit.com/product/4808>`_ (Product ID: 4808)
1919
2020
**Software and Dependencies:**
2121
2222
* Adafruit CircuitPython firmware for the supported boards:
23-
https://github.com/adafruit/circuitpython/releases
23+
https://circuitpython.org/downloads
24+
25+
* Adafruit's Bus Device library:
26+
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
27+
28+
* Adafruit's Register library:
29+
https://github.com/adafruit/Adafruit_CircuitPython_Register
2430
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
2731
2832
The class defined here may be used instead of :class:`adafruit_emc2101.EMC2101`,
2933
if your device has enough RAM to support it. This class adds LUT control

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
EMC2101 Fan Controller and Temperature sensor Learning Guide <https://learn.adafruit.com/emc2101-fan-controller-and-temperature-sensor>
2627

2728
.. toctree::
2829
:caption: Related Products
2930

31+
EMC2101 Fan Controller and Temperature sensor <https://www.adafruit.com/product/4808>
3032

3133
.. toctree::
3234
:caption: Other Links

examples/emc2101_lut_example.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
# SPDX-License-Identifier: MIT
44
import time
55
import board
6-
import busio
76
from adafruit_emc2101.emc2101_lut import EMC2101_LUT as EMC2101
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
8+
i2c = board.I2C() # uses board.SCL and board.SDA
109

1110
FAN_MAX_RPM = 1700
1211
emc = EMC2101(i2c)

examples/emc2101_set_pwm_freq.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
# SPDX-License-Identifier: MIT
44
import time
55
import board
6-
import busio
76
from adafruit_emc2101.emc2101_lut import EMC2101_LUT as EMC2101
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
8+
i2c = board.I2C() # uses board.SCL and board.SDA
109

1110
emc = EMC2101(i2c)
1211
emc.set_pwm_clock(use_preset=False)

examples/emc2101_simpletest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
# SPDX-License-Identifier: MIT
44
import time
55
import board
6-
import busio
76
from adafruit_emc2101 import EMC2101
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
10-
8+
i2c = board.I2C() # uses board.SCL and board.SDA
119
emc = EMC2101(i2c)
1210
while True:
1311
print("Setting fan speed to 25%")

0 commit comments

Comments
 (0)