Skip to content

Commit

Permalink
Merge pull request #8906 from RetiredWizard/pimoroni_i2sfix
Browse files Browse the repository at this point in the history
Pimoroni DV Base: Fix i2s audio pin assignments
  • Loading branch information
tannewt authored Feb 13, 2024
2 parents 7af7517 + 44e5862 commit 722f75f
Show file tree
Hide file tree
Showing 74 changed files with 119 additions and 30 deletions.
1 change: 1 addition & 0 deletions ports/espressif/bindings/espnow/ESPNow.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ STATIC const mp_stream_p_t espnow_stream_p = {
//| This is an easy way to check if the buffer is empty.
//| """
//| ...
//|
//| def __len__(self) -> int:
//| """Return the number of `bytes` available to read. Used to implement ``len()``."""
//| ...
Expand Down
4 changes: 2 additions & 2 deletions ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) },

{ MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },
Expand All @@ -63,7 +63,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) },

{ MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) },
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/_bleio/CharacteristicBuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
//| :return: Data read
//| :rtype: bytes or None"""
//| ...
//|
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
//|
//| :return: number of bytes read and stored into ``buf``
//| :rtype: int or None (on a non-blocking error)"""
//| ...
//|
//| def readline(self) -> bytes:
//| """Read a line, ending in a newline character.
//|
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/_bleio/Connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
//| Connections may also be made when another device initiates a connection. To use a Connection
//| created by a peer, read the `Adapter.connections` property."""
//| ...
//|
//| def disconnect(self) -> None:
//| """Disconnects from the remote peripheral. Does nothing if already disconnected."""
//| ...
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/_bleio/Descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
//| and attached to a Characteristic by calling `add_to_characteristic()`.
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
//| as part of remote Characteristics in the remote Services that are discovered."""
//|
//| @classmethod
//| def add_to_characteristic(
//| cls,
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/_bleio/ScanEntry.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
//| ...
//|
//| def matches(self, prefixes: ScanEntry, *, match_all: bool = True) -> bool:
//| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter
//| than the scan filtering which accepts any advertisements that match any of the prefixes
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/_bleio/ScanResults.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) {
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
//| ...
//|
//| def __iter__(self) -> Iterator[ScanEntry]:
//| """Returns itself since it is the iterator."""
//| ...
//|
//| def __next__(self) -> ScanEntry:
//| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still
//| active. Raises `StopIteration` if scanning is finished and no other results are available.
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/_pixelmap/PixelMap.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_indices_obj, pixelmap_pixelmap_indic
//| def __getitem__(self, index: slice) -> PixelReturnSequence:
//| """Retrieve the value of the underlying pixels."""
//| ...
//|
//| @overload
//| def __getitem__(self, index: int) -> PixelReturnType:
//| """Retrieve the value of one of the underlying pixels at 'index'."""
//| ...
//|
//| @overload
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
//| @overload
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/adafruit_pixelbuf/PixelBuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_f
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
//| intensity from 0-1.0."""
//| ...
//|
//| @overload
//| def __getitem__(self, index: int) -> PixelReturnType:
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
//| intensity from 0-1.0."""
//| ...
//|
//| @overload
//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ...
//| @overload
Expand Down
3 changes: 3 additions & 0 deletions shared-bindings/alarm/SleepMemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@
//| def __init__(self) -> None:
//| """Not used. Access the sole instance through `alarm.sleep_memory`."""
//| ...
//|
//| def __bool__(self) -> bool:
//| """``sleep_memory`` is ``True`` if its length is greater than zero.
//| This is an easy way to check for its existence.
//| """
//| ...
//|
//| def __len__(self) -> int:
//| """Return the length. This is used by (`len`)"""
//| ...
Expand Down Expand Up @@ -87,6 +89,7 @@ STATIC MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_l
//| def __getitem__(self, index: int) -> int:
//| """Returns the value at the given index."""
//| ...
//|
//| @overload
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
//| @overload
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/canio/Listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_in_waiting_obj, canio_listener_i
//| This method exists so that `Listener` can be used as an
//| iterable"""
//| ...
//|
//| def __next__(self) -> Union[RemoteTransmissionRequest, Message]:
//| """Reads a message, after waiting up to self.timeout seconds
//|
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/displayio/Bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ MP_PROPERTY_GETTER(displayio_bitmap_height_obj,
//|
//| print(bitmap[0,1])"""
//| ...
//|
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
//| """Sets the value at the given index. The index can either be an x,y tuple or an int equal
//| to ``y * width + x``.
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/displayio/Group.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
//|
//| print(group[0])"""
//| ...
//|
//| def __setitem__(
//| self,
//| index: int,
Expand All @@ -294,6 +295,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
//|
//| group[0] = sprite"""
//| ...
//|
//| def __delitem__(self, index: int) -> None:
//| """Deletes the value at the given index.
//|
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/displayio/Palette.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
//| def __getitem__(self, index: int) -> Optional[int]:
//| r"""Return the pixel color at the given index as an integer."""
//| ...
//|
//| def __setitem__(
//| self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]]
//| ) -> None:
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/displayio/TileGrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ MP_PROPERTY_GETSET(displayio_tilegrid_bitmap_obj,
//|
//| print(grid[0])"""
//| ...
//|
//| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None:
//| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal
//| to ``y * width + x``.
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/fontio/BuiltinFont.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
//| The two element version is ``(width, height)``, in which
//| ``x_offset`` and ``y_offset`` are assumed to be zero."""
//| pass
//|
//| def get_glyph(self, codepoint: int) -> Optional[Glyph]:
//| """Retrieve the Glyph for a given code point
//|
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/keypad/EventQueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_eventqueue_clear_obj, keypad_eventqueue_clear);
//| This is an easy way to check if the queue is empty.
//| """
//| ...
//|
//| def __len__(self) -> int:
//| """Return the number of events currently in the queue. Used to implement ``len()``."""
//| ...
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/memorymap/AddressRange.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
//| rtc_slow_mem = memorymap.AddressRange(start=0x50000000, length=0x2000)
//| rtc_slow_mem[0:3] = b"\xcc\x10\x00"
//| """
//|

//| def __init__(self, *, start, length) -> None:
//| """Constructs an address range starting at ``start`` and ending at
Expand Down Expand Up @@ -108,6 +109,7 @@ STATIC MP_DEFINE_CONST_DICT(memorymap_addressrange_locals_dict, memorymap_addres
//| 1, 2, 4 and 8 byte aligned reads will be done in one transaction.
//| All others may use multiple transactions."""
//| ...
//|
//| @overload
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
//| @overload
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/nvm/ByteArray.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
//| import microcontroller
//| microcontroller.nvm[0:3] = b"\xcc\x10\x00"
//| """
//|

//| def __init__(self) -> None:
//| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`."""
Expand Down Expand Up @@ -76,6 +77,7 @@ STATIC MP_DEFINE_CONST_DICT(nvm_bytearray_locals_dict, nvm_bytearray_locals_dict
//| def __getitem__(self, index: int) -> int:
//| """Returns the value at the given index."""
//| ...
//|
//| @overload
//| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ...
//| @overload
Expand Down
8 changes: 8 additions & 0 deletions shared-bindings/storage/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,30 +276,38 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = {
//| larger filesystems, but you will need to format the filesystem on another device.
//| """
//| ...
//|
//| def open(self, path: str, mode: str) -> None:
//| """Like builtin ``open()``"""
//| ...
//|
//| def ilistdir(
//| self, path: str
//| ) -> Iterator[Union[Tuple[AnyStr, int, int, int], Tuple[AnyStr, int, int]]]:
//| """Return an iterator whose values describe files and folders within
//| ``path``"""
//| ...
//|
//| def mkdir(self, path: str) -> None:
//| """Like `os.mkdir`"""
//| ...
//|
//| def rmdir(self, path: str) -> None:
//| """Like `os.rmdir`"""
//| ...
//|
//| def stat(self, path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]:
//| """Like `os.stat`"""
//| ...
//|
//| def statvfs(self, path: int) -> Tuple[int, int, int, int, int, int, int, int, int, int]:
//| """Like `os.statvfs`"""
//| ...
//|
//| def mount(self, readonly: bool, mkfs: VfsFat) -> None:
//| """Don't call this directly, call `storage.mount`."""
//| ...
//|
//| def umount(self) -> None:
//| """Don't call this directly, call `storage.umount`."""
//| ...
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/synthio/LFO.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ STATIC const uint16_t triangle[] = {0, 32767, 0, -32767};
//|
//| def __init__(
//| self,
//| waveform: ReadableBuffer = None,
//| waveform: Optional[ReadableBuffer] = None,
//| *,
//| rate: BlockInput = 1.0,
//| scale: BlockInput = 1.0,
Expand Down
2 changes: 1 addition & 1 deletion shared-bindings/synthio/Note.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static const mp_arg_t note_properties[] = {
//| filter: Optional[Biquad] = None,
//| ring_frequency: float = 0.0,
//| ring_bend: float = 0.0,
//| ring_waveform: Optional[ReadableBuffer] = 0.0,
//| ring_waveform: Optional[ReadableBuffer] = None,
//| ) -> None:
//| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change).
//|
Expand Down
6 changes: 6 additions & 0 deletions shared-bindings/usb_cdc/Serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
//| """You cannot create an instance of `usb_cdc.Serial`.
//| The available instances are in the ``usb_cdc.serials`` tuple."""
//| ...
//|
//| def read(self, size: int = 1) -> bytes:
//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size
//| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``,
Expand All @@ -51,6 +52,7 @@
//| :return: Data read
//| :rtype: bytes"""
//| ...
//|
//| def readinto(self, buf: WriteableBuffer) -> int:
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. If `timeout`
//| is > 0 or ``None``, keep waiting until the timeout expires or ``len(buf)``
Expand All @@ -59,6 +61,7 @@
//| :return: number of bytes read and stored into ``buf``
//| :rtype: int"""
//| ...
//|
//| def readline(self, size: int = -1) -> Optional[bytes]:
//| r"""Read a line ending in a newline character ("\\n"), including the newline.
//| Return everything readable if no newline is found and ``timeout`` is 0.
Expand All @@ -71,6 +74,7 @@
//| :return: the line read
//| :rtype: bytes or None"""
//| ...
//|
//| def readlines(self) -> List[Optional[bytes]]:
//| """Read multiple lines as a list, using `readline()`.
//|
Expand All @@ -80,12 +84,14 @@
//| :return: a list of the line read
//| :rtype: list"""
//| ...
//|
//| def write(self, buf: ReadableBuffer) -> int:
//| """Write as many bytes as possible from the buffer of bytes.
//|
//| :return: the number of bytes written
//| :rtype: int"""
//| ...
//|
//| def flush(self) -> None:
//| """Force out any unwritten bytes, waiting until they are written."""
//| ...
Expand Down
1 change: 1 addition & 0 deletions shared-bindings/usb_midi/PortIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
//| :return: Data read
//| :rtype: bytes or None"""
//| ...
//|
//| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[bytes]:
//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
//| that many bytes. Otherwise, read at most ``len(buf)`` bytes.
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/wifi/ScannedNetworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ STATIC mp_obj_t scannednetworks_iternext(mp_obj_t self_in) {
//| def __init__(self) -> None:
//| """Cannot be instantiated directly. Use `wifi.Radio.start_scanning_networks`."""
//| ...
//|
//| def __iter__(self) -> Iterator[Network]:
//| """Returns itself since it is the iterator."""
//| ...
//|
//| def __next__(self) -> Network:
//| """Returns the next `wifi.Network`.
//| Raises `StopIteration` if scanning is finished and no other results are available."""
Expand Down
1 change: 1 addition & 0 deletions tests/cpydiff/builtin_next_arg2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
except StopIteration:
val = deflt
"""

print(next(iter(range(0)), 42))
1 change: 1 addition & 0 deletions tests/cpydiff/core_class_delnotimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cause: Unknown
workaround: Unknown
"""

import gc


Expand Down
1 change: 1 addition & 0 deletions tests/cpydiff/core_function_argcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cause: MicroPython counts "self" as an argument.
workaround: Interpret error messages with the information above in mind.
"""

try:
[].append()
except Exception as e:
Expand Down
1 change: 1 addition & 0 deletions tests/cpydiff/core_import_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cause: Not implemented.
workaround: Manually import the sub-modules directly in __init__.py using ``from . import foo, bar``.
"""

from modules3 import *

foo.hello()
1 change: 1 addition & 0 deletions tests/cpydiff/core_import_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cause: MicroPython doesn't support namespace packages split across filesystem. Beyond that, MicroPython's import system is highly optimized for minimal memory usage.
workaround: Details of import handling is inherently implementation dependent. Don't rely on such details in portable applications.
"""

import modules

print(modules.__path__)
1 change: 1 addition & 0 deletions tests/cpydiff/core_import_prereg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
cause: To make module handling more efficient, it's not wrapped with exception handling.
workaround: Test modules before production use; during development, use ``del sys.modules["name"]``, or just soft or hard reset the board.
"""

import sys

try:
Expand Down
Loading

0 comments on commit 722f75f

Please sign in to comment.