Xpt2046 correct alignment - #44
Open
johnlr wants to merge 3 commits into
Open
Conversation
The first bit of the result bytes is not used.
So, for a 12 bit result, the high 7 bits come from rx_buf[1]
and 5 low bits come from rx_buf[0].
The fixed bitshift means we should double the defaults for x_max and x_min
Owner
|
Sorry for the slow response. The original code intentionally scales the XPT2046’s 12-bit ADC output down to 11 bits by discarding the least-significant bit, reducing the raw range from roughly 0–4095 to 0–2047. For a 240×320 resistive touchscreen, that still provides far more coordinate resolution than the display can use, while also filtering out the noisiest, least-significant ADC bit and reducing small fluctuations in touch readings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The bitshifts for the xpt2046 are off. The values from the touch were very noisy because they have been accidentally including the busy bit in their value. You should find you need much less averaging to get a useful result.
Regards,
John