File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,9 +116,32 @@ Other methods
116116Constants
117117---------
118118
119- .. data :: framebuf.MVLSB
119+ .. data :: framebuf.MONO_VLSB
120120
121121 Monochrome (1-bit) color format
122+ This defines a mapping where the bits in a byte are vertically mapped with
123+ bit 0 being nearest the top of the screen. Consequently each byte occupies
124+ 8 vertical pixels. Subsequent bytes appear at successive horizontal
125+ locations until the rightmost edge is reached. Further bytes are rendered
126+ at locations starting at the leftmost edge, 8 pixels lower.
127+
128+ .. data :: framebuf.MONO_HLSB
129+
130+ Monochrome (1-bit) color format
131+ This defines a mapping where the bits in a byte are horizontally mapped.
132+ Each byte occupies 8 horizontal pixels with bit 0 being the leftmost.
133+ Subsequent bytes appear at successive horizontal locations until the
134+ rightmost edge is reached. Further bytes are rendered on the next row, one
135+ pixel lower.
136+
137+ .. data :: framebuf.MONO_HMSB
138+
139+ Monochrome (1-bit) color format
140+ This defines a mapping where the bits in a byte are horizontally mapped.
141+ Each byte occupies 8 horizontal pixels with bit 7 being the leftmost.
142+ Subsequent bytes appear at successive horizontal locations until the
143+ rightmost edge is reached. Further bytes are rendered on the next row, one
144+ pixel lower.
122145
123146.. data :: framebuf.RGB565
124147
Original file line number Diff line number Diff line change @@ -579,10 +579,11 @@ STATIC const mp_rom_map_elem_t framebuf_module_globals_table[] = {
579579 { MP_ROM_QSTR (MP_QSTR_FrameBuffer ), MP_ROM_PTR (& mp_type_framebuf ) },
580580 { MP_ROM_QSTR (MP_QSTR_FrameBuffer1 ), MP_ROM_PTR (& legacy_framebuffer1_obj ) },
581581 { MP_ROM_QSTR (MP_QSTR_MVLSB ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_MVLSB ) },
582+ { MP_ROM_QSTR (MP_QSTR_MONO_VLSB ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_MVLSB ) },
582583 { MP_ROM_QSTR (MP_QSTR_RGB565 ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_RGB565 ) },
583584 { MP_ROM_QSTR (MP_QSTR_GS4_HMSB ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_GS4_HMSB ) },
584- { MP_ROM_QSTR (MP_QSTR_MHLSB ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_MHLSB ) },
585- { MP_ROM_QSTR (MP_QSTR_MHMSB ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_MHMSB ) },
585+ { MP_ROM_QSTR (MP_QSTR_MONO_HLSB ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_MHLSB ) },
586+ { MP_ROM_QSTR (MP_QSTR_MONO_HMSB ), MP_OBJ_NEW_SMALL_INT (FRAMEBUF_MHMSB ) },
586587};
587588
588589STATIC MP_DEFINE_CONST_DICT (framebuf_module_globals , framebuf_module_globals_table );
Original file line number Diff line number Diff line change 99h = 16
1010size = w * h // 8
1111buf = bytearray (size )
12- maps = {framebuf .MVLSB : 'MVLSB ' ,
13- framebuf .MHLSB : 'MHLSB ' ,
14- framebuf .MHMSB : 'MHMSB ' }
12+ maps = {framebuf .MONO_VLSB : 'MONO_VLSB ' ,
13+ framebuf .MONO_HLSB : 'MONO_HLSB ' ,
14+ framebuf .MONO_HMSB : 'MONO_HMSB ' }
1515
1616for mapping in maps .keys ():
1717 for x in range (size ):
107107# test legacy constructor
108108fbuf = framebuf .FrameBuffer1 (buf , w , h )
109109fbuf = framebuf .FrameBuffer1 (buf , w , h , w )
110+ print (framebuf .MVLSB == framebuf .MONO_VLSB )
Original file line number Diff line number Diff line change 1- MVLSB
1+ MONO_VLSB
220
33bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff')
44bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -20,7 +20,7 @@ bytearray(b'\x00\x7f\x7f\x04\x04\x00\x00\x00\x00\x00')
2020bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2121bytearray(b'\xaaU\xaaU\xaa\x00\x00\x00\x00\x00')
2222
23- MHLSB
23+ MONO_HLSB
24240
2525bytearray(b'\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8')
2626bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -42,7 +42,7 @@ bytearray(b'``x````\x00\x00\x00')
4242bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
4343bytearray(b'P\xa8P\xa8P\xa8P\xa8\x00\x00')
4444
45- MHMSB
45+ MONO_HMSB
46460
4747bytearray(b'\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f')
4848bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
@@ -65,3 +65,4 @@ bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
6565bytearray(b'\n\x15\n\x15\n\x15\n\x15\x00\x00')
6666
6767ValueError
68+ True
You can’t perform that action at this time.
0 commit comments