Did first 3
This commit is contained in:
parent
a2a32fea1a
commit
7ff9b9bc80
@ -37,7 +37,9 @@
|
||||
#include "shared-bindings/util.h"
|
||||
|
||||
//| class AnalogIn:
|
||||
//|""":class:`AnalogIn` -- read analog voltage
|
||||
//| """.. currentmodule:: analogio
|
||||
//|
|
||||
//| :class:`AnalogIn` -- read analog voltage
|
||||
//| ============================================
|
||||
//|
|
||||
//| Usage::
|
||||
@ -48,13 +50,14 @@
|
||||
//| adc = analogio.AnalogIn(A1)
|
||||
//| val = adc.value"""
|
||||
//|
|
||||
|
||||
//| def __init__(self, pin: microcontroller.Pin):
|
||||
//|
|
||||
//| """Use the AnalogIn on the given pin. The reference voltage varies by
|
||||
//| platform so use ``reference_voltage`` to read the configured setting.
|
||||
//|
|
||||
//| :param ~microcontroller.Pin pin: the pin to read from"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type,
|
||||
mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
// check number of arguments
|
||||
@ -73,6 +76,7 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type,
|
||||
//| def deinit(self, ) -> Any:
|
||||
//| """Turn off the AnalogIn and release the pin for other use."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogin_deinit(mp_obj_t self_in) {
|
||||
analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_analogio_analogin_deinit(self);
|
||||
@ -88,12 +92,14 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) {
|
||||
//| def __enter__(self, ) -> Any:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
//|
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| def __exit__(self, ) -> Any:
|
||||
//|"Automatically deinitializes the hardware when exiting a context. See
|
||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_analogio_analogin_deinit(args[0]);
|
||||
@ -101,12 +107,12 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args)
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__);
|
||||
|
||||
//|value: Any =
|
||||
//| value: Any = ...
|
||||
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
|
||||
//|
|
||||
//| Even if the underlying analog to digital converter (ADC) is lower
|
||||
//| resolution, the value is 16-bit."""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogin_obj_get_value(mp_obj_t self_in) {
|
||||
analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -121,10 +127,10 @@ const mp_obj_property_t analogio_analogin_value_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//|reference_voltage: Any =
|
||||
//| reference_voltage: Any = ...
|
||||
//| """The maximum voltage measurable (also known as the reference voltage) as a
|
||||
//| `float` in Volts."""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) {
|
||||
analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
|
@ -51,11 +51,13 @@
|
||||
//|
|
||||
//| dac = analogio.AnalogOut(pin.PA02) # output on pin PA02
|
||||
//| dac.value = 32768 # makes PA02 1.65V"""
|
||||
//|
|
||||
//| def __init__(self, pin: microcontroller.Pin):
|
||||
//| """Use the AnalogOut on the given pin.
|
||||
//|
|
||||
//| :param ~microcontroller.Pin pin: the pin to output to"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
// check arguments
|
||||
mp_arg_check_num(n_args, kw_args, 1, 1, false);
|
||||
@ -72,6 +74,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t
|
||||
//| def deinit(self, ) -> Any:
|
||||
//| """Turn off the AnalogOut and release the pin for other use."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) {
|
||||
analogio_analogout_obj_t *self = self_in;
|
||||
|
||||
@ -84,12 +87,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogo
|
||||
//| def __enter__(self, ) -> Any:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
//|
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| def __exit__(self, ) -> Any:
|
||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_analogio_analogout_deinit(args[0]);
|
||||
@ -97,12 +102,12 @@ 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: Any =
|
||||
//| value: Any = ...
|
||||
//| """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
|
||||
//| resolution, the value is 16-bit."""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t analogio_analogout_obj_set_value(mp_obj_t self_in, mp_obj_t value) {
|
||||
analogio_analogout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (common_hal_analogio_analogout_deinited(self)) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "shared-bindings/analogio/AnalogIn.h"
|
||||
#include "shared-bindings/analogio/AnalogOut.h"
|
||||
|
||||
//| :mod:`analogio` --- Analog hardware support
|
||||
//| """:mod:`analogio` --- Analog hardware support
|
||||
//| =================================================
|
||||
//|
|
||||
//| .. module:: analogio
|
||||
@ -70,7 +70,7 @@
|
||||
//| This example will initialize the the device, read
|
||||
//| :py:data:`~analogio.AnalogIn.value` and then
|
||||
//| :py:meth:`~analogio.AnalogIn.deinit` the hardware. The last step is optional
|
||||
//| because CircuitPython will do it automatically after the program finishes.
|
||||
//| because CircuitPython will do it automatically after the program finishes."""
|
||||
//|
|
||||
|
||||
STATIC const mp_rom_map_elem_t analogio_module_globals_table[] = {
|
||||
|
@ -42,6 +42,7 @@
|
||||
//| ========================================================
|
||||
//|
|
||||
//| I2S is used to output an audio signal on an I2S bus."""
|
||||
//|
|
||||
//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool):
|
||||
//| """Create a I2SOut object associated with the given pins.
|
||||
//|
|
||||
@ -93,6 +94,7 @@
|
||||
//| pass
|
||||
//| print("stopped")"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_bit_clock, ARG_word_select, ARG_data, ARG_left_justified };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
@ -118,6 +120,7 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a
|
||||
//| def deinit(self, ) -> Any:
|
||||
//| """Deinitialises the I2SOut and releases any hardware resources for reuse."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_deinit(mp_obj_t self_in) {
|
||||
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_audiobusio_i2sout_deinit(self);
|
||||
@ -133,12 +136,14 @@ STATIC void check_for_deinit(audiobusio_i2sout_obj_t *self) {
|
||||
//| def __enter__(self, ) -> Any:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
//|
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| def __exit__(self, ) -> Any:
|
||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_audiobusio_i2sout_deinit(args[0]);
|
||||
@ -155,6 +160,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4,
|
||||
//|
|
||||
//| The sample itself should consist of 8 bit or 16 bit samples."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_sample, ARG_loop };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
@ -176,6 +182,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(audiobusio_i2sout_play_obj, 1, audiobusio_i2sout_obj_
|
||||
//| def stop(self, ) -> Any:
|
||||
//| """Stops playback."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) {
|
||||
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -184,9 +191,9 @@ STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop);
|
||||
|
||||
//|playing: Any =
|
||||
//| playing: Any = ...
|
||||
//| """True when the audio sample is being output. (read-only)"""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) {
|
||||
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -204,6 +211,7 @@ const mp_obj_property_t audiobusio_i2sout_playing_obj = {
|
||||
//| def pause(self, ) -> Any:
|
||||
//| """Stops playback temporarily while remembering the position. Use `resume` to resume playback."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_obj_pause(mp_obj_t self_in) {
|
||||
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -219,6 +227,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_pause_obj, audiobusio_i2sout_obj_pau
|
||||
//| def resume(self, ) -> Any:
|
||||
//| """Resumes sample playback after :py:func:`pause`."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) {
|
||||
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -231,9 +240,9 @@ STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) {
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_resume);
|
||||
|
||||
//|paused: Any =
|
||||
//| paused: Any = ...
|
||||
//| """True when playback is paused. (read-only)"""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) {
|
||||
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
|
@ -61,9 +61,9 @@
|
||||
//| :param float startup_delay: seconds to wait after starting microphone clock
|
||||
//| to allow microphone to turn on. Most require only 0.01s; some require 0.1s. Longer is safer.
|
||||
//| Must be in range 0.0-1.0 seconds."""
|
||||
//|...
|
||||
//|
|
||||
|
||||
//|Record 8-bit unsigned samples to buffer::
|
||||
//| """Record 8-bit unsigned samples to buffer::
|
||||
//|
|
||||
//| import audiobusio
|
||||
//| import board
|
||||
@ -85,7 +85,8 @@
|
||||
//| for i in range(200):
|
||||
//| b.append(0)
|
||||
//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, sample_rate=16000, bit_depth=16) as mic:
|
||||
//|mic.record(b, len(b))
|
||||
//| mic.record(b, len(b))"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_clock_pin, ARG_data_pin, ARG_sample_rate, ARG_bit_depth, ARG_mono, ARG_oversample, ARG_startup_delay };
|
||||
@ -141,6 +142,7 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar
|
||||
//| def deinit(self, ) -> Any:
|
||||
//| """Deinitialises the PDMIn and releases any hardware resources for reuse."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_pdmin_deinit(mp_obj_t self_in) {
|
||||
audiobusio_pdmin_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_audiobusio_pdmin_deinit(self);
|
||||
@ -156,11 +158,13 @@ STATIC void check_for_deinit(audiobusio_pdmin_obj_t *self) {
|
||||
//| def __enter__(self, ) -> Any:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
//|
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| def __exit__(self, ) -> Any:
|
||||
//| """Automatically deinitializes the hardware when exiting a context."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_audiobusio_pdmin_deinit(args[0]);
|
||||
@ -180,6 +184,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4,
|
||||
//| :return: The number of samples recorded. If this is less than ``destination_length``,
|
||||
//| some samples were missed due to processing time."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destination, mp_obj_t destination_length) {
|
||||
audiobusio_pdmin_obj_t *self = MP_OBJ_TO_PTR(self_obj);
|
||||
check_for_deinit(self);
|
||||
@ -210,10 +215,10 @@ STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destinat
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_record);
|
||||
|
||||
//|sample_rate: Any =
|
||||
//| sample_rate: Any = ...
|
||||
//| """The actual sample_rate of the recording. This may not match the constructed
|
||||
//| sample rate due to internal clock limitations."""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t audiobusio_pdmin_obj_get_sample_rate(mp_obj_t self_in) {
|
||||
audiobusio_pdmin_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "shared-bindings/audiobusio/I2SOut.h"
|
||||
#include "shared-bindings/audiobusio/PDMIn.h"
|
||||
|
||||
//| :mod:`audiobusio` --- Support for audio input and output over digital bus
|
||||
//| """:mod:`audiobusio` --- Support for audio input and output over digital bus
|
||||
//| =========================================================================
|
||||
//|
|
||||
//| .. module:: audiobusio
|
||||
@ -56,7 +56,7 @@
|
||||
//|
|
||||
//| All libraries change hardware state and should be deinitialized when they
|
||||
//| are no longer needed. To do so, either call :py:meth:`!deinit` or use a
|
||||
//| context manager.
|
||||
//| context manager."""
|
||||
//|
|
||||
|
||||
STATIC const mp_rom_map_elem_t audiobusio_module_globals_table[] = {
|
||||
|
@ -35,6 +35,12 @@
|
||||
#include "shared-bindings/audiocore/RawSample.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//| class RawSample:
|
||||
//| """.. currentmodule:: audiocore
|
||||
//|
|
||||
@ -74,6 +80,7 @@
|
||||
//| time.sleep(1)
|
||||
//| dac.stop()"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_buffer, ARG_channel_count, ARG_sample_rate };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
@ -108,6 +115,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a
|
||||
//| def deinit(self, ) -> Any:
|
||||
//| """Deinitialises the AudioOut and releases any hardware resources for reuse."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_rawsample_deinit(mp_obj_t self_in) {
|
||||
audioio_rawsample_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
common_hal_audioio_rawsample_deinit(self);
|
||||
@ -124,12 +132,14 @@ STATIC void check_for_deinit(audioio_rawsample_obj_t *self) {
|
||||
//| def __enter__(self, ) -> Any:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
//|
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| def __exit__(self, ) -> Any:
|
||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_audioio_rawsample_deinit(args[0]);
|
||||
@ -137,12 +147,12 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__);
|
||||
|
||||
//|sample_rate: Any =
|
||||
//| sample_rate: Any = ...
|
||||
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
|
||||
//| When the sample is looped, this can change the pitch output without changing the underlying
|
||||
//| sample. This will not change the sample rate of any active playback. Call ``play`` again to
|
||||
//| change it."""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_rawsample_obj_get_sample_rate(mp_obj_t self_in) {
|
||||
audioio_rawsample_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
|
@ -42,6 +42,7 @@
|
||||
//| A .wav file prepped for audio playback. Only mono and stereo files are supported. Samples must
|
||||
//| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating
|
||||
//| an internal buffer."""
|
||||
//|
|
||||
//| def __init__(self, file: typing.BinaryIO, buffer: bytearray):
|
||||
//| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`.
|
||||
//|
|
||||
@ -70,6 +71,7 @@
|
||||
//| pass
|
||||
//| print("stopped")"""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 1, 2, false);
|
||||
|
||||
@ -111,12 +113,14 @@ STATIC void check_for_deinit(audioio_wavefile_obj_t *self) {
|
||||
//| def __enter__(self, ) -> Any:
|
||||
//| """No-op used by Context Managers."""
|
||||
//| ...
|
||||
//|
|
||||
// Provided by context manager helper.
|
||||
|
||||
//| def __exit__(self, ) -> Any:
|
||||
//| """Automatically deinitializes the hardware when exiting a context. See
|
||||
//| :ref:`lifetime-and-contextmanagers` for more info."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
common_hal_audioio_wavefile_deinit(args[0]);
|
||||
@ -124,11 +128,11 @@ 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: Any =
|
||||
//| sample_rate: Any = ...
|
||||
//| """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."""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_wavefile_obj_get_sample_rate(mp_obj_t self_in) {
|
||||
audioio_wavefile_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -151,9 +155,9 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//|bits_per_sample: Any =
|
||||
//| bits_per_sample: Any = ...
|
||||
//| """Bits per sample. (read only)"""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) {
|
||||
audioio_wavefile_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
@ -167,10 +171,9 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//|channel_count: Any =
|
||||
//| channel_count: Any = ...
|
||||
//| """Number of audio channels. (read only)"""
|
||||
//|...
|
||||
//|
|
||||
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {
|
||||
audioio_wavefile_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
check_for_deinit(self);
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "shared-bindings/audiocore/WaveFile.h"
|
||||
//#include "shared-bindings/audiomixer/Mixer.h"
|
||||
|
||||
//| :mod:`audiocore` --- Support for audio samples and mixer
|
||||
//| """:mod:`audiocore` --- Support for audio samples and mixer
|
||||
//| ========================================================
|
||||
//|
|
||||
//| .. module:: audiocore
|
||||
@ -50,7 +50,7 @@
|
||||
//| :maxdepth: 3
|
||||
//|
|
||||
//| RawSample
|
||||
//| WaveFile
|
||||
//| WaveFile"""
|
||||
//|
|
||||
|
||||
STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user