Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jeff Gough
firmware
Commits
584aecdc
Verified
Commit
584aecdc
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
docs: Document buttons module
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
13e2a23c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/index.rst
+1
-0
1 addition, 0 deletions
Documentation/index.rst
Documentation/pycardium/buttons.rst
+59
-0
59 additions, 0 deletions
Documentation/pycardium/buttons.rst
with
60 additions
and
0 deletions
Documentation/index.rst
+
1
−
0
View file @
584aecdc
...
...
@@ -21,6 +21,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the
:caption: Pycardium
pycardium/overview
pycardium/buttons
pycardium/color
pycardium/display
pycardium/leds
...
...
This diff is collapsed.
Click to expand it.
Documentation/pycardium/buttons.rst
0 → 100644
+
59
−
0
View file @
584aecdc
.. py:module:: buttons
``buttons`` - Push Buttons
==========================
The :py:mod:`buttons` module allows you to use card10's push buttons as input
in your scripts.
**Example**:
.. code-block:: python
import buttons
print("Press bottom left or right button:")
while True:
pressed = buttons.read(
buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT
)
if pressed != 0:
break
if pressed & buttons.BOTTOM_LEFT != 0:
print("Left button pressed!")
if pressed & buttons.BOTTOM_RIGHT != 0:
print("Right button pressed!")
.. py:function:: buttons.read(mask)
Read button status.
:param int mask: Mask of buttons to check. Create the mask by ORing
:py:data:`buttons.BOTTOM_LEFT`, :py:data:`buttons.BOTTOM_RIGHT`,
:py:data:`buttons.TOP_RIGHT`, and :py:data:`buttons.TOP_LEFT` (=
:py:data:`buttons.RESET`).
:returns: An integer with the bits for pressed buttons set. Use the same
costants as for the mask to check which buttons were pressed.
.. py:data:: buttons.BOTTOM_LEFT
Bottom left button.
.. py:data:: buttons.BOTTOM_RIGHT
Bottom right button.
.. py:data:: buttons.TOP_RIGHT
Top right button.
.. py:data:: buttons.TOP_LEFT
Top left button (Reset button).
.. py:data:: buttons.RESET
Top left button (Reset button).
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment