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

feat(power): Support power button and power LED #2

Merged
merged 4 commits into from
Dec 27, 2023
Merged

Conversation

XavierBrassoud
Copy link
Owner

@XavierBrassoud XavierBrassoud commented Dec 27, 2023

Implements 3 new methods:

/**
* @brief Determine if the power button is pressed or not. The power button has a dedicated pin.
*
* @return true
* @return false
*/
bool isPowerButtonPressed();

/**
* @brief Control the state of the power led (active LOW).
* Depends on synchronize().
* 
* @param state LOW: on / HIGH: off
*/
void writePowerLed(uint8_t state);

/**
* @brief Get the state of the power led (active LOW).
*
* @return uint8_t LOW: on
* @return uint8_t HIGH: off
*/
uint8_t readPowerLed();

Synchronize states through synchronize():

/**
* @brief Read and write to shift registers that control buttons, power led and display.
* Called each time a refresh is needed.
*/
void synchronize();

Behavior of readButons() changes due to new synchronize() method. It's mandatory to call synchronize() prior to readButons():

controlPanel.synchronize();
buttons = controlPanel.readButons();

Examples OneButton updated and blink added.

@XavierBrassoud XavierBrassoud merged commit 0e2b13c into main Dec 27, 2023
@XavierBrassoud XavierBrassoud deleted the feat/power branch December 27, 2023 22:39
XavierBrassoud added a commit that referenced this pull request Mar 7, 2024
XavierBrassoud added a commit that referenced this pull request May 2, 2024
* ci: Initialize CI pipelines

Add release-please

* Add Arduino, C++ and PR title linters

* Test c++ linter

* Remove matrix

* Fix cpp lint style

* Define .clang-format style

* Clang format

* Refactor: clang-tidy compliant

* ci: cpp-linter adaptations

* Provide action permissions

* Move permissions

* test permissions #2

* Test permissions #3

* Test permissions  #4

* Ignore extras from quality

Extras are written following external library conventions

* Update clang-tidy version

* Install Arduino CLI

* Switch to PIO checks for consistency

* Fix clang-tidy

* Add clang-format

* Add voluntary format error

* clang-format

* Fix release-please

* Fix release-please missing files

* Remove testing branch from release

* Fix duplicate launched action: Quality Gates

* Enhance PIO build process

* Fix cast issues

* Allow all architectures

* Update example section

* Add arduino-lint

* Add CONTRIBUTING.md

* Publish to PlatformIO Library manager

* Switch Arduino lint to submit

Switch back to "update" when approved by the Arduino Team

* Rename scripts folder to pio-tools

* Set lib_deps per example

* Add sponsorship program

* Shortened sentence in "using display" section
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.

None yet

1 participant