Made suggested changes
This commit is contained in:
parent
ac113fdc81
commit
522b17ca93
@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length,
|
||||
}
|
||||
}
|
||||
|
||||
//| def encrypt_into(src: Union[bytes, bytearray, memoryview], dest: Union[bytes, bytearray, memoryview]) -> None:
|
||||
//| def encrypt_into(src: Union[bytearray, memoryview], dest: Union[bytearray, memoryview]) -> None:
|
||||
//| """Encrypt the buffer from ``src`` into ``dest``.
|
||||
//|
|
||||
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
|
||||
@ -183,7 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
|
||||
aesio_aes_encrypt_into);
|
||||
|
||||
//| def decrypt_into(src: Union[bytes, bytearray, memoryview], dest: Union[bytes, bytearray, memoryview]) -> None:
|
||||
//| def decrypt_into(src: Union[bytearray, memoryview], dest: Union[bytearray, memoryview]) -> None:
|
||||
//|
|
||||
//| """Decrypt the buffer from ``src`` into ``dest``.
|
||||
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
|
||||
|
@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args)
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__);
|
||||
|
||||
//| value: None = ...
|
||||
//| value: int = ...
|
||||
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
|
||||
//|
|
||||
//| Even if the underlying digital to analog converter (DAC) is lower
|
||||
|
@ -147,7 +147,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__);
|
||||
|
||||
|
||||
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixe.Mixer], *, loop: Any = False) -> None:
|
||||
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixe.Mixer], *, loop: bool = False) -> None:
|
||||
//| """Plays the sample once when loop=False and continuously when loop=True.
|
||||
//| Does not block. Use `playing` to block.
|
||||
//|
|
||||
|
@ -168,7 +168,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *arg
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, audiobusio_pdmin_obj___exit__);
|
||||
|
||||
|
||||
//| def record(self, destination: Union[bytes, bytearray, memoryview], destination_length: int) -> None:
|
||||
//| def record(self, destination: Union[bytearray, memoryview], destination_length: int) -> None:
|
||||
//| """Records destination_length bytes of samples to destination. This is
|
||||
//| blocking.
|
||||
//|
|
||||
|
@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__);
|
||||
|
||||
//| sample_rate: Optional(int) = ...
|
||||
//| sample_rate: Optional[int] = ...
|
||||
//| """32 bit value that dictates how quickly samples are loaded into the DAC
|
||||
//| in Hertz (cycles per second). When the sample is looped, this can change
|
||||
//| the pitch output without changing the underlying sample."""
|
||||
|
@ -111,7 +111,7 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
//| def deinit(self, ) -> None:
|
||||
//| def deinit(self) -> None:
|
||||
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
|
||||
//| ...
|
||||
//|
|
||||
@ -127,13 +127,13 @@ STATIC void check_for_deinit(audioio_audioout_obj_t *self) {
|
||||
raise_deinited_error();
|
||||
}
|
||||
}
|
||||
//| def __enter__(self, ) -> AudioOut:
|
||||
//| def __enter__(self) -> AudioOut:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
//|
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| def __exit__(self, ) -> None:
|
||||
//| def __exit__(self) -> None:
|
||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||
//| ...
|
||||
@ -175,7 +175,7 @@ STATIC mp_obj_t audioio_audioout_obj_play(size_t n_args, const mp_obj_t *pos_arg
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audioio_audioout_play_obj, 1, audioio_audioout_obj_play);
|
||||
|
||||
//| def stop(self, ) -> None:
|
||||
//| def stop(self) -> None:
|
||||
//| """Stops playback and resets to the start of the sample."""
|
||||
//| ...
|
||||
//|
|
||||
@ -204,7 +204,7 @@ const mp_obj_property_t audioio_audioout_playing_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| def pause(self, ) -> None:
|
||||
//| def pause(self) -> None:
|
||||
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
||||
//| ...
|
||||
//|
|
||||
@ -220,7 +220,7 @@ STATIC mp_obj_t audioio_audioout_obj_pause(mp_obj_t self_in) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_pause_obj, audioio_audioout_obj_pause);
|
||||
|
||||
//| def resume(self, ) -> None:
|
||||
//| def resume(self) -> None:
|
||||
//| """Resumes sample playback after :py:func:`pause`."""
|
||||
//| ...
|
||||
//|
|
||||
|
@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
|
||||
|
||||
//| level: None = ...
|
||||
//| level: float = ...
|
||||
//| """The volume level of a voice, as a floating point number between 0 and 1."""
|
||||
//|
|
||||
STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
//| class MP3:
|
||||
//| """Load a mp3 file for audio playback"""
|
||||
//|
|
||||
//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytes, bytearray, memoryview]):
|
||||
//| def __init__(self, file: typing.BinaryIO, buffer: Union[bytearray, memoryview]):
|
||||
//|
|
||||
//| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
||||
//|
|
||||
|
@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock);
|
||||
|
||||
//| def readfrom_into(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None:
|
||||
//| def readfrom_into(self, address: int, buffer: Union[bytearray, memoryview], *, start: int = 0, end: int = None) -> None:
|
||||
//| """Read into ``buffer`` from the device selected by ``address``.
|
||||
//| The number of bytes read will be the length of ``buffer``.
|
||||
//| At least one byte must be read.
|
||||
@ -277,7 +277,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto);
|
||||
|
||||
|
||||
//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||
//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
|
||||
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
|
||||
//| ``in_buffer`` can be the same buffer because they are used sequentially.
|
||||
|
@ -224,7 +224,7 @@ STATIC mp_obj_t bitbangio_spi_write(mp_obj_t self_in, mp_obj_t wr_buf) {
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(bitbangio_spi_write_obj, bitbangio_spi_write);
|
||||
|
||||
|
||||
//| def readinto(self, buf: Union[bytes, bytearray, memoryview]) -> None:
|
||||
//| def readinto(self, buf: Union[bytearray, memoryview]) -> None:
|
||||
//| """Read into the buffer specified by ``buf`` while writing zeroes.
|
||||
//| Requires the SPI being locked.
|
||||
//| If the number of bytes to read is 0, nothing happens."""
|
||||
@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto);
|
||||
|
||||
//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||
//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
|
||||
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
|
||||
//| must be equal.
|
||||
|
@ -176,7 +176,7 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock);
|
||||
|
||||
//| def readfrom_into(self, address: int, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None:
|
||||
//| def readfrom_into(self, address: int, buffer: Union[bytearray, memoryview], *, start: int = 0, end: int = None) -> None:
|
||||
//| """Read into ``buffer`` from the device selected by ``address``.
|
||||
//| The number of bytes read will be the length of ``buffer``.
|
||||
//| At least one byte must be read.
|
||||
@ -287,7 +287,7 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);
|
||||
|
||||
//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||
//| def writeto_then_readfrom(self, address: int, out_buffer: Union[bytes, bytearray, memoryview], in_buffer: Union[bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
|
||||
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
|
||||
//| ``in_buffer`` can be the same buffer because they are used sequentially.
|
||||
|
@ -228,7 +228,7 @@ STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock);
|
||||
|
||||
//| def write(self, buffer: bytes, *, start: int = 0, end: int = None) -> None:
|
||||
//| def write(self, buffer: Union[bytes, bytearray, memoryview], *, start: int = 0, end: int = None) -> None:
|
||||
//| """Write the data contained in ``buffer``. The SPI object must be locked.
|
||||
//| If the buffer is empty, nothing happens.
|
||||
//|
|
||||
@ -314,7 +314,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 2, busio_spi_readinto);
|
||||
|
||||
//| def write_readinto(self, buffer_out: bytearray, buffer_in: bytearray, *, out_start: int = 0, out_end: int = None, in_start: None = 0, in_end: int = None) -> None:
|
||||
//| def write_readinto(self, buffer_out: Union[bytes, bytearray, memoryview], buffer_in: Union[bytes, bytearray, memoryview], *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
|
||||
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
|
||||
//| The SPI object must be locked.
|
||||
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
|
||||
|
@ -190,7 +190,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_
|
||||
//| ...
|
||||
//|
|
||||
|
||||
//| def readinto(self, buf: bytes) -> Optional[int]:
|
||||
//| def readinto(self, buf: Union[bytearray, memoryview]) -> Optional[int]:
|
||||
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
|
||||
//|
|
||||
//| :return: number of bytes read and stored into ``buf``
|
||||
@ -200,7 +200,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_
|
||||
//| ...
|
||||
//|
|
||||
|
||||
//| def readline(self, ) -> Optional[int]:
|
||||
//| def readline(self, ) -> bytes:
|
||||
//| """Read a line, ending in a newline character.
|
||||
//|
|
||||
//| :return: the line read
|
||||
@ -208,7 +208,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_
|
||||
//| ...
|
||||
//|
|
||||
|
||||
//| def write(self, buf: bytearray) -> Optional[int]:
|
||||
//| def write(self, buf: Union[bytearray, memoryview]) -> Optional[int]:
|
||||
//| """Write the buffer of bytes to the bus.
|
||||
//|
|
||||
//| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string.
|
||||
|
Loading…
Reference in New Issue
Block a user