Skip to content

Bidirectional I2S #9909

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bfa7db1
Initial build of I2SIn.
relic-se Nov 13, 2024
0daaeb4
Enable I2SIn on RP2xxx
relic-se Nov 13, 2024
5feb12f
Merge branch 'adafruit:main' into i2sin
relic-se Dec 18, 2024
805a6b1
Remove `record` method.
relic-se Dec 18, 2024
e30e234
Update audio dma to support independent input dma.
relic-se Dec 18, 2024
f1e6f01
Fix pointer issue with dma setup.
relic-se Dec 18, 2024
9a0d1c2
Only reset buffer if output is enabled.
relic-se Dec 18, 2024
d0e2b01
Rename `last_record` to `last_index`.
relic-se Dec 18, 2024
76ac311
Handle dma input write destination.
relic-se Dec 18, 2024
55d3252
Send bit width to start PIO program on `reset_buffer`.
relic-se Dec 18, 2024
be48374
Fix errors within PIO program.
relic-se Dec 21, 2024
3c97fd8
Run background tasks while waiting for next buffer.
relic-se Dec 21, 2024
15384bc
Add bidirectional I2S class.
relic-se Dec 23, 2024
dc6e67e
Start input dma channel before output dma channel to allow blocks to …
relic-se Dec 23, 2024
ececb9c
Remove bug comment.
relic-se Dec 23, 2024
3d1a16d
Merge branch 'adafruit:main' into i2sin
relic-se Dec 23, 2024
1e9d455
Fix formatting errors.
relic-se Dec 23, 2024
c6bdd36
Fix input playback example.
relic-se Dec 23, 2024
05c719f
Add empty files within other port families to fix builds.
relic-se Dec 23, 2024
7c6f010
Add record method.
relic-se Dec 23, 2024
c04489c
Merge branch 'adafruit:main' into i2sin
relic-se Jan 18, 2025
c8499a5
Support 32-bit pio pin mask.
relic-se Jan 18, 2025
1aaf4f1
Return number of samples recorded.
relic-se Jan 22, 2025
851765e
Improve dma initialization.
relic-se Jan 22, 2025
4b82933
Double-buffering and improved buffer testing.
relic-se Jan 23, 2025
d47fdf8
Merge branch 'main' into i2sin
relic-se May 8, 2025
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
Prev Previous commit
Next Next commit
Add empty files within other port families to fix builds.
  • Loading branch information
relic-se committed Dec 23, 2024
commit 05c719fa791f7e6977d9477c45bd37d552ce04dc
7 changes: 7 additions & 0 deletions ports/atmel-samd/common-hal/audiobusio/I2S.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2 is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/atmel-samd/common-hal/audiobusio/I2S.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2 is not enabled on this family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/atmel-samd/common-hal/audiobusio/I2SIn.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2In is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/atmel-samd/common-hal/audiobusio/I2SIn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2In is not enabled on this family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/espressif/common-hal/audiobusio/I2S.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2 is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/espressif/common-hal/audiobusio/I2S.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2 is not enabled on this family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/espressif/common-hal/audiobusio/I2SIn.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2In is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/espressif/common-hal/audiobusio/I2SIn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2In is not enabled on this family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/mimxrt10xx/common-hal/audiobusio/I2S.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2 is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/mimxrt10xx/common-hal/audiobusio/I2S.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2 is not enabled on this family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/mimxrt10xx/common-hal/audiobusio/I2SIn.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2In is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/mimxrt10xx/common-hal/audiobusio/I2SIn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2In is not enabled on this family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/nordic/common-hal/audiobusio/I2S.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2 is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/nordic/common-hal/audiobusio/I2S.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2 is not enabled on this family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/nordic/common-hal/audiobusio/I2SIn.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2In is not enabled on this family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/nordic/common-hal/audiobusio/I2SIn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2In is not enabled on this family, this file is still required for the build to pass
1 change: 1 addition & 0 deletions ports/raspberrypi/common-hal/audiobusio/I2S.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void common_hal_audiobusio_i2s_construct(audiobusio_i2s_obj_t *self,
void i2s_configure_audio_dma(audiobusio_i2s_obj_t *self, mp_obj_t sample, bool loop, uint32_t sample_rate, uint8_t bits_per_sample) {

if (self->dma.output_channel[0] != NUM_DMA_CHANNELS || self->dma.input_channel[0] != NUM_DMA_CHANNELS) {
return;
if (self->state_machine.out) {
audio_dma_stop_output(&self->dma);
}
Expand Down
7 changes: 7 additions & 0 deletions ports/stm/common-hal/audiobusio/I2S.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2 is not enabled on the STM32L4 family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/stm/common-hal/audiobusio/I2S.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2 is not enabled on the STM32L4 family, this file is still required for the build to pass
7 changes: 7 additions & 0 deletions ports/stm/common-hal/audiobusio/I2SIn.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

// Although IS2In is not enabled on the STM32L4 family, this file is still required for the build to pass
11 changes: 11 additions & 0 deletions ports/stm/common-hal/audiobusio/I2SIn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2024 Cooper Dalrymple
//
// SPDX-License-Identifier: MIT

#pragma once

#include "shared-module/audiocore/__init__.h"

// Although IS2In is not enabled on the STM32L4 family, this file is still required for the build to pass
Loading