Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded library to support most features of WM8960 I2C protocol #2

Merged
merged 56 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
59aacb4
Converted Arduino library from https://github.com/sparkfun/SparkFun_W…
relic-se Aug 13, 2024
cfd27d9
Updated copyright in documentation and minor changes.
relic-se Aug 13, 2024
89036d3
Transferred and converted examples from Arduino library.
relic-se Aug 13, 2024
e6b343b
Reset device on initialization and copy default registers to local va…
relic-se Aug 13, 2024
7f54800
Fix bug in `_writeRegisterMultiBits`.
relic-se Aug 13, 2024
215deec
Use single integer for value of PLLK rather than separate nibbles.
relic-se Aug 13, 2024
4276430
Add methods to enable/disable both channels of DAC and ADC.
relic-se Aug 13, 2024
6892379
Updated simpletest example to use new library.
relic-se Aug 13, 2024
71c1a07
Ported over more complex example, eighties_dystopia, by @todbot / Tod…
relic-se Aug 13, 2024
90a9745
Enable VREF and VMID on initialization by default.
relic-se Aug 13, 2024
40bb1ee
Paired stereo functions added.
relic-se Aug 13, 2024
a368bda
Configuration utilities for I2S, DAC, headphones, and speakers.
relic-se Aug 13, 2024
5fb70c5
Separate sample rate calculation from configuration method.
relic-se Aug 13, 2024
4a22db3
Additional stereo pair methods.
relic-se Aug 13, 2024
23d81ee
Updated examples to use stereo pair methods.
relic-se Aug 13, 2024
248daed
Updated stereo pairing output mixer method names to better represent …
relic-se Aug 13, 2024
d333550
Fix typo in INPUT2 example.
relic-se Aug 13, 2024
bb23918
Basic error checking and boolean response.
relic-se Aug 13, 2024
ca54148
Updated documentation with new examples.
relic-se Aug 13, 2024
381f022
Removed unimplemented `adafruit_wm8960.WM8960.isConnected`
relic-se Aug 15, 2024
e8ea476
Fixed pyproject.toml Homepage url.
relic-se Aug 15, 2024
473b67f
Updated library constants to use const() and naming conventions (http…
relic-se Aug 15, 2024
ef9d64f
Revert code of conduct to original version.
relic-se Aug 16, 2024
e30892e
API updated to use property-driven standards.
relic-se Aug 16, 2024
a559078
Basic examples updated to use new API.
relic-se Aug 16, 2024
2fa811e
Determine register default value automatically during initial reset.
relic-se Aug 16, 2024
5eabc95
Rename WMBit(s) to WOBit(s).
relic-se Aug 17, 2024
eba04c9
Rename "pga" to "mic"
relic-se Aug 17, 2024
8727e62
Removed property verbs such as "Enabled".
relic-se Aug 17, 2024
bade897
Default settings to decibel and time values and obfuscate direct regi…
relic-se Aug 17, 2024
ceee3b7
Converted attribute names from camel case to snake case.
relic-se Aug 17, 2024
3874f23
Move left/right to prepend attribute name.
relic-se Aug 17, 2024
933e7f7
Make min/max constants that are relevant to attribute values public.
relic-se Aug 17, 2024
703a267
Rename `word_length` to `bit_depth`
relic-se Aug 17, 2024
2de9580
Updated simpletest to utilize new attribute naming scheme.
relic-se Aug 17, 2024
79c3596
Use decibel values instead of gain step constants for mic and speaker…
relic-se Aug 22, 2024
ed2b134
Add stereo function to set mic inverting input.
relic-se Aug 22, 2024
8480a43
Remove "boost" from mic output attributes.
relic-se Aug 22, 2024
3b085c8
Use monotonic value for 3D enhance depth.
relic-se Aug 22, 2024
722dec4
Fix minor typing issues.
relic-se Aug 22, 2024
b4d42b5
Remove unnecessary examples and reorganize into meaningful examples..
relic-se Aug 22, 2024
dcd09f2
Added related product links.
relic-se Aug 23, 2024
062655c
Updated usage example.
relic-se Aug 23, 2024
8811ae1
Updated formatting using black.
relic-se Aug 23, 2024
776e3bc
Local register list reset bug fix.
relic-se Aug 23, 2024
bc58f1a
Ensure that registers contain address index in bytearray before and a…
relic-se Aug 23, 2024
5da5380
Conform to pylint standards (excluding `missing-function-docstring` a…
relic-se Aug 23, 2024
6299b2b
Rearranged library structure to introduce basic driver class, `adafru…
relic-se Sep 2, 2024
557d8e7
Updated example code to utilize basic driver.
relic-se Sep 2, 2024
1f968b4
Fix logarithmic functions.
relic-se Sep 2, 2024
ec79c65
Fix tuple manipulation error.
relic-se Sep 2, 2024
cf4f995
Updated examples to pass pylint compatibility and black formatting.
relic-se Sep 2, 2024
7442bf8
Fix whitespace in class description.
relic-se Sep 4, 2024
86cbd8b
Fix import order in simpletest example.
relic-se Sep 6, 2024
962a1a8
Fix trailing whitespace and minor formatting.
relic-se Sep 6, 2024
5ae8bc5
Updated pyproject.toml to use package folder.
relic-se Sep 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#
# SPDX-License-Identifier: Unlicense

default_language_version:
# force all unspecified python hooks to run python3.11
python: python3.11

repos:
- repo: https://github.com/python/black
rev: 23.3.0
Expand Down
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)
MIT License

Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
Copyright (c) 2024 Cooper Dalrymple

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
49 changes: 18 additions & 31 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
Introduction
============


.. image:: https://readthedocs.org/projects/adafruit-circuitpython-wm8960/badge/?version=latest
:target: https://docs.circuitpython.org/projects/wm8960/en/latest/
:alt: Documentation Status


.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
:target: https://adafru.it/discord
:alt: Discord


.. image:: https://github.com/adafruit/Adafruit_CircuitPython_WM8960/workflows/Build%20CI/badge.svg
:target: https://github.com/adafruit/Adafruit_CircuitPython_WM8960/actions
:alt: Build Status


.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black

Barebones CircuitPython driver for WM8960 Stereo CODEC

CircuitPython driver for WM8960 Stereo CODEC

Dependencies
=============
Expand All @@ -32,27 +26,18 @@ This driver depends on:
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_

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

This library is designed to help facilite the I2C connection with a WM8960 audio codec to configure it to be used for DAC, ADC, headphone and speaker functionality.


.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
image from the assets folder in the PCB's GitHub repo.

`Purchase one from the Adafruit shop <http://www.adafruit.com/products/>`_
This library has been tested using an RP2040 on CircuitPython 9.1.1 and the `SparkFun Audio Codec PBreakout - WM8960 <https://www.sparkfun.com/products/21250>`_.

Installing from PyPI
=====================
.. note:: This library is not available on PyPI yet. Install documentation is included
as a standard element. Stay tuned for PyPI availability!
.. note:: This library is not available on PyPI yet. Install documentation is included as a standard element. Stay tuned for PyPI availability!

.. todo:: Remove the above note if PyPI version is/will be available at time of release.
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from PyPI <https://pypi.org/project/adafruit-circuitpython-wm8960/>`_.

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-wm8960/>`_.
To install for current user:

.. code-block:: shell
Expand Down Expand Up @@ -100,19 +85,21 @@ Or the following command to update an existing version:
Usage Example
=============

.. todo:: Add a quick, simple example. It and other examples should live in the
examples folder and be included in docs/examples.rst.
.. code-block:: python

# Monitor Stereo Input: INPUT3 => Output Mixer => Headphones
import board
from adafruit_wm8960 import Input, WM8960
codec = WM8960(board.I2C())
codec.input = Input.LINE3
codec.gain = 0.5
codec.monitor = 1.0
codec.headphone = 0.5

Documentation
=============
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/wm8960/en/latest/>`_.

For information on building library documentation, please check out
`this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/adafruit_wm8960/en/latest/>`_.

Contributing
============

Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_WM8960/blob/HEAD/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Contributions are welcome! Please read our `Code of Conduct <https://github.com/adafruit/Adafruit_CircuitPython_WM8960/blob/HEAD/CODE_OF_CONDUCT.md>`_ before contributing to help this project stay welcoming.
1 change: 1 addition & 0 deletions README.rst.license
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
SPDX-License-Identifier: MIT
68 changes: 0 additions & 68 deletions adafruit_wm8960.py

This file was deleted.

Loading