microbit-foundation / micropython-microbit-v2

Temporary home for MicroPython for micro:bit v2 as we stablise it before pushing upstream
MIT License
41 stars 22 forks source link

Feature request: Expose CODAL method to calibrate touch pins #209

Open microbit-carlos opened 2 months ago

microbit-carlos commented 2 months ago

This has been requested a few times, and I've myself missed having this functionality during a workshop.

Essentially CODAL currently contains pre-calibrated values for the touch pins and touch logo, which it's simple and saves having to run the calibration during startup (which we've found in the past can be confusing if users are holding the micro:bit while it's being flashed). The disadvantage is that cap touch input stops working when we attach things like crocodile clips or copper tape to the pins, so being able to trigger a recalibration would help resolve this.

Suggested function name would be pin.calibrate() and can use the NRF52Pin.touchCalibrate() CODAL API. https://github.com/lancaster-university/codal-nrf52/blob/62da916a409c7bc921f17d881e8da1cb35a856a6/inc/NRF52Pin.h#L334