Skip to content

Commit d07ee5b

Browse files
committed
Add audiobusio.I2SOut() support to Zephyr
Relies on added SDL audio emulation.
1 parent 2a1f56e commit d07ee5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+906
-107
lines changed

locale/circuitpython.pot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,6 +2411,7 @@ msgstr ""
24112411
msgid "Update failed"
24122412
msgstr ""
24132413

2414+
#: ports/zephyr-cp/common-hal/audiobusio/I2SOut.c
24142415
#: ports/zephyr-cp/common-hal/busio/I2C.c
24152416
#: ports/zephyr-cp/common-hal/busio/SPI.c
24162417
#: ports/zephyr-cp/common-hal/busio/UART.c

ports/zephyr-cp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ run-sim:
6868
echo "Populating build-native_native_sim/flash.bin from ./CIRCUITPY"; \
6969
mcopy -s -i build-native_native_sim/flash.bin CIRCUITPY/* ::; \
7070
fi
71-
build-native_native_sim/firmware.exe --flash=build-native_native_sim/flash.bin --flash_rm -wait_uart -rt
71+
build-native_native_sim/firmware.exe --flash=build-native_native_sim/flash.bin --flash_rm -wait_uart -rt --i2s_capture=build-native_native_sim/i2s_capture.wav
7272

7373
menuconfig:
7474
west build $(WEST_SHIELD_ARGS) --sysbuild -d $(BUILD) -t menuconfig -- $(WEST_CMAKE_ARGS)

ports/zephyr-cp/background.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,7 @@
99
#include "py/runtime.h"
1010
#include "supervisor/port.h"
1111

12-
#if CIRCUITPY_DISPLAYIO
13-
#include "shared-module/displayio/__init__.h"
14-
#endif
15-
16-
#if CIRCUITPY_AUDIOBUSIO
17-
#include "common-hal/audiobusio/I2SOut.h"
18-
#endif
19-
20-
#if CIRCUITPY_AUDIOPWMIO
21-
#include "common-hal/audiopwmio/PWMAudioOut.h"
22-
#endif
12+
#include <zephyr/kernel.h>
2313

2414
void port_start_background_tick(void) {
2515
}
@@ -28,12 +18,7 @@ void port_finish_background_tick(void) {
2818
}
2919

3020
void port_background_tick(void) {
31-
#if CIRCUITPY_AUDIOPWMIO
32-
audiopwmout_background();
33-
#endif
34-
#if CIRCUITPY_AUDIOBUSIO
35-
i2s_background();
36-
#endif
21+
// No, ticks. We use Zephyr threads instead.
3722
}
3823

3924
void port_background_task(void) {

ports/zephyr-cp/boards/adafruit/feather_nrf52840_zephyr/autogen_board_info.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ keypad = false
6363
keypad_demux = false
6464
locale = false
6565
lvfontio = true # Zephyr board has busio
66-
math = false
66+
math = true
6767
max3421e = false
6868
mcp4822 = false
6969
mdns = false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_DMA_TCD_QUEUE_SIZE=4
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
&w25q512jvfiq {
2+
partitions {
3+
/delete-node/ storage_partition;
4+
circuitpy_partition: partition@620000 {
5+
label = "circuitpy";
6+
reg = <0x00620000 (DT_SIZE_M(58) - DT_SIZE_K(128))>;
7+
};
8+
}
9+
10+
};
11+
12+
#include "../app.overlay"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_DMA_TCD_QUEUE_SIZE=4

ports/zephyr-cp/boards/mimxrt1170_evk_mimxrt1176_cm7.overlay

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@
88
};
99
};
1010

11+
&sai1 {
12+
mclk-output;
13+
};
14+
1115
#include "../app.overlay"

ports/zephyr-cp/boards/native/native_sim/autogen_board_info.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ alarm = false
1515
analogbufio = false
1616
analogio = false
1717
atexit = false
18-
audiobusio = false
19-
audiocore = false
20-
audiodelays = false
21-
audiofilters = false
22-
audiofreeverb = false
18+
audiobusio = true # Zephyr board has audiobusio
19+
audiocore = true # Zephyr board has audiobusio
20+
audiodelays = true # Zephyr board has audiobusio
21+
audiofilters = true # Zephyr board has audiobusio
22+
audiofreeverb = true # Zephyr board has audiobusio
2323
audioio = false
24-
audiomixer = false
25-
audiomp3 = false
24+
audiomixer = true # Zephyr board has audiobusio
25+
audiomp3 = true # Zephyr board has audiobusio
2626
audiopwmio = false
2727
audiospeed = false
2828
aurora_epaper = false
@@ -63,7 +63,7 @@ keypad = false
6363
keypad_demux = false
6464
locale = false
6565
lvfontio = true # Zephyr board has busio
66-
math = false
66+
math = true
6767
max3421e = false
6868
mcp4822 = false
6969
mdns = false
@@ -97,7 +97,7 @@ ssl = false
9797
storage = true # Zephyr board has flash
9898
struct = true
9999
supervisor = true
100-
synthio = false
100+
synthio = true # Zephyr board has audiobusio
101101
terminalio = true # Zephyr board has busio
102102
tilepalettemapper = true # Zephyr board has busio
103103
time = true

ports/zephyr-cp/boards/native/nrf5340bsim/autogen_board_info.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ keypad = false
6363
keypad_demux = false
6464
locale = false
6565
lvfontio = true # Zephyr board has busio
66-
math = false
66+
math = true
6767
max3421e = false
6868
mcp4822 = false
6969
mdns = false

0 commit comments

Comments
 (0)