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
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
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
card10
firmware
Merge requests
!113
Implement Python module for wristband GPIO access
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Implement Python module for wristband GPIO access
trilader/firmware:feature/gpio-module
into
master
Overview
26
Commits
2
Pipelines
6
Changes
9
Merged
trilader
requested to merge
trilader/firmware:feature/gpio-module
into
master
5 years ago
Overview
24
Commits
2
Pipelines
6
Changes
9
Expand
Does what it says on the tin. It will fix
#31 (closed)
1
0
1
Merge request reports
Compare
master
version 5
25a54a83
5 years ago
version 4
6bf9a6fc
5 years ago
version 3
32b64570
5 years ago
version 2
e4b753ee
5 years ago
version 1
614f7bb8
5 years ago
master (base)
and
latest version
latest version
2dcd065b
2 commits,
5 years ago
version 5
25a54a83
2 commits,
5 years ago
version 4
6bf9a6fc
2 commits,
5 years ago
version 3
32b64570
2 commits,
5 years ago
version 2
e4b753ee
2 commits,
5 years ago
version 1
614f7bb8
1 commit,
5 years ago
9 files
+
424
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
9
Search (e.g. *.vue) (Ctrl+P)
Documentation/pycardium/gpio.rst
0 → 100644
+
81
−
0
Options
.. py:module:: gpio
``gpio`` - GPIO Pins
==========================
The :py:mod:`gpio` module allows you to use card10's GPIO pins as input and
output in your scripts.
**Example**:
.. code-block:: python
import gpio
gpio.set_mode(gpio.WRISTBAND_1, gpio.mode.OUTPUT)
gpio.write(gpio.WRISTBAND_1, True)
gpio.set_mode(gpio.WRISTBAND_2, gpio.mode.INPUT | gpio.mode.PULL_UP)
state = gpio.read(gpio.WRISTBAND_2)
print("State of Wristband pin 2:", state)
.. py:function:: gpio.set_mode(pin, mode)
Configure GPIO pin state.
:param int pin: ID of the pin to be configured.
:param int mode: An integer with the bits for the wanted mode set. Create your
integer by ORing :py:data:`gpio.mode.OUTPUT`, :py:data:`gpio.mode.INPUT`,
:py:data:`gpio.mode.PULL_UP`, :py:data:`gpio.mode.PULL_DOWN`.
.. py:function:: gpio.get_mode(pin)
Get GPIO pin state.
:param int pin: ID of the pin of to get the mode of.
:returns: An integer with the configure mode bits set.
.. py:function:: gpio.write(pin, value)
Write a value to a GPIO pin.
:param int pin: ID of the pin of to get the mode of.
:param bool value: New pin value.
.. py:function:: gpio.read(pin)
Read GPIO pin value.
:param int pin: ID of the pin of to get the mode of.
:returns: Current value of the GPIO pin.
.. py:data:: gpio.WRISTBAND_1
Pin ID for Wristband GPIO 1.
.. py:data:: gpio.WRISTBAND_2
Pin ID for Wristband GPIO 2.
.. py:data:: gpio.WRISTBAND_3
Pin ID for Wristband GPIO 3.
.. py:data:: gpio.WRISTBAND_4
Pin ID for Wristband GPIO 4.
.. py:data:: gpio.mode.OUTPUT
Configures a pin as output.
.. py:data:: gpio.mode.INPUT
Configures a pin as input.
.. py:data:: gpio.mode:PULL_UP
Enables the internal pull-up resistor of a pin.
.. py:data:: gpio.mode:PULL_DOwn
Enables the internal pull-down resistor of a pin.
Loading