8000 Merge pull request #4399 from tyomitch/patch-2 · warmbit/circuitpython@bf58afd · GitHub
[go: up one dir, main page]

Skip to content

Commit bf58afd

Browse files
authored
Merge pull request adafruit#4399 from tyomitch/patch-2
[stm] implementation of audiopwmio
2 parents e962b24 + 4ee7812 commit bf58afd

File tree

14 files changed

+484
-6
lines changed

14 files changed

+484
-6
lines changed

locale/circuitpython.pot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ msgstr ""
411411
msgid "AnalogOut not supported on given pin"
412412
msgstr ""
413413

414+
#: ports/stm/common-hal/audiopwmio/PWMAudioOut.c
415+
msgid "Another PWMAudioOut is already active"
416+
msgstr ""
417+
414418
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
415419
#: ports/cxd56/common-hal/pulseio/PulseOut.c
416420
msgid "Another send is already active"
@@ -525,6 +529,7 @@ msgid "Buffer is too small"
525529
msgstr ""
526530

527531
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
532+
#: ports/stm/common-hal/audiopwmio/PWMAudioOut.c
528533
#, c-format
529534
msgid "Buffer length %d too big. It must be less than %d"
530535
msgstr ""
@@ -974,6 +979,10 @@ msgstr ""
974979
msgid "Failed to allocate wifi scan memory"
975980
msgstr ""
976981

982+
#: ports/stm/common-hal/audiopwmio/PWMAudioOut.c
983+
msgid "Failed to buffer the sample"
984+
msgstr ""
985+
977986
#: ports/nrf/common-hal/_bleio/Adapter.c
978987
msgid "Failed to connect: internal error"
979988
msgstr ""

ports/stm/boards/espruino_pico/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ LD_FILE = boards/STM32F401xd_fs.ld
2020
# lto for this port, and if other stuff hasn't been added in the
2121
# meantime
2222
CIRCUITPY_ULAB = 0
23+
CIRCUITPY_AUDIOCORE = 0
24+
CIRCUITPY_AUDIOPWMIO = 0
2325
CIRCUITPY_BUSDEVICE = 0
2426
CIRCUITPY_BITMAPTOOLS = 0
2527
CIRCUITPY_FRAMEBUFFERIO = 0

ports/stm/boards/espruino_wifi/mpconfigboard.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ MCU_PACKAGE = UFQFPN48
1111

1212
LD_COMMON = boards/common_default.ld
1313
LD_FILE = boards/STM32F411_fs.ld
14+
15+
# Too big for the flash
16+
CIRCUITPY_AUDIOCORE = 0
17+
CIRCUITPY_AUDIOPWMIO = 0

ports/stm/boards/meowbit_v121/board.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
#include "supervisor/board.h"
2828
#include "mpconfigboard.h"
2929

30+
#include "shared-bindings/audiopwmio/PWMAudioOut.h"
3031
#include "shared-bindings/board/__init__.h"
31-
#include "shared-bindings/displayio/FourWire.h"
3232
#include "shared-module/displayio/__init__.h"
3333
#include "shared-module/displayio/mipi_constants.h"
3434
#include "shared-bindings/busio/SPI.h"
3535

3636
#include "supervisor/spi_flash_api.h"
3737

38-
displayio_fourwire_obj_t board_display_obj;
38+
audiopwmio_pwmaudioout_obj_t board_buzz_obj;
3939

4040
#define DELAY 0x80
4141

@@ -113,6 +113,11 @@ void board_init(void) {
113113
60, // native_frames_per_second
114114
true, // backlight_on_high
115115
false); // SH1107_addressing
116+
117+
board_buzz_obj.base.type = &audiopwmio_pwmaudioout_type;
118+
common_hal_audiopwmio_pwmaudioout_construct(&board_buzz_obj,
119+
&pin_PB08, NULL, 0x8000);
120+
never_reset_pin_number(pin_PB08.port, pin_PB08.number);
116121
}
117122

118123
bool board_requests_safe_mode(void) {

ports/stm/boards/meowbit_v121/pins.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#include "shared-bindings/board/__init__.h"
22
#include "supervisor/spi_flash_api.h"
33

4+
#include "shared-bindings/audiopwmio/PWMAudioOut.h"
45
#include "shared-module/displayio/__init__.h"
56

7+
extern audiopwmio_pwmaudioout_obj_t board_buzz_obj;
8+
69
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
710
{ MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_PB04) },
811
{ MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_PB05) },
@@ -15,7 +18,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
1518
{ MP_ROM_QSTR(MP_QSTR_DISP_RST), MP_ROM_PTR(&pin_PB10) },
1619
{ MP_ROM_QSTR(MP_QSTR_DISP_BL), MP_ROM_PTR(&pin_PB03) },
1720

18-
{ MP_ROM_QSTR(MP_QSTR_BUZZ), MP_ROM_PTR(&pin_PB08) },
21+
{ MP_ROM_QSTR(MP_QSTR_BUZZ), MP_ROM_PTR(&board_buzz_obj) },
1922
{ MP_ROM_QSTR(MP_QSTR_BTNA), MP_ROM_PTR(&pin_PB09) },
2023
{ MP_ROM_QSTR(MP_QSTR_BTNB), MP_ROM_PTR(&pin_PC03) },
2124
{ MP_ROM_QSTR(MP_QSTR_RIGHT), MP_ROM_PTR(&pin_PB02) },

ports/stm/boards/pyb_nano_v2/mpconfigboard.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ MCU_PACKAGE = UFQFPN48
1212

1313
LD_COMMON = boards/common_default.ld
1414
LD_FILE = boards/STM32F411_fs.ld
15+
16+
# Too big for the flash
17+
CIRCUITPY_AUDIOCORE = 0
18+
CIRCUITPY_AUDIOPWMIO = 0

ports/stm/boards/stm32f411ce_blackpill/mpconfigboard.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ MCU_PACKAGE = UFQFPN48
1515

1616
LD_COMMON = boards/common_default.ld
1717
LD_FILE = boards/STM32F411_fs.ld
18+
19+
# Too big for the flash
20+
CIRCUITPY_AUDIOCORE = 0
21+
CIRCUITPY_AUDIOPWMIO = 0

ports/stm/boards/stm32f411ve_discovery/mpconfigboard.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ MCU_PACKAGE = LQFP100_f4
1111

1212
LD_COMMON = boards/common_default.ld
1313
LD_FILE = boards/STM32F411_fs.ld
14+
15+
# Too big for the flash
16+
CIRCUITPY_AUDIOCORE = 0
17+
CIRCUITPY_AUDIOPWMIO = 0

0 commit comments

Comments
 (0)
0