Skip to content

Conversation

Workshopshed
Copy link

@Workshopshed Workshopshed commented Aug 1, 2025

Description

A driver for interacting with the XPT2046 resistive touch screen.

Motivation and Context

The SPI protocol used by this driver is quite complex and typical developers just want the X and Y values of the touch.
Created by referring to the datasheet and drivers in other languages.
Based the API on other touch controllers already in the repo such as the CHSC6540 and Ft6xx6x

How Has This Been Tested?

Ran this on an ESP32 based board which has a touch screen built in. Ensured that different touches produced outputs that were proportional to the position.

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

Summary by CodeRabbit

  • Chores
    • Added device category information for XPT2046.
    • Introduced versioning and release configuration for XPT2046.

DESKTOP-I0P6LF2\owner and others added 5 commits June 13, 2025 09:38
Readme and versioning

Example code copied from FT6xx6x driver
Driver work in progress
@nfbot
Copy link
Member

nfbot commented Aug 1, 2025

@Workshopshed I've fixed the checklist for you.
FYI, the correct format is [x], no spaces inside brackets, no other chars.

@nfbot nfbot added the Type: enhancement New feature or request label Aug 1, 2025
Copy link

coderabbitai bot commented Aug 1, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • .gitignore is excluded by none and included by none

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Two new files were added under the devices/XPT2046 directory. The category.txt file lists the device categories as "proximity" and "touch". The version.json file introduces versioning and release configuration using the NerdBank.GitVersioning schema, specifying version details and branch rules for releases.

Changes

Cohort / File(s) Change Summary
Device Category Metadata
devices/XPT2046/category.txt
Added a text file listing the device categories as "proximity" and "touch".
Versioning Configuration
devices/XPT2046/version.json
Added a JSON file with versioning and release configuration for the device using NerdBank.GitVersioning.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Workshopshed
Copy link
Author

@dotnet-policy-service agree

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39a0daf and cca77ce.

⛔ Files ignored due to path filters (13)
  • README.md is excluded by !**/*.md and included by none
  • devices/XPT2046/Point.cs is excluded by none and included by none
  • devices/XPT2046/Properties/AssemblyInfo.cs is excluded by none and included by none
  • devices/XPT2046/README.md is excluded by !**/*.md and included by none
  • devices/XPT2046/TouchDemo/Program.cs is excluded by none and included by none
  • devices/XPT2046/TouchDemo/TouchDemo.nfproj is excluded by none and included by none
  • devices/XPT2046/TouchDemo/TouchDemo.sln is excluded by none and included by none
  • devices/XPT2046/TouchDemo/packages.config is excluded by none and included by none
  • devices/XPT2046/XPT2046.cs is excluded by none and included by none
  • devices/XPT2046/XPT2046.nfproj is excluded by none and included by none
  • devices/XPT2046/XPT2046.nuspec is excluded by none and included by none
  • devices/XPT2046/XPT2046.sln is excluded by none and included by none
  • devices/XPT2046/packages.config is excluded by none and included by none
📒 Files selected for processing (2)
  • devices/XPT2046/category.txt (1 hunks)
  • devices/XPT2046/version.json (1 hunks)
🔇 Additional comments (1)
devices/XPT2046/category.txt (1)

1-3: Re-evaluate the “proximity” classification

The XPT2046 is strictly a resistive-touch controller; it does not provide proximity-sensing capabilities. Keeping an incorrect category may confuse consumers of the metadata and mis-categorise NuGet search results.

-proximity
 touch
+touch

Please confirm with the repo’s category taxonomy and drop the inaccurate entry (or justify its presence).

Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

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

just a quick review to start as once those adjusted, it will be faster for the rest. Thank you!


namespace TouchDemo
{

Copy link
Member

Choose a reason for hiding this comment

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

please look at the how to add the linter in the project, it will point you on couple of things to adjust in the project. See: https://github.com/nanoframework/nanoFramework.IoT.Device/blob/develop/StyleCop/README.md

Copy link
Author

@Workshopshed Workshopshed Aug 2, 2025

Choose a reason for hiding this comment

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

Didn't seem to work as expected. But manually copied the tags into the project and the style file into the folder. And that got me all the usual recommendations. Full stops, spaces etc

<FileAlignment>512</FileAlignment>
<RootNamespace>TouchDemo</RootNamespace>
<AssemblyName>TouchDemo</AssemblyName>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
Copy link
Member

Choose a reason for hiding this comment

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

see the other projects and add all the signing elements as well

Copy link
Author

@Workshopshed Workshopshed Aug 2, 2025

Choose a reason for hiding this comment

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

Already got:

<PropertyGroup>
    <SignAssembly>true</SignAssembly>
  </PropertyGroup>
  <PropertyGroup>
    <AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
  </PropertyGroup>
  <PropertyGroup>
    <DelaySign>false</DelaySign>
  </PropertyGroup>

Is there some kind of build step too?

Copy link
Member

Choose a reason for hiding this comment

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

For signing the assembly? Nope. Apart from the above, you have to add the key file.
We're using this pattern everywhere. You can take a look at pretty much every IoT binding project or library and you'll find it.

Copy link
Author

Choose a reason for hiding this comment

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

I just referenced the same key as the other projects.

Does the github configuration do the signing/publishing to Nuget or is the developer responsible?

DESKTOP-I0P6LF2\owner and others added 3 commits August 2, 2025 12:29
Added StyleCop to the project and followed recommendations.
Changed PowerMode constants to binary to be consistent with other constants.
Bumped version to 1
@josesimoes
Copy link
Member

All the packaging and publishing is handled by the pipeline. This has to be signed before distribution. Plus only authorized accounts can publish nugets for the nanoFramework org.

@Ellerbach
Copy link
Member

azp /run

@josesimoes
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Workshopshed
Copy link
Author

One warning from the build, guessing it doesn't apply to this specific build?

The windows-latest label will migrate from Windows Server 2022 to Windows Server 2025 beginning September 2, 2025. For more information see actions/runner-images#12677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants