added height and width attributes for displayio
This commit is contained in:
parent
2c9fbb5d40
commit
f127be4dd2
@ -246,6 +246,30 @@ STATIC mp_obj_t displayio_display_obj_set_auto_brightness(mp_obj_t self_in, mp_o
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_auto_brightness_obj, displayio_display_obj_set_auto_brightness);
|
||||
|
||||
//| .. attribute:: width
|
||||
//|
|
||||
//| Gets the width of the board
|
||||
//|
|
||||
//|
|
||||
STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_int_t width = common_hal_displayio_display_get_width(self);
|
||||
return mp_obj_new_int(width);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_width_obj, displayio_display_obj_get_width);
|
||||
|
||||
//| .. attribute:: height
|
||||
//|
|
||||
//| Gets the height of the board
|
||||
//|
|
||||
//|
|
||||
STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_float_t height = common_hal_displayio_display_get_height(self);
|
||||
return mp_obj_new_int(height);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_height_obj, displayio_display_obj_get_height);
|
||||
|
||||
const mp_obj_property_t displayio_display_auto_brightness_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&displayio_display_get_auto_brightness_obj,
|
||||
@ -260,6 +284,9 @@ STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = {
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&displayio_display_auto_brightness_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_display_get_width_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_get_height_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_display_locals_dict, displayio_display_locals_dict_table);
|
||||
|
||||
|
@ -59,6 +59,9 @@ bool displayio_display_send_pixels(displayio_display_obj_t* self, uint32_t* pixe
|
||||
bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self);
|
||||
void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness);
|
||||
|
||||
mp_int_t common_hal_displayio_display_get_width(displayio_display_obj_t* self);
|
||||
mp_int_t common_hal_displayio_display_get_height(displayio_display_obj_t* self);
|
||||
|
||||
mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self);
|
||||
bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness);
|
||||
|
||||
|
@ -157,6 +157,14 @@ bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* s
|
||||
return self->auto_brightness;
|
||||
}
|
||||
|
||||
mp_int_t common_hal_displayio_display_get_width(displayio_display_obj_t* self){
|
||||
return self->width;
|
||||
}
|
||||
|
||||
mp_int_t common_hal_displayio_display_get_height(displayio_display_obj_t* self){
|
||||
return self->height;
|
||||
}
|
||||
|
||||
void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness) {
|
||||
self->auto_brightness = auto_brightness;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user