simplify arg checking for display

This commit is contained in:
Scott Shawcroft 2019-01-18 17:04:18 -08:00
parent edc8383e22
commit b41d386d02
No known key found for this signature in database
GPG Key ID: FD0EDC4B6C53CA59

View File

@ -104,11 +104,6 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
mp_obj_t display_bus = args[ARG_display_bus].u_obj;
mp_int_t width = args[ARG_width].u_int;
mp_int_t height = args[ARG_height].u_int;
if (width == -1 || height == -1) {
mp_raise_ValueError(translate("Width and height kwargs required"));
}
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ);
@ -125,7 +120,7 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
}
self->base.type = &displayio_display_type;
common_hal_displayio_display_construct(self,
display_bus, width, height, args[ARG_colstart].u_int, args[ARG_rowstart].u_int,
display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int,
args[ARG_color_depth].u_int, args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int,
args[ARG_write_ram_command].u_int, bufinfo.buf, bufinfo.len);