Skip to content

Conversation

@alrapal
Copy link
Owner

@alrapal alrapal commented Jun 17, 2025

Description

Includes a flexible driver for Rotary Encoder.
The driver can be configured to include a switch, and that switch can be either based on gpio interrupt or polled.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Template from Embedded Artistry

alrapal added 2 commits June 17, 2025 07:17
---

- Hy040 struct uses 16 states to interprete the direction in which the
  encoder is being rotated
- The update method reads the direction from the encoder.
- Update of the state uses the Timer interrupt and not GPIO because the gpio interrupts where too sensitive and did not provide reliable results.

- Main is refactored for a the following logic:
  - The boot button changes the color of the circle
  - The rotary changes the size of the circle printed on the screen
  - The switch on the rotary resets the screen and counter

- SpiPeripheral struct is more flexible with lifetimes.
---

- Refactored the encoder to use Type State Pattern
  - Encoder functionnalities
  - Encoder + switch functionnalities
  - Encoder + gpio interrupt based switch
- Moved rotary_ecnoder.rs in hardware since relies on esp_hal and thus,
  not hardware agnostic.

- Adapted main logic accordingly
- Adapted libraries accordingly
@alrapal alrapal closed this Jul 6, 2025
@alrapal alrapal deleted the driver/hy-040 branch July 6, 2025 09:14
@alrapal
Copy link
Owner Author

alrapal commented Jul 6, 2025

Closed to recreate a branch based on workspace structure

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.

1 participant