Commit Graph

27 Commits

Author SHA1 Message Date
Damien George 46b35356e1 extmod/modframebuf: Add 8-bit greyscale format (GS8). 2017-12-14 17:36:13 +11:00
Petr Viktorin 34247465c3 extmod/modframebuf: Add 2-bit color format (GS2_HMSB).
This format is used in 2-color LED matrices and in e-ink displays like
SSD1606.
2017-12-14 17:13:02 +11:00
Damien George a3dc1b1957 all: Remove inclusion of internal py header files.
Header files that are considered internal to the py core and should not
normally be included directly are:
    py/nlr.h - internal nlr configuration and declarations
    py/bc0.h - contains bytecode macro definitions
    py/runtime0.h - contains basic runtime enums

Instead, the top-level header files to include are one of:
    py/obj.h - includes runtime0.h and defines everything to use the
        mp_obj_t type
    py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
        and defines everything to use the general runtime support functions

Additional, specific headers (eg py/objlist.h) can be included if needed.
2017-10-04 12:37:50 +11:00
Damien George 4a93801c12 all: Update Makefiles and others to build with new ports/ dir layout.
Also renames "stmhal" to "stm32" in documentation and everywhere else.
2017-09-06 14:09:13 +10:00
Damien George bbced3b4bb extmod: Use MP_ROM_INT for int values in an mp_rom_map_elem_t. 2017-07-31 13:00:34 +10:00
Paul Sokolovsky 036b58228c extmod/modframebuf: Use correct initialization for .locals_dict. 2017-07-29 10:26:41 +03:00
Damien George f3687109d5 extmod/modframebuf: Consistently use "col" as name for colour variables.
Thanks to @kamikaze, aka Oleg Korsak, for the original idea and patch.
2017-07-25 14:06:44 +10:00
Radomir Dopieralski 363087aa11 extmod/modframebuf: Fix invalid stride for odd widths in GS4_HMSB fmt.
Since the stride is specified in pixels, in a 4-bit horizontal format it
has to always be even, otherwise the computation is wrong and we can
write outside of the buffer sometimes.
2017-07-25 12:29:02 +10:00
Damien George 48d867b4a6 all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers. 2017-06-15 11:54:41 +10:00
Paul Sokolovsky 0a7735f1a6 extmod/modframebuf: Fix signed/unsigned comparison pendantic warning.
Happened with 32-bit gcc 4.8.4.
2017-06-10 20:34:38 +03:00
Peter Hinch 468c6f9da1 extmod/modframebuf: Make monochrome bitmap formats start with MONO_.
MONO_xxx is much easier to read if you're not familiar with the code.
MVLSB is deprecated but kept for backwards compatibility, for the time
being.

This patch also updates the associated docs and tests.
2017-04-04 17:38:33 +10:00
Peter Hinch 231cfc84a7 extmod/modframebuf: Add support for monochrome horizontal format.
MHLSB and MHMSB formats are added to the framebuf module, which have 8
adjacent horizontal pixels represented in a single byte.
2017-03-20 16:21:47 +11:00
Oleg Korsak fd99690f18 extmod/modframebuf: Add GS4_HMSB format. 2017-01-25 23:19:28 +11:00
Damien George e2d13d934a extmod/modframebuf: Clip pixels drawn by line method. 2017-01-23 14:35:00 +11:00
Oleg Korsak e45035db5c extmod/modframebuf: optimize fill_rect subroutine call 2017-01-08 20:16:17 +02:00
Damien George adf3cb5081 extmod/modframebuf: Store underlying buffer object to prevent GC free. 2016-12-09 12:58:45 +11:00
Damien George 898d4c1217 extmod/modframebuf: Make framebuf implement the buffer protocol.
So that one can easily access the underlying data of the frame buffer, eg
to write the data out to a display.
2016-12-08 15:17:47 +11:00
Damien George 374ed317c5 extmod/modframebuf: Add hline, vline, rect and line methods.
These are basic drawing primitives.  They work in a generic way on all
framebuf formats by calling the underlying setpixel or fill_rect C-level
primitives.
2016-12-05 11:52:51 +11:00
Damien George a081b49d55 extmod/modframebuf: Optimise fill and fill_rect methods.
Fill is a very common operation (eg to clear the screen) and it is worth
optimising it, by providing a specialised fill_rect function for each
framebuffer format.

This patch improved the speed of fill by 10 times for a 16-bit display
with 160*128 pixels.
2016-12-01 16:51:31 +11:00
Damien George 81e171b7bb extmod/modframebuf: Add back legacy FrameBuffer1 "class".
For backwards compatibility.  It simple creates a frame buffer with the
MVLSB format.
2016-12-01 16:43:25 +11:00
Radomir Dopieralski 225e22b287 extmod/modframebuf: Make FrameBuffer handle 16bit depth.
Rename FrameBuffer1 into FrameBuffer and make it handle different bit
depths via a method table that has getpixel and setpixel.  Currently
supported formats are MVLSB (monochrome, vertical, LSB) and RGB565.

Also add blit() and fill_rect() methods.
2016-12-01 16:43:25 +11:00
Damien George 93c4a6a3f7 all: Remove 'name' member from mp_obj_module_t struct.
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10:00
Radomir Dopieralski 778729c597 extmod/framebuf: Add the xstep!=0 case to scroll() method.
Adds horizontal scrolling. Right now, I'm just leaving the margins
created by the scrolling as they were -- so they will repeat the
edge of the framebuf. This is fast, and the user can always fill
the margins themselves.
2016-09-05 12:06:56 +10:00
Damien George 47899a1ab8 extmod/modframebuf: Include font from stmhal directory explicitly.
So that users of framebuf don't need to have stmhal directory in their
path.  (Eventually the font can be moved elsewhere.)
2016-09-04 16:39:28 +10:00
Radomir Dopieralski 41ec22632d extmod/modframebuf: Fix fill and scroll when height not divisible by 8.
There was a bug in `framebuf1_fill` function, that makes it leave a few
lines unfilled at the bottom if the height is not divisible by 8.

A similar bug is fixed in the scroll method.
2016-09-02 23:58:34 +10:00
Damien George 531217a06b extmod/modframebuf: Fix pixel accessor to return a 1-bit result. 2016-08-27 18:31:58 +10:00
Damien George 53ad681ed1 extmod: Add initial framebuf module. 2016-04-12 14:06:53 +01:00