Skip to content

Commit 4f0e7a3

Browse files
authored
Merge pull request #1 from kattni/macropad-initial
MacroPad helper library.
2 parents 4d42ee5 + 41987ab commit 4f0e7a3

8 files changed

+1005
-22
lines changed

README.rst

+38-6
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,35 @@ This driver depends on:
3030

3131
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
3232

33+
* `Adafruit's CircuitPython NeoPixel library
34+
<https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel>`_
35+
36+
* `Adafruit's CircuitPython HID library
37+
<https://github.com/adafruit/Adafruit_CircuitPython_HID>`_
38+
39+
* `Adafruit's CircuitPython MIDI library
40+
<https://github.com/adafruit/Adafruit_CircuitPython_MIDI>`_
41+
42+
* `Adafruit's CircuitPython Display Text library
43+
<https://github.com/adafruit/Adafruit_CircuitPython_Display_Text>`_
44+
45+
* `Adafruit's CircuitPython Simple Text Display library
46+
<https://github.com/adafruit/Adafruit_CircuitPython_Simple_Text_Display>`_
47+
48+
* `Adafruit's CircuitPython Debouncer library
49+
<https://github.com/adafruit/Adafruit_CircuitPython_Debouncer>`_
50+
3351
Please ensure all dependencies are available on the CircuitPython filesystem.
3452
This is easily achieved by downloading
3553
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_
3654
or individual libraries can be installed using
3755
`circup <https://github.com/adafruit/circup>`_.
3856

39-
.. todo:: Describe the Adafruit product this library works with. For PCBs, you can also add the
40-
image from the assets folder in the PCB's GitHub repo.
41-
42-
`Purchase one from the Adafruit shop <http://www.adafruit.com/products/5100>`_
57+
This library is designed to work withe the Adafruit MacroPad RP2040. Consider
58+
purchasing one from the Adafruit shop:
4359

60+
`Adafruit MacroPad RP2040 Bare Bones <http://www.adafruit.com/products/5100>`_
61+
`Adafruit MacroPad RP2040 Starter Kit <https://www.adafruit.com/product/5128>`_
4462

4563
Installing to a Connected CircuitPython Device with Circup
4664
==========================================================
@@ -67,9 +85,23 @@ Or the following command to update an existing version:
6785
6886
Usage Example
6987
=============
88+
This example prints out the key pressed, the relative position of the rotary encoder and the
89+
state of the rotary encoder switch.
90+
91+
.. code-block:: python
92+
93+
from adafruit_macropad import MacroPad
94+
import time
95+
96+
macropad = MacroPad()
7097
71-
.. todo:: Add a quick, simple example. It and other examples should live in the
72-
examples folder and be included in docs/examples.rst.
98+
while True:
99+
key_event = macropad.keys.events.get()
100+
if key_event and key_event.pressed:
101+
print("Key pressed: {}".format(key_event.key_number))
102+
print("Encoder: {}".format(macropad.encoder))
103+
print("Encoder switch: {}".format(macropad.encoder_switch))
104+
time.sleep(0.4)
73105
74106
Contributing
75107
============

0 commit comments

Comments
 (0)