Skip to content

Add threshold and sensitivity control #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 5, 2018
Merged

Conversation

caternuson
Copy link
Contributor

Adds new features for #6. Threshold settings can be done per channel or globally for all channels. Also adds sensitivity, which is a global only setting.

Adafruit CircuitPython 3.0.3 on 2018-10-10; Adafruit ItsyBitsy M4 Express with samd51g19
>>> import board, busio
>>> from adafruit_cap1188.i2c import CAP1188_I2C
>>> i2c = busio.I2C(board.SCL, board.SDA)
>>> cap = CAP1188_I2C(i2c)
>>> cap.thresholds
(64, 64, 64, 64, 64, 64, 64, 64)
>>> cap.thresholds = 99
>>> cap.thresholds
(99, 99, 99, 99, 99, 99, 99, 99)
>>> cap[3].threshold
99
>>> cap[3].threshold = 123
>>> cap.thresholds
(99, 99, 123, 99, 99, 99, 99, 99)
>>> cap.sensitivity
32
>>> cap.sensitivity = 128
>>> cap.sensitivity
128
>>> 

@caternuson caternuson requested a review from a team November 3, 2018 03:53
@@ -63,16 +63,21 @@
const(0x15),
const(0x16),
const(0x17))
CAP1188_SENSITIVTY = const(0x1F)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these all start with _ to save memory? I realize you didn't change it here but its probably worth doing. Variable names take a lot of memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Just not being good at being consistent. Names changed.

Copy link
Member

@ladyada ladyada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good find!

Copy link
Contributor

@kattni kattni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for adding this and fixing it up!

@kattni kattni merged commit 605dd1b into adafruit:master Nov 5, 2018
@caternuson caternuson mentioned this pull request Nov 5, 2018
tannewt pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants