Add Touchscreen Calibrator Example #20
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A simple CircuitPython DisplayIO resistive touchscreen calibrator for Adafruit built-in displays. To use, run as a standalone module, include the following line in the calling module, or type into the REPL:
import touch_calibrator_built_in
Operational paramaters such as screen rotation and REPL-only measurement display can be set in the operational paramaters portion of the module.
When the test screen appears, use a stylus to swipe to the four edges of the visible display area. As the screen is calibrated, the small red square tracks the stylus tip (when REPL_ONLY=False). Minimum and maximum calibration values will display on the screen and in the REPL. The REPL values can be copied and pasted into the target code's touchscreen instantiation statement.
The calibration values are measured for a display rotation of zero degrees. To use the calibration values in the target, correlate the touchscreen pins and the calibration values. The order of the calibration tuples is determined by the display rotation value.
For example, a calibration tuple of
((4951, 58951), (8080, 57071))
would be inserted into the display instantiation statement in the order shown, depending on display orientation: