@@ -271,6 +271,13 @@ bool get_display_settings(PicoGraphicsDisplay display, int &width, int &height,
271
271
rotate = (int )Rotation::ROTATE_0;
272
272
if (pen_type == -1 ) pen_type = PEN_RGB565;
273
273
break ;
274
+ case DISPLAY_GENERIC:
275
+ if (width == 0 ) width = 320 ;
276
+ if (height == 0 ) height = 240 ;
277
+ bus_type = BUS_PIO;
278
+ if (rotate == -1 ) rotate = (int )Rotation::ROTATE_0;
279
+ if (pen_type == -1 ) pen_type = PEN_RGB565;
280
+ break ;
274
281
default :
275
282
return false ;
276
283
}
@@ -303,16 +310,18 @@ size_t get_required_buffer_size(PicoGraphicsPenType pen_type, uint width, uint h
303
310
mp_obj_t ModPicoGraphics_make_new (const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
304
311
ModPicoGraphics_obj_t *self = nullptr ;
305
312
306
- enum { ARG_display, ARG_rotate, ARG_bus, ARG_buffer, ARG_pen_type, ARG_extra_pins, ARG_i2c_address, ARG_layers };
313
+ enum { ARG_display, ARG_rotate, ARG_bus, ARG_buffer, ARG_pen_type, ARG_extra_pins, ARG_i2c_address, ARG_layers, ARG_width, ARG_height };
307
314
static const mp_arg_t allowed_args[] = {
308
- { MP_QSTR_display, MP_ARG_INT | MP_ARG_REQUIRED },
315
+ { MP_QSTR_display, MP_ARG_INT, { . u_int = DISPLAY_GENERIC } },
309
316
{ MP_QSTR_rotate, MP_ARG_INT, { .u_int = -1 } },
310
317
{ MP_QSTR_bus, MP_ARG_OBJ, { .u_obj = mp_const_none } },
311
318
{ MP_QSTR_buffer, MP_ARG_OBJ, { .u_obj = mp_const_none } },
312
319
{ MP_QSTR_pen_type, MP_ARG_INT, { .u_int = -1 } },
313
320
{ MP_QSTR_extra_pins, MP_ARG_OBJ, { .u_obj = mp_const_none } },
314
321
{ MP_QSTR_i2c_address, MP_ARG_INT, { .u_int = -1 } },
315
322
{ MP_QSTR_layers, MP_ARG_INT, { .u_int = 1 } },
323
+ { MP_QSTR_width, MP_ARG_INT, { .u_int = 0 } },
324
+ { MP_QSTR_height, MP_ARG_INT, { .u_int = 0 } },
316
325
};
317
326
318
327
// Parse args.
@@ -324,8 +333,8 @@ mp_obj_t ModPicoGraphics_make_new(const mp_obj_type_t *type, size_t n_args, size
324
333
PicoGraphicsDisplay display = (PicoGraphicsDisplay)args[ARG_display].u_int ;
325
334
326
335
bool round = display == DISPLAY_ROUND_LCD_240X240;
327
- int width = 0 ;
328
- int height = 0 ;
336
+ int width = args[ARG_width]. u_int ;
337
+ int height = args[ARG_height]. u_int ; ;
329
338
int pen_type = args[ARG_pen_type].u_int ;
330
339
int rotate = args[ARG_rotate].u_int ;
331
340
int layers = args[ARG_layers].u_int ;
@@ -413,7 +422,8 @@ mp_obj_t ModPicoGraphics_make_new(const mp_obj_type_t *type, size_t n_args, size
413
422
|| display == DISPLAY_UNICORN_PACK
414
423
|| display == DISPLAY_SCROLL_PACK
415
424
|| display == DISPLAY_PRESTO
416
- || display == DISPLAY_PRESTO_FULL_RES) {
425
+ || display == DISPLAY_PRESTO_FULL_RES
426
+ || display == DISPLAY_GENERIC) {
417
427
// Create a dummy display driver
418
428
self->display = m_new_class (DisplayDriver, width, height, (Rotation)rotate);
419
429
0 commit comments