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

[stm] implementation of audiopwmio #4399

Merged
merged 2 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ msgstr ""
msgid "AnalogOut not supported on given pin"
msgstr ""

#: ports/stm/common-hal/audiopwmio/PWMAudioOut.c
msgid "Another PWMAudioOut is already active"
msgstr ""

#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/cxd56/common-hal/pulseio/PulseOut.c
msgid "Another send is already active"
Expand Down Expand Up @@ -525,6 +529,7 @@ msgid "Buffer is too small"
msgstr ""

#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/stm/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
Expand Down Expand Up @@ -974,6 +979,10 @@ msgstr ""
msgid "Failed to allocate wifi scan memory"
msgstr ""

#: ports/stm/common-hal/audiopwmio/PWMAudioOut.c
msgid "Failed to buffer the sample"
msgstr ""

#: ports/nrf/common-hal/_bleio/Adapter.c
msgid "Failed to connect: internal error"
msgstr ""
Expand Down
2 changes: 2 additions & 0 deletions ports/stm/boards/espruino_pico/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ LD_FILE = boards/STM32F401xd_fs.ld
# lto for this port, and if other stuff hasn't been added in the
# meantime
CIRCUITPY_ULAB = 0
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_AUDIOPWMIO = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_FRAMEBUFFERIO = 0
Expand Down
4 changes: 4 additions & 0 deletions ports/stm/boards/espruino_wifi/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ MCU_PACKAGE = UFQFPN48

LD_COMMON = boards/common_default.ld
LD_FILE = boards/STM32F411_fs.ld

# Too big for the flash
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_AUDIOPWMIO = 0
9 changes: 7 additions & 2 deletions ports/stm/boards/meowbit_v121/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
#include "supervisor/board.h"
#include "mpconfigboard.h"

#include "shared-bindings/audiopwmio/PWMAudioOut.h"
#include "shared-bindings/board/__init__.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"
#include "shared-bindings/busio/SPI.h"

#include "supervisor/spi_flash_api.h"

displayio_fourwire_obj_t board_display_obj;
audiopwmio_pwmaudioout_obj_t board_buzz_obj;

#define DELAY 0x80

Expand Down Expand Up @@ -113,6 +113,11 @@ void board_init(void) {
60, // native_frames_per_second
true, // backlight_on_high
false); // SH1107_addressing

board_buzz_obj.base.type = &audiopwmio_pwmaudioout_type;
common_hal_audiopwmio_pwmaudioout_construct(&board_buzz_obj,
&pin_PB08, NULL, 0x8000);
never_reset_pin_number(pin_PB08.port, pin_PB08.number);
}

bool board_requests_safe_mode(void) {
Expand Down
5 changes: 4 additions & 1 deletion ports/stm/boards/meowbit_v121/pins.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include "shared-bindings/board/__init__.h"
#include "supervisor/spi_flash_api.h"

#include "shared-bindings/audiopwmio/PWMAudioOut.h"
#include "shared-module/displayio/__init__.h"

extern audiopwmio_pwmaudioout_obj_t board_buzz_obj;

STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_PB05) },
Expand All @@ -15,7 +18,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_DISP_RST), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_DISP_BL), MP_ROM_PTR(&pin_PB03) },

{ MP_ROM_QSTR(MP_QSTR_BUZZ), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_BUZZ), MP_ROM_PTR(&board_buzz_obj) },
{ MP_ROM_QSTR(MP_QSTR_BTNA), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_BTNB), MP_ROM_PTR(&pin_PC03) },
{ MP_ROM_QSTR(MP_QSTR_RIGHT), MP_ROM_PTR(&pin_PB02) },
Expand Down
4 changes: 4 additions & 0 deletions ports/stm/boards/pyb_nano_v2/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ MCU_PACKAGE = UFQFPN48

LD_COMMON = boards/common_default.ld
LD_FILE = boards/STM32F411_fs.ld

# Too big for the flash
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_AUDIOPWMIO = 0
4 changes: 4 additions & 0 deletions ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ MCU_PACKAGE = UFQFPN48

LD_COMMON = boards/common_default.ld
LD_FILE = boards/STM32F411_fs.ld

# Too big for the flash
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_AUDIOPWMIO = 0
4 changes: 4 additions & 0 deletions ports/stm/boards/stm32f411ve_discovery/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ MCU_PACKAGE = LQFP100_f4

LD_COMMON = boards/common_default.ld
LD_FILE = boards/STM32F411_fs.ld

# Too big for the flash
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_AUDIOPWMIO = 0
Loading