Merge remote-tracking branch 'adafruit/main' into c3_short_send

This commit is contained in:
Scott Shawcroft 2022-08-11 11:12:51 -07:00
commit 471053c315
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
9 changed files with 47 additions and 22 deletions

@ -1 +1 @@
Subproject commit f993d5fac69f3a0cfa33988268666c462b72c0ec
Subproject commit 9a8338b3bdaeac9eeb5b74d147107c67db33fdac

View File

@ -57,7 +57,7 @@
//| pixel_format: PixelFormat=PixelFormat.RGB565,
//| frame_size: FrameSize=FrameSize.QQVGA,
//| jpeg_quality: int=15,
//| double_buffered: bool = True,
//| framebuffer_count: int = 1,
//| grab_mode: GrabMode = GrabMode.WHEN_EMPTY,
//| ) -> None:
//| """

View File

@ -42,9 +42,6 @@
//|
//| :param ~microcontroller.Pin pin: Pin connected to the OneWire bus
//|
//| .. note:: The OneWire class is available on `busio` and `bitbangio` in CircuitPython
//| 7.x for backwards compatibility but will be removed in CircuitPython 8.0.0.
//|
//| Read a short series of pulses::
//|
//| import onewireio

View File

@ -48,9 +48,6 @@
//| :param int frequency: Carrier signal frequency in Hertz
//| :param int duty_cycle: 16-bit duty cycle of carrier frequency (0 - 65536)
//|
//| For backwards compatibility, ``pin`` may be a PWMOut object used as the carrier. This
//| compatibility will be removed in CircuitPython 8.0.0.
//|
//| Send a short series of pulses::
//|
//| import array
@ -82,14 +79,6 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar
const mcu_pin_obj_t *pin = args[ARG_pin].u_obj;
mp_int_t frequency = args[ARG_frequency].u_int;
mp_int_t duty_cycle = args[ARG_duty_cycle].u_int;
if (mp_obj_is_type(args[ARG_pin].u_obj, &pwmio_pwmout_type)) {
pwmio_pwmout_obj_t *pwmout = args[ARG_pin].u_obj;
duty_cycle = common_hal_pwmio_pwmout_get_duty_cycle(pwmout);
frequency = common_hal_pwmio_pwmout_get_frequency(pwmout);
pin = common_hal_pwmio_pwmout_get_pin(pwmout);
// Deinit the pin so we can use it.
common_hal_pwmio_pwmout_deinit(pwmout);
}
validate_obj_is_free_pin(MP_OBJ_FROM_PTR(pin));
pulseio_pulseout_obj_t *self = m_new_obj(pulseio_pulseout_obj_t);
self->base.type = &pulseio_pulseout_type;

View File

@ -34,18 +34,28 @@
//| """The input buffer to `QRDecoder.decode` consists of greyscale values in every byte"""
//|
//| EVEN_BYTES: PixelPolicy
//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 0, 2, …, and ignored bytes in positions 1, 3, …. This can decode directly from YUV images where the even bytes hold the Y (luminance) data."""
//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 0, 2, …, and ignored bytes in positions 1, 3, …. This can decode directly from YUV images where the even bytes hold the Y (luminance) data."""
//|
//| ODD_BYTES: PixelPolicy
//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 1, 3, …, and ignored bytes in positions 0, 2, …. This can decode directly from YUV images where the odd bytes hold the Y (luminance) data"""
//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 1, 3, …, and ignored bytes in positions 0, 2, …. This can decode directly from YUV images where the odd bytes hold the Y (luminance) data"""
//|
//| RGB565_SWAPPED: PixelPolicy
//| """The input buffer to `QRDecoder.decode` consists of RGB565 values in byte-swapped order. Most cameras produce data in byte-swapped order. The green component is used."""
//|
//| RGB565: PixelPolicy
//| """The input buffer to `QRDecoder.decode` consists of RGB565 values in native order. The green component is used."""
//|
MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, EVERY_BYTE, QRIO_EVERY_BYTE);
MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, RGB565, QRIO_RGB565);
MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, RGB565_SWAPPED, QRIO_RGB565_SWAPPED);
MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, EVEN_BYTES, QRIO_EVEN_BYTES);
MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, ODD_BYTES, QRIO_EVEN_BYTES);
MAKE_ENUM_MAP(qrio_pixel_policy) {
MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, EVERY_BYTE),
MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, RGB565),
MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, RGB565_SWAPPED),
MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, EVEN_BYTES),
MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, ODD_BYTES),
};

