Pushing for resolution
This commit is contained in:
parent
a87d3bd89e
commit
c1f57c6ceb
|
@ -76,6 +76,10 @@ msgstr ""
|
||||||
msgid "%q"
|
msgid "%q"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: shared-bindings/analogbufio/BufferedIn.c
|
||||||
|
msgid "%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: shared-bindings/microcontroller/Pin.c
|
#: shared-bindings/microcontroller/Pin.c
|
||||||
msgid "%q and %q contain duplicate pins"
|
msgid "%q and %q contain duplicate pins"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -3869,11 +3873,6 @@ msgstr ""
|
||||||
msgid "rsplit(None,n)"
|
msgid "rsplit(None,n)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: shared-bindings/adcbuffer/BufferdInput.c
|
|
||||||
msgid "sample rate must be 1.0-500000.0 per second"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: shared-bindings/adcbuffer/BufferdInput.c
|
|
||||||
#: shared-bindings/audiocore/RawSample.c
|
#: shared-bindings/audiocore/RawSample.c
|
||||||
msgid ""
|
msgid ""
|
||||||
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
|
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
|
||||||
|
|
|
@ -96,7 +96,7 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s
|
||||||
true, // Write each completed conversion to the sample FIFO
|
true, // Write each completed conversion to the sample FIFO
|
||||||
true, // Enable DMA data request (DREQ)
|
true, // Enable DMA data request (DREQ)
|
||||||
1, // DREQ (and IRQ) asserted when at least 1 sample present
|
1, // DREQ (and IRQ) asserted when at least 1 sample present
|
||||||
show_error_bit, // See the ERR bit on 8 bit bit reads
|
show_error_bit, // See the ERR bit
|
||||||
shift_sample_8_bits // Shift each sample to 8 bits when pushing to FIFO
|
shift_sample_8_bits // Shift each sample to 8 bits when pushing to FIFO
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@
|
||||||
STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||||
enum { ARG_pin, ARG_buffer, ARG_sample_rate };
|
enum { ARG_pin, ARG_buffer, ARG_sample_rate };
|
||||||
static const mp_arg_t allowed_args[] = {
|
static const mp_arg_t allowed_args[] = {
|
||||||
{ MP_QSTR_pin, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
{ MP_QSTR_pin, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
||||||
{ MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
{ MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
||||||
{ MP_QSTR_sample_rate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 500000} },
|
{ MP_QSTR_sample_rate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 500000} },
|
||||||
};
|
};
|
||||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||||
|
@ -86,7 +86,7 @@ STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_
|
||||||
// Validate Pin
|
// Validate Pin
|
||||||
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
|
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
|
||||||
|
|
||||||
// Buffer Pointer defined and allocated by user
|
// Buffer defined and allocated by user
|
||||||
mp_buffer_info_t bufinfo;
|
mp_buffer_info_t bufinfo;
|
||||||
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ);
|
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ);
|
||||||
|
|
||||||
|
@ -96,9 +96,9 @@ STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_
|
||||||
|
|
||||||
// Bytes Per Sample
|
// Bytes Per Sample
|
||||||
if (bufinfo.typecode == 'h' || bufinfo.typecode == 'H') {
|
if (bufinfo.typecode == 'h' || bufinfo.typecode == 'H') {
|
||||||
bytes_per_sample = 2;
|
bytes_per_sample = 2;
|
||||||
} else if (bufinfo.typecode != 'b' && bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) {
|
} else if (bufinfo.typecode != 'b' && bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) {
|
||||||
mp_raise_ValueError_varg(translate("%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"), MP_QSTR_buffer);
|
mp_raise_ValueError_varg(translate("%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"), MP_QSTR_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate sample rate here
|
// Validate sample rate here
|
||||||
|
@ -110,13 +110,13 @@ STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_
|
||||||
|
|
||||||
// Call local intereface in ports/common-hal/analogbufio
|
// Call local intereface in ports/common-hal/analogbufio
|
||||||
common_hal_analogbufio_bufferedin_construct(self,
|
common_hal_analogbufio_bufferedin_construct(self,
|
||||||
pin,
|
pin,
|
||||||
((uint8_t *)bufinfo.buf),
|
((uint8_t *)bufinfo.buf),
|
||||||
bufinfo.len,
|
bufinfo.len,
|
||||||
bytes_per_sample,
|
bytes_per_sample,
|
||||||
signed_samples,
|
signed_samples,
|
||||||
sample_rate
|
sample_rate
|
||||||
);
|
);
|
||||||
|
|
||||||
return MP_OBJ_FROM_PTR(self);
|
return MP_OBJ_FROM_PTR(self);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(analogbufio_bufferedin_deinit_obj, analogbufio_buffere
|
||||||
|
|
||||||
STATIC void check_for_deinit(analogbufio_bufferedin_obj_t *self) {
|
STATIC void check_for_deinit(analogbufio_bufferedin_obj_t *self) {
|
||||||
if (common_hal_analogbufio_bufferedin_deinited(self)) {
|
if (common_hal_analogbufio_bufferedin_deinited(self)) {
|
||||||
raise_deinited_error();
|
raise_deinited_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//| def __enter__(self) -> BufferedIn:
|
//| def __enter__(self) -> BufferedIn:
|
||||||
|
|
Loading…
Reference in New Issue