36
36
#include "shared-module/framebufferio/FramebufferDisplay.h"
37
37
38
38
//| class Framebuffer:
39
- //| """A PicoDVI managed frame buffer."""
40
- //|
41
39
//| def __init__(
42
40
//| self,
43
41
//| width: int,
53
51
//| blue_dn: microcontroller.Pin,
54
52
//| color_depth: int = 8,
55
53
//| ) -> 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.
59
60
//|
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.
64
63
//|
65
64
//| Each dp and dn pair of pins must be neighboring, such as 19 and 20.
66
65
//| They must also be ordered the same way. In other words, dp must be
67
66
//| less than dn for all pairs or dp must be greater than dn for all pairs.
68
67
//|
69
68
//| The framebuffer pixel format varies depending on color_depth:
69
+ //|
70
70
//| * 1 - Each bit is a pixel. Either white (1) or black (0).
71
71
//| * 2 - Each 2 bits is a pixels. Grayscale between white (0x3) and black (0x0).
72
72
//| * 8 - Each byte is a pixels in RGB332 format.
73
73
//| * 16 - Each two bytes are a pixel in RGB565 format.
74
74
//|
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.
78
79
//|
79
80
//| A Framebuffer is often used in conjunction with a
80
81
//| `framebufferio.FramebufferDisplay`.
81
82
//|
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.
86
85
//| :param ~microcontroller.Pin clk_dp: the positive clock signal pin
87
86
//| :param ~microcontroller.Pin clk_dn: the negative clock signal pin
88
87
//| :param ~microcontroller.Pin red_dp: the positive red signal pin
@@ -160,8 +159,7 @@ static void check_for_deinit(picodvi_framebuffer_obj_t *self) {
160
159
}
161
160
162
161
//| 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."""
165
163
STATIC mp_obj_t picodvi_framebuffer_get_width (mp_obj_t self_in ) {
166
164
picodvi_framebuffer_obj_t * self = (picodvi_framebuffer_obj_t * )self_in ;
167
165
check_for_deinit (self );
@@ -172,8 +170,7 @@ MP_PROPERTY_GETTER(picodvi_framebuffer_width_obj,
172
170
(mp_obj_t )& picodvi_framebuffer_get_width_obj );
173
171
174
172
//| 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."""
177
174
//|
178
175
STATIC mp_obj_t picodvi_framebuffer_get_height (mp_obj_t self_in ) {
179
176
picodvi_framebuffer_obj_t * self = (picodvi_framebuffer_obj_t * )self_in ;
0 commit comments