Skip to content

Commit 8ee4e02

Browse files
committed
Correct Missing Type Annotations
1 parent 4e7af08 commit 8ee4e02

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

adafruit_vs1053.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
try:
4949
from typing import Optional
50-
from digitalio import DigitalInOut
50+
from circuitpython_typing import ReadableBuffer
5151
from microcontroller import Pin
5252
from busio import SPI
5353
except ImportError:
@@ -99,7 +99,7 @@ class VS1053:
9999
# This is NOT thread/re-entrant safe (by design, for less memory hit).
100100
_SCI_SPI_BUFFER = bytearray(4)
101101

102-
def __init__(self, spi: SPI, cs: DigitalInOut, xdcs: Pin, dreq: Pin) -> None:
102+
def __init__(self, spi: SPI, cs: Pin, xdcs: Pin, dreq: Pin) -> None:
103103
# Create SPI device for VS1053
104104
self._cs = digitalio.DigitalInOut(cs)
105105
self._vs1053_spi = SPIDevice(
@@ -118,7 +118,7 @@ def __init__(self, spi: SPI, cs: DigitalInOut, xdcs: Pin, dreq: Pin) -> None:
118118
f"Expected version 4 (VS1053) but got: {self.version} Check wiring!"
119119
)
120120

121-
def _sci_write(self, address, value) -> None:
121+
def _sci_write(self, address: int, value: int) -> None:
122122
# Write a 16-bit big-endian value to the provided 8-bit address.
123123
self._SCI_SPI_BUFFER[0] = _VS1053_SCI_WRITE
124124
self._SCI_SPI_BUFFER[1] = address & 0xFF
@@ -218,7 +218,7 @@ def stop_playback(self) -> None:
218218
)
219219

220220
def play_data(
221-
self, data_buffer: bytearray, start: int = 0, end: Optional[int] = None
221+
self, data_buffer: ReadableBuffer, start: int = 0, end: Optional[int] = None
222222
):
223223
"""Send a buffer of file data to the VS1053 for playback. Make sure
224224
the ready_for_data property is True before calling!
@@ -235,7 +235,7 @@ def play_data(
235235
finally:
236236
self._xdcs.value = True
237237

238-
def sine_test(self, n: int, seconds: int):
238+
def sine_test(self, n: int, seconds: float) -> None:
239239
"""Play a sine wave for the specified number of seconds. Useful to
240240
test the VS1053 is working.
241241
"""

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44

55
Adafruit-Blinka
66
adafruit-circuitpython-busdevice
7+
adafruit-circuitpython-typing

0 commit comments

Comments
 (0)