Dependencies¶
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Usage Example¶
See usage examples in the examples folder.
Contributing¶
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Building locally¶
Zip release files¶
To build this library locally you’ll need to install the circuitpython-build-tools package.
python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools
Once installed, make sure you are in the virtual environment:
source .env/bin/activate
Then run the build:
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-cap1188 --library_location .
Sphinx documentation¶
Sphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):
python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme
Now, once you have the virtual environment activated:
cd docs
sphinx-build -E -W -b html . _build/html
This will output the documentation to docs/_build/html
. Open the index.html in your browser to
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
locally verify it will pass.
Table of Contents¶
Simple test¶
Ensure your device works with this simple test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import board
import busio
# I2C setup
from adafruit_cap1188.i2c import CAP1188_I2C
i2c = busio.I2C(board.SCL, board.SDA)
cap = CAP1188_I2C(i2c)
# SPI setup
# from digitalio import DigitalInOut, Direction
# from adafruit_cap1188.spi import CAP1188_SPI
# spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
# cs = DigitalInOut(board.D5)
# cap = CAP1188_SPI(spi, cs)
while True:
for i in range(1, 9):
if cap[i].value:
print("Pin {} touched!".format(i))
|
adafruit_cap1188.cap1188
¶
CircuitPython driver for the CAP1188 8-Key Capacitive Touch Sensor Breakout.
- Author(s): Carter Nelson
Implementation Notes¶
Hardware:
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
-
class
adafruit_cap1188.cap1188.
CAP1188
¶ CAP1188 driver base, must be extended for I2C/SPI interfacing.
-
delta_count
(pin)¶ Return the 8 bit delta count value for the channel.
-
recalibrate
()¶ Perform a self recalibration on all the pins.
-
recalibrate_pins
(mask)¶ Recalibrate pins specified by bit mask.
-
sensitivity
¶ The sensitvity of touch detections. Range is 1 (least) to 128 (most).
-
threshold_values
()¶ Return tuple of touch threshold values for all channels.
-
thresholds
¶ Touch threshold value for all channels.
-
touched
()¶ Return 8 bit value representing touch state of all pins.
-
touched_pins
¶ A tuple of touched state for all pins.
-
-
class
adafruit_cap1188.cap1188.
CAP1188_Channel
(cap1188, pin)¶ Helper class to represent a touch channel on the CAP1188. Not meant to be used directly.
-
raw_value
¶ The raw touch measurement.
-
recalibrate
()¶ Perform a self recalibration.
-
threshold
¶ The touch threshold value.
-
value
¶ Whether the pin is being touched or not.
-
adafruit_cap1188.i2c
¶
CircuitPython I2C driver for the CAP1188 8-Key Capacitive Touch Sensor Breakout.
- Author(s): Carter Nelson
Implementation Notes¶
Hardware:
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
-
class
adafruit_cap1188.i2c.
CAP1188_I2C
(i2c, address=41)¶ Driver for the CAP1188 connected over I2C.
adafruit_cap1188.spi
¶
CircuitPython SPI driver for the CAP1188 8-Key Capacitive Touch Sensor Breakout.
- Author(s): Carter Nelson
Implementation Notes¶
Hardware:
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
-
class
adafruit_cap1188.spi.
CAP1188_SPI
(spi, cs)¶ Driver for the CAP1188 connected over SPI.
\ Sort by:\ best rated\ newest\ oldest\
\\
Add a comment\ (markup):
\``code``
, \ code blocks:::
and an indented block after blank line