@@ -189,6 +189,30 @@ STATIC mp_obj_t machine_lcd_set_color(size_t n_args, const mp_obj_t *args) {
189189}
190190STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (machine_lcd_set_color_obj , 3 , 3 , machine_lcd_set_color );
191191
192+ /// \method show_image array
193+ ///
194+ /// display the image on the lcd..
195+ /// @param x x position
196+ /// @param y y position
197+ /// @param length length of image
198+ /// @param wide wide of image
199+ /// @param p image_array
200+ STATIC mp_obj_t machine_lcd_show_image (size_t n_args , const mp_obj_t * args ) {
201+ rt_uint16_t x = mp_obj_get_int (args [1 ]);
202+ rt_uint16_t y = mp_obj_get_int (args [2 ]);
203+ rt_uint16_t length = mp_obj_get_int (args [3 ]);
204+ rt_uint16_t wide = mp_obj_get_int (args [4 ]);
205+
206+ mp_buffer_info_t bufinfo ;
207+ if (mp_get_buffer (args [5 ], & bufinfo , MP_BUFFER_READ ))
208+ {
209+ lcd_show_image ( x , y , length , wide , (const rt_uint8_t * )bufinfo .buf );
210+ }
211+
212+ return mp_const_none ;
213+ }
214+ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (machine_lcd_show_image_obj , 6 , 6 , machine_lcd_show_image );
215+
192216STATIC const mp_rom_map_elem_t machine_lcd_locals_dict_table [] = {
193217 // instance methods
194218 { MP_ROM_QSTR (MP_QSTR_light ), MP_ROM_PTR (& machine_lcd_light_obj ) },
@@ -199,6 +223,7 @@ STATIC const mp_rom_map_elem_t machine_lcd_locals_dict_table[] = {
199223 { MP_ROM_QSTR (MP_QSTR_rectangle ), MP_ROM_PTR (& machine_lcd_rectangle_obj ) },
200224 { MP_ROM_QSTR (MP_QSTR_circle ), MP_ROM_PTR (& machine_lcd_circle_obj ) },
201225 { MP_ROM_QSTR (MP_QSTR_set_color ), MP_ROM_PTR (& machine_lcd_set_color_obj ) },
226+ { MP_ROM_QSTR (MP_QSTR_show_image ), MP_ROM_PTR (& machine_lcd_show_image_obj ) },
202227 // color
203228 { MP_ROM_QSTR (MP_QSTR_WHITE ), MP_ROM_INT (WHITE ) },
204229 { MP_ROM_QSTR (MP_QSTR_BLACK ), MP_ROM_INT (BLACK ) },
0 commit comments