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

STM32-TSC: enable discriminating between pins within same TSC group and improve TSC library in general #3274

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michelrandahl
Copy link
Contributor

@michelrandahl michelrandahl commented Aug 21, 2024

TSC Driver Updates

Introduction

This PR significantly enhances the TSC (Touch Sensing Controller) driver to improve its functionality, usability, and support for more complex touch sensing scenarios.

Key Changes

  • Add support for reading multiple channel pins from the same TSC group
  • Refactor TSC API for improved usability
  • Introduce compile-time role validation for TSC pins
  • Simplify mask creation process
  • Restructure code into multiple module files

Notable Implementation Details

  • Introduce TscAcquisitionBank to manage TSC channel pin collections
    • Purpose: STM32 TSC hardware can only read one channel per group in each acquisition
    • Acquisition banks allow efficient management of multiple channels across different groups
  • Add methods for creating and using acquisition banks
  • Implement wrapper types PinGroupWithRoles and TscIOPinWithRole for compile-time role validation
  • Modify set_io1, set_io2, set_io3, and set_io4 methods to return TscIOPinWithRole
    • Enables easy creation of acquisition banks
    • Allows use of the TscIOPin values in subsequent code logic
  • Automate mask creation based on pins defined in PinGroups
    • Eliminates need for manual mask creation by users
  • Update mask handling for selective channel reading
  • Split code into more module files

Additional Changes

  • Expand documentation
  • Add and update examples for STM32 L0, L4, F3, and U5 series
    • L0, L4, and F3 examples are designed for easy setup on Nucleo boards
      • Only basic components (appropriate resistors and capacitors) required
  • Add README files to STM32 board examples, inspired by PR Add docs to all stm32f4 examples #3077

Backward Compatibility

These changes introduce breaking changes to the current TSC implementation. However, as TSC does not seem to be part of any official embassy-stm32 release yet, I suppose that this is okay.

Testing

  • Implemented examples for STM32L0, STM32F3, and STM32L4 series
  • Tested on Nucleo-L073RZ, Nucleo-F303ZE, and Nucleo-L4R5ZI-P boards
  • Updated existing example for STM32U5, however I don't own any boards in this family to test with myself
  • tsc_multipin.rs examples demonstrates the use of new acquisition banks to read multiple TSC channel pins from the same TSC group

@michelrandahl michelrandahl force-pushed the discriminating-pins-within-tsc-group branch 7 times, most recently from 1a5fb2a to 7d93a02 Compare August 23, 2024 14:35
@michelrandahl michelrandahl force-pushed the discriminating-pins-within-tsc-group branch from 7d93a02 to f6384d3 Compare September 13, 2024 19:46
@michelrandahl michelrandahl changed the title STM32-TSC: enable discriminating between pins within same TSC group and improve TSC library ergonomics in general STM32-TSC: enable discriminating between pins within same TSC group and improve TSC library in general Sep 13, 2024
@michelrandahl michelrandahl force-pushed the discriminating-pins-within-tsc-group branch 7 times, most recently from 851a927 to 12d1e7d Compare September 16, 2024 19:03
@michelrandahl michelrandahl force-pushed the discriminating-pins-within-tsc-group branch from 12d1e7d to fba76f4 Compare September 17, 2024 07:45
@michelrandahl michelrandahl marked this pull request as ready for review September 17, 2024 08:48
@michelrandahl
Copy link
Contributor Author

@Eekle, @kkoppul2, @beastbytes

I've made significant updates to the TSC driver that you've previously contributed to and might still have interest in. While you may not have approval rights for this repo, I'd appreciate any insights you might have.

@Eekle
Copy link
Contributor

Eekle commented Sep 17, 2024

The small additions I made the TSC driver are pretty much my greatest contribution to embassy :P So I don't really feel I can offer you much insight, unfortunately.

But thank you for working on this peripheral, and good luck!

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

Successfully merging this pull request may close these issues.

2 participants