@@ -750,6 +750,17 @@ STATIC mp_obj_t ugfx_area(mp_uint_t n_args, const mp_obj_t *args) {
750
750
}
751
751
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (ugfx_area_obj , 5 , 5 , ugfx_area );
752
752
753
+ /// \method clear(color=ugfx.WHITE)
754
+ ///
755
+ /// Clear screen
756
+ ///
757
+ STATIC mp_obj_t ugfx_clear (mp_uint_t n_args , const mp_obj_t * args ) {
758
+ int color = n_args == 0 ? White : mp_obj_get_int (args [0 ]);
759
+ gdispFillArea (0 , 0 , gdispGetWidth (), gdispGetHeight (), color );
760
+ return mp_const_none ;
761
+ }
762
+ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (ugfx_clear_obj , 0 , 1 , ugfx_clear );
763
+
753
764
/// \method box(x1, y1, a, b, colour)
754
765
///
755
766
/// Draw a box from (x,y), with lengths x1,y1, using the given colour.
@@ -874,6 +885,7 @@ STATIC const mp_map_elem_t ugfx_module_dict_table[] = {
874
885
{ MP_OBJ_NEW_QSTR (MP_QSTR_line ), (mp_obj_t )& ugfx_line_obj },
875
886
{ MP_OBJ_NEW_QSTR (MP_QSTR_box ), (mp_obj_t )& ugfx_box_obj },
876
887
{ MP_OBJ_NEW_QSTR (MP_QSTR_area ), (mp_obj_t )& ugfx_area_obj },
888
+ { MP_OBJ_NEW_QSTR (MP_QSTR_clear ), (mp_obj_t )& ugfx_clear_obj },
877
889
{ MP_OBJ_NEW_QSTR (MP_QSTR_thickline ), (mp_obj_t )& ugfx_thickline_obj },
878
890
{ MP_OBJ_NEW_QSTR (MP_QSTR_circle ), (mp_obj_t )& ugfx_circle_obj },
879
891
{ MP_OBJ_NEW_QSTR (MP_QSTR_fill_circle ), (mp_obj_t )& ugfx_fill_circle_obj },
0 commit comments