View File

@ -33,7 +33,7 @@
extern const mp_obj_type_t qrio_pixel_policy_type;
typedef enum {
QRIO_EVERY_BYTE, QRIO_EVEN_BYTES, QRIO_ODD_BYTES
QRIO_EVERY_BYTE, QRIO_EVEN_BYTES, QRIO_ODD_BYTES, QRIO_RGB565, QRIO_RGB565_SWAPPED
} qrio_pixel_policy_t;
extern const cp_enum_obj_t qrio_pixel_policy_EVERY_BYTE_obj;

View File

@ -104,6 +104,20 @@ mp_obj_t shared_module_qrio_qrdecoder_decode(qrdecoder_qrdecoder_obj_t *self, co
uint8_t *src = bufinfo->buf;
switch (policy) {
case QRIO_RGB565: {
uint16_t *src16 = bufinfo->buf;
for (int i = 0; i < width * height; i++) {
framebuffer[i] = (src16[i] >> 3) & 0xfc;
}
break;
}
case QRIO_RGB565_SWAPPED: {
uint16_t *src16 = bufinfo->buf;
for (int i = 0; i < width * height; i++) {
framebuffer[i] = (__builtin_bswap16(src16[i]) >> 3) & 0xfc;
}
break;
}
case QRIO_EVERY_BYTE:
memcpy(framebuffer, src, width * height);
break;
@ -116,6 +130,7 @@ mp_obj_t shared_module_qrio_qrdecoder_decode(qrdecoder_qrdecoder_obj_t *self, co
for (int i = 0; i < width * height; i++) {
framebuffer[i] = src[2 * i];
}
break;
}
quirc_end(self->quirc);

View File

@ -78,6 +78,7 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t *self, const mcu
uint16_t raw_reading = get_raw_reading(self);
if (raw_reading == TIMEOUT_TICKS) {
common_hal_touchio_touchin_deinit(self);
mp_raise_ValueError(translate("No pulldown on pin; 1Mohm recommended"));
}
self->threshold = raw_reading * 1.05 + 100;

View File

@ -6,6 +6,15 @@ var current_path;
var editable = undefined;
async function refresh_list() {
function compareValues(a, b) {
if (a.directory == b.directory && a.name.toLowerCase() === b.name.toLowerCase()) {
return 0;
} else {
return a.directory.toString().substring(3,4)+a.name.toLowerCase() < b.directory.toString().substring(3,4)+b.name.toLowerCase() ? -1 : 1;
}
}
current_path = window.location.hash.substr(1);
if (current_path == "") {
current_path = "/";
@ -56,6 +65,8 @@ async function refresh_list() {
new_children.push(clone);
}
data.sort(compareValues);
for (const f of data) {
// Clone the new row and insert it into the table
var clone = template.content.cloneNode(true);
@ -92,9 +103,11 @@ async function refresh_list() {
delete_button.disabled = !editable;
delete_button.onclick = del;
edit_url = new URL(edit_url, url_base);
let edit_link = clone.querySelector(".edit_link");
edit_link.href = edit_url
if (editable && !f.directory) {
edit_url = new URL(edit_url, url_base);
let edit_link = clone.querySelector(".edit_link");
edit_link.href = edit_url
}
new_children.push(clone);
}