Skip to content

cpb: Disable the onboard speaker until request #2262

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

Merged
merged 2 commits into from
Nov 3, 2019

Conversation

jepler
Copy link

@jepler jepler commented Nov 1, 2019

This allows the board to disable the onboard speaker until explicitly enabled in user code.

Testing performed on a CPB:

  • Touching the AUDIO pin with a fingertip no longer generates noise/buzz
  • Generating a waveform with simpleio.tone produces no sound by default
  • When the board.SPEAKER_ENABLE is configured as a digital output and
    set True, simpleio.tone does produce sound

Note that while guides should include information about SPEAKER_ENABLE, it's possible that some users who omitted it could view this as a breaking change. They can fix it by simply adding code similar to

speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
speaker_enable.direction = digitalio.Direction.OUTPUT
speaker_enable.value = True

before using the internal speaker.

Closes: #2258

.. the existing code, which was never activated by the preprocessor,
wasn't quite right.
This allows the board to disable the onboard speaker until explicitly
enabled in user code.

Testing performed on a CPB:
 * Touching the AUDIO pin with a fingertip no longer generates noise/buzz
 * Generating a waveform with `simpleio.tone` produces no sound by default
 * When the board.SPEAKER_ENABLE is configured as a digital output and
   set True, `simpleio.tone` does produce sound

Note that while guides should include information about SPEAKER_ENABLE, it's
possible that some users who omitted it could view this as a breaking change.
They can fix it by simply adding code similar to

    speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
    speaker_enable.direction = digitalio.Direction.OUTPUT
    speaker_enable.value = True

before using the internal speaker.

Closes: adafruit#2258
@dhalbert
Copy link
Collaborator

dhalbert commented Nov 1, 2019

Checked that https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground already manages this pin as would be expected.

@tannewt tannewt requested a review from dhalbert November 1, 2019 23:40
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Thanks!

@dhalbert dhalbert merged commit e3638ff into adafruit:master Nov 3, 2019
@jepler jepler deleted the cpb-speaker-disable branch November 3, 2021 21:09
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.

Disable CircuitPlayground Bluefruit speaker by default
2 participants