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

Add passive buzzer speaker support #21

Merged
merged 27 commits into from
Dec 31, 2022

Conversation

rafaelcruzpb
Copy link
Contributor

Add support for the passive buzzer speaker, with the possibility of playing various tones and even creating music (programmatically for now)

@arntsonl
Copy link
Contributor

That is a cool idea!! Are you in our discord channel? https://discord.gg/k2pxhke7q8 I'm lucipher, one of the mods on there.

I have some suggested changes and some code you can use to make this functional (On Device Connected) before we merge this into Main.

@Fortinbra Fortinbra added the enhancement New feature or request label Dec 21, 2022
Copy link
Contributor

@arntsonl arntsonl left a comment

Choose a reason for hiding this comment

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

#1 your web-config changes should be in the AddOns page rather than an entirely new page. I'm going to be adding an Enabled [x] flag to that page soonish, so all of our add-ons should be there

#2 your enum Tone can live in BuzzerSpeaker.cpp since none of the other files will use it. that helps encapsulate your defines inside of that file rather than having it defined everywhere

#3 processBuzzer, play, and stop can be private functions of BuzzerSpeakerAddon unless those functions need to be exposed as part of their required usage. it looks to me like process() can handle events so for now we can keep those hidden

and then for actual functional code for your buzzer: check out the code in here https://github.com/OpenStickCommunity/GP2040-CE/blob/main/src/addons/board_led.cpp from @debug, there's a USB mounted event you can poll from to play a song. that would be a good functional usage of this add-on

@rafaelcruzpb
Copy link
Contributor Author

rafaelcruzpb commented Dec 25, 2022

@arntsonl
These changes have been made.

About point #2 , Tone enum has dependency on .h file itself, and on songs.h file as well

@arntsonl arntsonl merged commit 8df68c3 into OpenStickCommunity:main Dec 31, 2022
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
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants