Skip to content

Commit 0fa6f4e

Browse files
committed
adding_usage_template
1 parent a2ae503 commit 0fa6f4e

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

docs/design_guide.rst

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,17 @@ After the license comment::
251251

252252
**Hardware:**
253253

254-
* Adafruit `Device Description
254+
* `Adafruit Device Description
255255
<hyperlink>`_ (Product ID: <Product Number>)
256256

257257
**Software and Dependencies:**
258258

259259
* Adafruit CircuitPython firmware for the supported boards:
260260
https://circuitpython.org/downloads
261+
261262
* Adafruit's Bus Device library:
262263
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
264+
263265
* Adafruit's Register library:
264266
https://github.com/adafruit/Adafruit_CircuitPython_Register
265267

@@ -525,6 +527,51 @@ SPI Example
525527
spi.readinto(self.buf)
526528
return self.buf[0]
527529
530+
531+
532+
Class example template
533+
--------------------------------------------------------------------------------
534+
When documenting classes, you could use the following template to illustrate the basic class functioning.
535+
it is closely related with the simpletest, however this will display the information in the readthedocs
536+
documentation.
537+
The advantage of using this, is users will be familiar with this as it is used across libraries
538+
539+
This is an example for a AHT20 temperature sensor. You could locate this after the class parameter
540+
definitions.
541+
542+
543+
.. code-block:: python
544+
545+
"""
546+
547+
**Quickstart: Importing and using the AHT10/AHT20 temperature sensor**
548+
549+
Here is an example of using the :class:`AHTx0` class.
550+
First you will need to import the libraries to use the sensor
551+
552+
.. code-block:: python
553+
554+
import board
555+
import adafruit_ahtx0
556+
557+
Once this is done you can define your `board.I2C` object and define your sensor object
558+
559+
.. code-block:: python
560+
561+
i2c = board.I2C() # uses board.SCL and board.SDA
562+
aht = adafruit_ahtx0.AHTx0(i2c)
563+
564+
Now you have access to the temperature and humidity using
565+
the :attr:`temperature` and :attr:`relative_humidity` attributes
566+
567+
.. code-block:: python
568+
569+
temperature = aht.temperature
570+
relative_humidity = aht.relative_humidity
571+
572+
"""
573+
574+
528575
Use composition
529576
--------------------------------------------------------------------------------
530577

0 commit comments

Comments
 (0)