Skip to content

Commit 8c6d224

Browse files
committed
Fix literalinclude in README.rst
1 parent 7bd04e5 commit 8c6d224

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

README.rst

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Introduction
2222
:target: https://github.com/psf/black
2323
:alt: Code Style: Black
2424

25-
This library provides an asynchronous interface to the ``countio`` and ``keypad`` modules. It also provides
25+
This library provides an asynchronous way to wait for buttons to be pressed. It also provides
2626
detection of single, double and triple clicks, and also long presses.
2727

2828

@@ -89,18 +89,30 @@ Or the following command to update an existing version:
8989
9090
circup update
9191
92-
Usage Example
93-
=============
92+
Usage
93+
=====
94+
95+
There are two classes:
96+
97+
* ``SimpleButton``: This allows to ``await`` for presses and releases
98+
99+
.. code-block:: python
100+
101+
button = async_button.SimpleButton(board.D5, True)
102+
await button.pressed
94103
95-
.. literalinclude:: ../examples/async_simplebutton_test.py
96-
:caption: examples/async_simplebutton_test.py
97-
:linenos:
104+
* ``Button``: This has much more features. It creates a background process to monitor the button
105+
and allows the user to ``await`` for single clicks, double clicks, long clicks etc. It must be instantiated
106+
in an asynchronous environment
98107

99-
.. literalinclude:: ../examples/async_button_test.py
100-
:caption: examples/async_button_test.py
101-
:linenos:
108+
.. code-block:: python
102109
110+
button = async_button.Button(board.D5, True)
111+
click = await button.wait_for_click()
112+
if click == button.DOUBLE:
113+
print("Double click!")
103114
115+
See the examples folder for full demonstrations
104116

105117
Documentation
106118
=============

0 commit comments

Comments
 (0)