3636#include "shared-module/framebufferio/FramebufferDisplay.h"
3737
3838//| class Framebuffer:
39- //| """A PicoDVI managed frame buffer."""
40- //|
4139//| def __init__(
4240//| self,
4341//| width: int,
5351//| blue_dn: microcontroller.Pin,
5452//| color_depth: int = 8,
5553//| ) -> None:
56- //| """Create a Framebuffer object with the given dimensions (640x480 or 800x480). Memory is
57- //| allocated outside of onto the heap and then moved outside on VM
58- //| end.
54+ //| """Create a Framebuffer object with the given dimensions. Memory is
55+ //| allocated outside of onto the heap and then moved outside on VM end.
56+ //|
57+ //| .. warning:: This will change the system clock speed to match the DVI signal.
58+ //| Make sure to initialize other objects after this one so they account
59+ //| for the changed clock.
5960//|
60- //| This will change the system clock speed to match the DVI signal.
61- //| Make sure to initialize other objects after this one so they account
62- //| for the changed clock. This also allocates a very large framebuffer
63- //| and is most likely to succeed the earlier it is attempted.
61+ //| This allocates a very large framebuffer and is most likely to succeed
62+ //| the earlier it is attempted.
6463//|
6564//| Each dp and dn pair of pins must be neighboring, such as 19 and 20.
6665//| They must also be ordered the same way. In other words, dp must be
6766//| less than dn for all pairs or dp must be greater than dn for all pairs.
6867//|
6968//| The framebuffer pixel format varies depending on color_depth:
69+ //|
7070//| * 1 - Each bit is a pixel. Either white (1) or black (0).
7171//| * 2 - Each 2 bits is a pixels. Grayscale between white (0x3) and black (0x0).
7272//| * 8 - Each byte is a pixels in RGB332 format.
7373//| * 16 - Each two bytes are a pixel in RGB565 format.
7474//|
75- //| Monochrome framebuffers (color_depth=1 or 2) will be full resolution.
76- //| Color framebuffers will be half resolution and pixels will be
77- //| duplicated to create a signal with the target dimensions.
75+ //| Two output resolutions are currently supported, 640x480 and 800x480.
76+ //| Monochrome framebuffers (color_depth=1 or 2) must be full resolution.
77+ //| Color framebuffers must be half resolution (320x240 or 400x240) and
78+ //| pixels will be duplicated to create the signal.
7879//|
7980//| A Framebuffer is often used in conjunction with a
8081//| `framebufferio.FramebufferDisplay`.
8182//|
82- //| :param int width: the width of the target display signal. It will be halved when
83- //| color_depth >= 8 when creating the framebuffer. Only 640 or 800 is currently supported.
84- //| :param int height: the height of the target display signal. It will be halved when
85- //| color_depth >= 8 when creating the framebuffer. Only 480 is currently supported.
83+ //| :param int width: the width of the target display signal. Only 320, 400, 640 or 800 is currently supported depending on color_depth.
84+ //| :param int height: the height of the target display signal. Only 240 or 480 is currently supported depending on color_depth.
8685//| :param ~microcontroller.Pin clk_dp: the positive clock signal pin
8786//| :param ~microcontroller.Pin clk_dn: the negative clock signal pin
8887//| :param ~microcontroller.Pin red_dp: the positive red signal pin
@@ -160,8 +159,7 @@ static void check_for_deinit(picodvi_framebuffer_obj_t *self) {
160159}
161160
162161//| width: int
163- //| """The width of the framebuffer, in pixels. It may be doubled for output (and half of what
164- //| width was given to __init__.)"""
162+ //| """The width of the framebuffer, in pixels. It may be doubled for output."""
165163STATIC mp_obj_t picodvi_framebuffer_get_width (mp_obj_t self_in ) {
166164 picodvi_framebuffer_obj_t * self = (picodvi_framebuffer_obj_t * )self_in ;
167165 check_for_deinit (self );
@@ -172,8 +170,7 @@ MP_PROPERTY_GETTER(picodvi_framebuffer_width_obj,
172170 (mp_obj_t )& picodvi_framebuffer_get_width_obj );
173171
174172//| height: int
175- //| """The width of the framebuffer, in pixels. It may be doubled for output (and half of what
176- //| width was given to __init__.)"""
173+ //| """The width of the framebuffer, in pixels. It may be doubled for output."""
177174//|
178175STATIC mp_obj_t picodvi_framebuffer_get_height (mp_obj_t self_in ) {
179176 picodvi_framebuffer_obj_t * self = (picodvi_framebuffer_obj_t * )self_in ;
0 commit comments