Skip to content

Commit

Permalink
Add API docs for Tone
Browse files Browse the repository at this point in the history
and ditch the fancy UTF-8 sharp/flat chars because of
readthedocs/readthedocs.org#1556 ... again
  • Loading branch information
waveform80 committed Feb 10, 2019
1 parent ce1a432 commit 8ba02e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/api_output.rst
Expand Up @@ -37,13 +37,13 @@ Buzzer
======

.. autoclass:: Buzzer(pin, \*, active_high=True, initial_value=False, pin_factory=None)
:members: on, off, toggle, beep, pin, is_active
:members: on, off, toggle, beep, pin, is_active, value

TonalBuzzer
===========

.. autoclass:: TonalBuzzer(pin, \*, initial_value=None, mid_note='A4', octaves=1, pin_factory=None)
:members: play, stop, note_value, is_active, octaves, min_note, mid_note, max_note
:members: play, stop, octaves, min_tone, mid_tone, max_tone, tone, is_active, value

Motor
=====
Expand Down
18 changes: 18 additions & 0 deletions docs/api_tones.rst
@@ -0,0 +1,18 @@
===========
API - Tones
===========

.. module:: gpiozero.tones

GPIO Zero includes a :class:`Tone` class intended for use with the
:class:`~gpiozero.TonalBuzzer`. This class is in the ``tones`` module of GPIO
Zero and is typically imported as follows::

from gpiozero.tones import Tone


Tone
====

.. autoclass:: Tone
:members:
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -26,6 +26,7 @@ Table of Contents
api_internal
api_generic
api_tools
api_tones
api_info
api_pins
api_exc
Expand Down
4 changes: 2 additions & 2 deletions gpiozero/tones.py
Expand Up @@ -116,8 +116,8 @@ def from_note(cls, note):
For example `concert A`_, the typical tuning note at 440Hz, would be
represent as "A4". One semi-tone above this would be "A#4" or
alternatively "Bb4". Unicode representations are also accepted, e.g.
"A♯4" or "B♭4".
alternatively "Bb4". Unicode representations of sharp and flat are also
accepted.
"""
if isinstance(note, bytes):
note = note.decode('ascii')
Expand Down

0 comments on commit 8ba02e3

Please sign in to comment.