@@ -269,6 +269,24 @@ MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_row_stride_obj, do
269
269
MP_PROPERTY_GETTER (dotclockframebuffer_framebuffer_row_stride_obj ,
270
270
(mp_obj_t )& dotclockframebuffer_framebuffer_get_row_stride_obj );
271
271
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
+
272
290
STATIC mp_int_t dotclockframebuffer_framebuffer_get_buffer (mp_obj_t self_in , mp_buffer_info_t * bufinfo , mp_uint_t flags ) {
273
291
dotclockframebuffer_framebuffer_obj_t * self = (dotclockframebuffer_framebuffer_obj_t * )self_in ;
274
292
// 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
331
349
return common_hal_dotclockframebuffer_framebuffer_get_row_stride (self );
332
350
}
333
351
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
+
334
357
STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = {
335
358
MP_PROTO_IMPLEMENT (MP_QSTR_protocol_framebuffer )
336
359
.get_bufinfo = dotclockframebuffer_framebuffer_get_bufinfo ,
@@ -340,6 +363,7 @@ STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = {
340
363
.get_height = dotclockframebuffer_framebuffer_get_height_proto ,
341
364
.get_color_depth = dotclockframebuffer_framebuffer_get_color_depth_proto ,
342
365
.get_row_stride = dotclockframebuffer_framebuffer_get_row_stride_proto ,
366
+ .get_first_pixel_offset = dotclockframebuffer_framebuffer_get_first_pixel_offset_proto ,
343
367
.get_bytes_per_cell = dotclockframebuffer_framebuffer_get_bytes_per_cell_proto ,
344
368
.get_native_frames_per_second = dotclockframebuffer_framebuffer_get_native_frames_per_second_proto ,
345
369
.swapbuffers = dotclockframebuffer_framebuffer_swapbuffers ,
@@ -351,6 +375,7 @@ STATIC const mp_rom_map_elem_t dotclockframebuffer_framebuffer_locals_dict_table
351
375
{ MP_ROM_QSTR (MP_QSTR_width ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_width_obj ) },
352
376
{ MP_ROM_QSTR (MP_QSTR_height ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_height_obj ) },
353
377
{ 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 ) },
354
379
{ MP_ROM_QSTR (MP_QSTR_frequency ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_frequency_obj ) },
355
380
{ MP_ROM_QSTR (MP_QSTR_refresh_rate ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_refresh_rate_obj ) },
356
381
{ MP_ROM_QSTR (MP_QSTR_refresh ), MP_ROM_PTR (& dotclockframebuffer_framebuffer_refresh_obj ) },
0 commit comments