@@ -269,6 +269,24 @@ MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_row_stride_obj, do
269269MP_PROPERTY_GETTER (dotclockframebuffer_framebuffer_row_stride_obj ,
270270 (mp_obj_t )& dotclockframebuffer_framebuffer_get_row_stride_obj );
271271
272+ //| first_pixel_offset: int
273+ //| """The first_pixel_offset of the display, in bytes
274+ //|
275+ //| Due to overscan or alignment requirements, the memory address for row N+1 may not be exactly ``2*width`` bytes after the memory address for row N.
276+ //| This property gives the stride in **bytes**.
277+ //|
278+ //| On Espressif this value is **guaranteed** to be a multiple of the 2 (i.e., it is a whole number of pixels)"""
279+ //|
280+ STATIC mp_obj_t dotclockframebuffer_framebuffer_get_first_pixel_offset (mp_obj_t self_in ) {
281+ dotclockframebuffer_framebuffer_obj_t * self = (dotclockframebuffer_framebuffer_obj_t * )self_in ;
282+ check_for_deinit (self );
283+ return MP_OBJ_NEW_SMALL_INT (common_hal_dotclockframebuffer_framebuffer_get_first_pixel_offset (self ));
284+ }
285+ MP_DEFINE_CONST_FUN_OBJ_1 (dotclockframebuffer_framebuffer_get_first_pixel_offset_obj , dotclockframebuffer_framebuffer_get_first_pixel_offset );
286+
287+ MP_PROPERTY_GETTER (dotclockframebuffer_framebuffer_first_pixel_offset_obj ,
288+ (mp_obj_t )& dotclockframebuffer_framebuffer_get_first_pixel_offset_obj );
289+
272290STATIC mp_int_t dotclockframebuffer_framebuffer_get_buffer (mp_obj_t self_in , mp_buffer_info_t * bufinfo , mp_uint_t flags ) {
273291 dotclockframebuffer_framebuffer_obj_t * self = (dotclockframebuffer_framebuffer_obj_t * )self_in ;
274292 // a readonly framebuffer would be unusual but not impossible
@@ -331,6 +349,11 @@ STATIC int dotclockframebuffer_framebuffer_get_row_stride_proto(mp_obj_t self_in
331349 return common_hal_dotclockframebuffer_framebuffer_get_row_stride (self );
332350}
333351
352+ STATIC int dotclockframebuffer_framebuffer_get_first_pixel_offset_proto (mp_obj_t self_in ) {
353+ dotclockframebuffer_framebuffer_obj_t * self = (dotclockframebuffer_framebuffer_obj_t * )self_in ;
354+ return common_hal_dotclockframebuffer_framebuffer_get_first_pixel_offset (self );
355+ }
356+
334357STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = {
335358 MP_PROTO_IMPLEMENT (MP_QSTR_protocol_framebuffer )
336359 .get_bufinfo = dotclockframebuffer_framebuffer_get_bufinfo ,
@@ -340,6 +363,7 @@ STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = {
340363 .get_height = dotclockframebuffer_framebuffer_get_height_proto ,
341364 .get_color_depth = dotclockframebuffer_framebuffer_get_color_depth_proto ,
342365 .get_row_stride = dotclockframebuffer_framebuffer_get_row_stride_proto ,
366+ .get_first_pixel_offset = dotclockframebuffer_framebuffer_get_first_pixel_offset_proto ,
343367 .get_bytes_per_cell = dotclockframebuffer_framebuffer_get_bytes_per_cell_proto ,
344368 .get_native_frames_per_second = dotclockframebuffer_framebuffer_get_native_frames_per_second_proto ,
345369 .swapbuffers = dotclockframebuffer_framebuffer_swapbuffers ,
@@ -351,6 +375,7 @@ STATIC const mp_rom_map_elem_t dotclockframebuffer_framebuffer_locals_dict_table
351375 { MP_ROM_QSTR (MP_QSTR_width ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_width_obj ) },
352376 { MP_ROM_QSTR (MP_QSTR_height ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_height_obj ) },
353377 { MP_ROM_QSTR (MP_QSTR_row_stride ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_row_stride_obj ) },
378+ { MP_ROM_QSTR (MP_QSTR_first_pixel_offset ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_first_pixel_offset_obj ) },
354379 { MP_ROM_QSTR (MP_QSTR_frequency ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_frequency_obj ) },
355380 { MP_ROM_QSTR (MP_QSTR_refresh_rate ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_refresh_rate_obj ) },
356381 { MP_ROM_QSTR (MP_QSTR_refresh ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_refresh_obj ) },
0 commit comments