qrio: Fix handling of 1-arg decode()

This commit is contained in:
Jeff Epler 2021-08-05 12:15:05 -05:00
parent f9393c9e51
commit 14f1d95d2d
2 changed files with 4 additions and 1 deletions

View File

@ -63,7 +63,7 @@ STATIC mp_obj_t qrio_qrdecoder_decode(size_t n_args, const mp_obj_t *pos_args, m
enum { ARG_buffer, ARG_pixel_policy };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_int = 0} },
{ MP_QSTR_pixel_policy, MP_ARG_OBJ, {.u_int = 0} },
{ MP_QSTR_pixel_policy, MP_ARG_OBJ, {.u_obj = MP_ROM_PTR((mp_obj_t *)&qrio_pixel_policy_EVERY_BYTE_obj)} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

View File

@ -26,6 +26,7 @@
#pragma once
#include "py/enum.h"
#include "py/obj.h"
#include "py/objnamedtuple.h"
@ -36,3 +37,5 @@ extern const mp_obj_type_t qrio_pixel_policy_type;
typedef enum {
QRIO_EVERY_BYTE, QRIO_EVEN_BYTES, QRIO_ODD_BYTES
} qrio_pixel_policy_t;
extern const cp_enum_obj_t qrio_pixel_policy_EVERY_BYTE_obj;