Skip to content

Commit 2f3491c

Browse files
authored
Merge pull request #2 from adafruit/initial_lib
library, examples and docs
2 parents 6c5dce4 + 759f7c2 commit 2f3491c

File tree

8 files changed

+2197
-36
lines changed

8 files changed

+2197
-36
lines changed

README.rst

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,15 @@ This driver depends on:
3030

3131
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
3232
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
33-
* `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_
3433

3534
Please ensure all dependencies are available on the CircuitPython filesystem.
3635
This is easily achieved by downloading
3736
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_
3837
or individual libraries can be installed using
3938
`circup <https://github.com/adafruit/circup>`_.
4039

41-
42-
43-
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
44-
image from the assets folder in the PCB's GitHub repo.
45-
46-
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/>`_
47-
4840
Installing from PyPI
4941
=====================
50-
.. note:: This library is not available on PyPI yet. Install documentation is included
51-
as a standard element. Stay tuned for PyPI availability!
52-
53-
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
5442

5543
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
5644
PyPI <https://pypi.org/project/adafruit-circuitpython-tlv320/>`_.
@@ -101,8 +89,30 @@ Or the following command to update an existing version:
10189
Usage Example
10290
=============
10391

104-
.. todo:: Add a quick, simple example. It and other examples should live in the
105-
examples folder and be included in docs/examples.rst.
92+
.. code-block:: python
93+
94+
import audiobusio
95+
import audiocore
96+
import board
97+
98+
import adafruit_tlv320
99+
100+
i2c = board.I2C()
101+
dac = adafruit_tlv320.TLV320DAC3100(i2c)
102+
103+
# set mclk, sample rate & bit depth
104+
dac.configure_clocks(mclk_freq=12000000, sample_rate=44100, bit_depth=16)
105+
106+
# use headphones
107+
# helper function for default settings
108+
dac.headphone_output = True
109+
dac.headphone_volume = -20 # dB
110+
# or use speaker
111+
# helper function for default settings
112+
# dac.speaker_output = True
113+
# dac.speaker_volume = -15 # dB
114+
115+
audio = audiobusio.I2SOut(board.I2S_BCLK, board.I2S_WS, board.I2S_DIN)
106116
107117
Documentation
108118
=============

0 commit comments

Comments
 (0)