Skip to content

[DRIVER] - Switch, debouncer and MockedGpio for unit testing#12

Merged
alrapal merged 1 commit intomainfrom
driver/switch
Jul 5, 2025
Merged

[DRIVER] - Switch, debouncer and MockedGpio for unit testing#12
alrapal merged 1 commit intomainfrom
driver/switch

Conversation

@alrapal
Copy link
Owner

@alrapal alrapal commented Jul 5, 2025

Description


  • Added a debouncer based on register shifting. Currently not
    configurable.

  • Added a switch driver that allows to create a simple switch, or add a
    debouncer to it for signal stabilisation

  • Added a test_utils.rs file with a MockedGpioPin inplementing the
    InputPin trait. This is to be able to test driver logic.

  • Unit test / integration tests for Debouncer and Switches

  • Fixed task to run unit tests using stable toolchain.

  • Added task to build flash and monitor based on the cargo run
    command.

  • Updated ZED ide tasks based on the vscode ones.

relates to #6

Contribute #6

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

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

  • Unit / Integration tests for debouncing logic
  • Unit / Integration tests for switch logic
  • Run on hardware and tested behavior to check that the presses were debounced

Test Configuration:

  • Firmware version: NA
  • Hardware: host / MacOS for UT and esp32s3 for firmware
  • Toolchain: stable

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 alrapal self-assigned this Jul 5, 2025
@alrapal alrapal added the enhancement New feature or request label Jul 5, 2025
@alrapal alrapal added this to the Switch milestone Jul 5, 2025
---

* Added a debouncer based on register shifting. Currently not
  configurable.
* Added a switch driver that allows to create a simple switch, or add a
  debouncer to it for signal stabilisation
* Added a `test_utils.rs` file with a MockedGpioPin inplementing the
  InputPin trait. This is to be able to test driver logic.
* Unit test / integration tests for Debouncer and Switches

* Fixed task to run unit tests using stable toolchain.
* Added task to build flash and monitor based on the `cargo run`
  command.
* Updated ZED ide tasks based on the vscode ones.

relates to #6
@alrapal alrapal merged commit 25a6c04 into main Jul 5, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant