Skip to content
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

Add set and get touch modes for touch pins #14

Closed
microbit-carlos opened this issue Nov 12, 2020 · 3 comments
Closed

Add set and get touch modes for touch pins #14

microbit-carlos opened this issue Nov 12, 2020 · 3 comments
Milestone

Comments

@microbit-carlos
Copy link
Contributor

To be able to set and get the touch model for the logo and touch pins, between capacitive and resistive.

The default modes should be (I believe this part is implemented already):

  • Logo touch will be default to capacitive
  • Edge connector pins will be resistive
@jaustin jaustin added this to the 2.0.0-beta.1 milestone Nov 13, 2020
@jaustin
Copy link
Contributor

jaustin commented Nov 13, 2020

The uBit object already constructs these with the appropriate defaults, but there should be a way to switch them over to the other modes. This is done in CODAL by calling isTouched() with an argument to determine the mode

https://github.com/lancaster-university/codal-nrf52/blob/master/source/NRF52Pin.cpp#L520

Here's usage in MakeCode...
https://github.com/microsoft/pxt-microbit/blob/master/libs/core/touchmode.cpp#L40

Pins that can have their touchmode changed

  • logo
  • P0
  • P1
  • P2

(this list is defined by the hardware because these pins have 10M pullups that make the resistive mode work)

logo is it's own class with only `is_touched()' so that needs extending, as do pin0,1,2

Proposed Python API:

pin0.set_touch_mode(pin0.CAPACITIVE)
pin_logo.set_touch_mode(pin_logo.RESISTIVE)

@jaustin jaustin removed this from the 2.0.0-beta.1 milestone Nov 13, 2020
@microbit-carlos microbit-carlos added this to the 2.0.0-beta.2 milestone Nov 25, 2020
@dpgeorge
Copy link
Collaborator

pin.set_touch_mode(mode) method and corresponding constants were added in cbc3cfc

@microbit-carlos
Copy link
Contributor Author

Gave this a test and all looks good, thanks Damien!

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

No branches or pull requests

3 participants