Skip to content

Commit c1f57c6

Browse files
committed
Pushing for resolution
1 parent a87d3bd commit c1f57c6

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

locale/circuitpython.pot

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ msgstr ""
7676
msgid "%q"
7777
msgstr ""
7878

79+
#: shared-bindings/analogbufio/BufferedIn.c
80+
msgid "%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"
81+
msgstr ""
82+
7983
#: shared-bindings/microcontroller/Pin.c
8084
msgid "%q and %q contain duplicate pins"
8185
msgstr ""
@@ -3869,11 +3873,6 @@ msgstr ""
38693873
msgid "rsplit(None,n)"
38703874
msgstr ""
38713875

3872-
#: shared-bindings/adcbuffer/BufferdInput.c
3873-
msgid "sample rate must be 1.0-500000.0 per second"
3874-
msgstr ""
3875-
3876-
#: shared-bindings/adcbuffer/BufferdInput.c
38773876
#: shared-bindings/audiocore/RawSample.c
38783877
msgid ""
38793878
"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "

ports/raspberrypi/common-hal/analogbufio/BufferedIn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s
9696
true, // Write each completed conversion to the sample FIFO
9797
true, // Enable DMA data request (DREQ)
9898
1, // DREQ (and IRQ) asserted when at least 1 sample present
99-
show_error_bit, // See the ERR bit on 8 bit bit reads
99+
show_error_bit, // See the ERR bit
100100
shift_sample_8_bits // Shift each sample to 8 bits when pushing to FIFO
101101
);
102102

shared-bindings/analogbufio/BufferedIn.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@
7676
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) {
7777
enum { ARG_pin, ARG_buffer, ARG_sample_rate };
7878
static const mp_arg_t allowed_args[] = {
79-
{ MP_QSTR_pin, MP_ARG_OBJ | MP_ARG_REQUIRED },
80-
{ MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED },
81-
{ MP_QSTR_sample_rate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 500000} },
79+
{ MP_QSTR_pin, MP_ARG_OBJ | MP_ARG_REQUIRED },
80+
{ MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED },
81+
{ MP_QSTR_sample_rate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 500000} },
8282
};
8383
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
8484
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
8585

8686
// Validate Pin
8787
const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj);
8888

89-
// Buffer Pointer defined and allocated by user
89+
// Buffer defined and allocated by user
9090
mp_buffer_info_t bufinfo;
9191
mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ);
9292

@@ -96,9 +96,9 @@ STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_
9696

9797
// Bytes Per Sample
9898
if (bufinfo.typecode == 'h' || bufinfo.typecode == 'H') {
99-
bytes_per_sample = 2;
99+
bytes_per_sample = 2;
100100
} else if (bufinfo.typecode != 'b' && bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) {
101-
mp_raise_ValueError_varg(translate("%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"), MP_QSTR_buffer);
101+
mp_raise_ValueError_varg(translate("%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'"), MP_QSTR_buffer);
102102
}
103103

104104
// Validate sample rate here
@@ -110,13 +110,13 @@ STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_
110110

111111
// Call local intereface in ports/common-hal/analogbufio
112112
common_hal_analogbufio_bufferedin_construct(self,
113-
pin,
114-
((uint8_t *)bufinfo.buf),
115-
bufinfo.len,
116-
bytes_per_sample,
117-
signed_samples,
118-
sample_rate
119-
);
113+
pin,
114+
((uint8_t *)bufinfo.buf),
115+
bufinfo.len,
116+
bytes_per_sample,
117+
signed_samples,
118+
sample_rate
119+
);
120120

121121
return MP_OBJ_FROM_PTR(self);
122122
}
@@ -134,7 +134,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(analogbufio_bufferedin_deinit_obj, analogbufio_buffere
134134

135135
STATIC void check_for_deinit(analogbufio_bufferedin_obj_t *self) {
136136
if (common_hal_analogbufio_bufferedin_deinited(self)) {
137-
raise_deinited_error();
137+
raise_deinited_error();
138138
}
139139
}
140140
//| def __enter__(self) -> BufferedIn:

0 commit comments

Comments
 (0)