Skip to content

Comments

Fixes issue #13. Delay reading the button.#14

Merged
devanlai merged 4 commits intodevanlai:masterfrom
0x3333:master
Aug 9, 2019
Merged

Fixes issue #13. Delay reading the button.#14
devanlai merged 4 commits intodevanlai:masterfrom
0x3333:master

Conversation

@0x3333
Copy link
Contributor

@0x3333 0x3333 commented Aug 9, 2019

This PR adds a delay before reading the button state, in case the board has a debounce capacitor.

In a 72Mhz it will take approximately 20ms.

Copy link
Owner

@devanlai devanlai left a comment

Choose a reason for hiding this comment

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

Adding a delay seems like an appropriate fix for the case where you don't have a reset button and can only reset to the bootloader by holding down the button and powering up the board.

The only change I would like to see would be replacing the hard coded cycle count with a board-specific config define, since the necessary number of cycles will depend on both the clock speed and the external RC time constant. Maybe call it something like BUTTON_SAMPLE_DELAY_CYCLES.

@0x3333
Copy link
Contributor Author

0x3333 commented Aug 9, 2019

That is exactly my situation.

Nice addition, will update the PR.

@0x3333
Copy link
Contributor Author

0x3333 commented Aug 9, 2019

Done.

@devanlai devanlai merged commit aee636b into devanlai:master Aug 9, 2019
@devanlai
Copy link
Owner

devanlai commented Aug 9, 2019

Thanks for finding this overlooked case and fixing it!

devanlai added a commit that referenced this pull request Aug 9, 2019
Issue #14 Fix a miserable typo.
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