From 2bdccf03a722fc1bdb0434e96361d3d8acd0ca09 Mon Sep 17 00:00:00 2001 From: jepler Date: Fri, 1 Nov 2019 16:25:34 -0500 Subject: [PATCH] cpb: define the SPEAKER_ENABLE_PIN 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 --- ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h index 1e55cd0260..8c2018925e 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h +++ b/ports/nrf/boards/circuitplayground_bluefruit/mpconfigboard.h @@ -70,3 +70,5 @@ #define DEFAULT_UART_BUS_RX (&pin_P0_30) #define DEFAULT_UART_BUS_TX (&pin_P0_14) + +#define SPEAKER_ENABLE_PIN (&pin_P1_04)