Skip to content
Snippets Groups Projects
Commit 7d6c0624 authored by TilCreator's avatar TilCreator
Browse files

Add documentation stuff

parent c5acfa67
No related branches found
No related tags found
No related merge requests found
Pipeline #3697 passed
...@@ -1304,8 +1304,13 @@ API(API_DISP_PIXEL, ...@@ -1304,8 +1304,13 @@ API(API_DISP_PIXEL,
); );
/** /**
* Draws pixels on the display
*
* :param data: Image data as byte string: int8 x, int8 y, int16 rgb585, ...
* :param data_length: Amount of pixels in data
* :param offset_x: Offset in x direction of the pixels
* :param offset_y: Offset in y direction of the pixels
*/ */
API(API_DISP_PIXELS, API(API_DISP_PIXELS,
int epic_disp_pixels(const uint8_t *data, size_t data_length, uint8_t offset_x, uint8_t offset_y) int epic_disp_pixels(const uint8_t *data, size_t data_length, uint8_t offset_x, uint8_t offset_y)
); );
......
...@@ -10,6 +10,12 @@ FONT24 = 4 ...@@ -10,6 +10,12 @@ FONT24 = 4
def get_pixels_size(data): def get_pixels_size(data):
"""
Returns (min_x, min_y, max_x, max_y, width, height) from and pixels data byte string
:param data: Image data as byte string: int8 x, int8 y, int16 rgb585, ...
"""
min_x = max_x = data[0] min_x = max_x = data[0]
min_y = max_y = data[1] min_y = max_y = data[1]
...@@ -136,7 +142,30 @@ class Display: ...@@ -136,7 +142,30 @@ class Display:
""" """
Draws pixels on the display Draws pixels on the display
:param data: Image data as byte string: int8 x, int8 y, int16 rgb585 :param data: Image data as byte string: int8 x, int8 y, int16 rgb585, ...
:param offset_x: Offset in x direction of the pixels
:param offset_y: Offset in y direction of the pixels
**Example:**
.. code-block:: python
data = b'\x00\x00\xF8\x00'
# |--| x-position: 0
# |--| yposition: 0
# |------| color (rgb565): red
data += b'\x05\x00\x07\xE0'
# |--| x-position: 1
# |--| yposition: 0
# |------| color (rgb565): green
data += b'\x02\x0f\x00\x1F'
# |--| x-position: 2
# |--| yposition: 15
# |------| color (rgb565): blue
with display.open() as d:
d.clear()
d.pixels(data, offset_x=20, offset_y=10)
d.update()
""" """
sys_display.pixels(data, offset_x, offset_y) sys_display.pixels(data, offset_x, offset_y)
......
...@@ -94,6 +94,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( ...@@ -94,6 +94,7 @@ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(
display_pixel_obj, 3, 3, mp_display_pixel display_pixel_obj, 3, 3, mp_display_pixel
); );
/* draw pixels on the display */
static mp_obj_t mp_display_pixels(size_t n_args, const mp_obj_t *args) static mp_obj_t mp_display_pixels(size_t n_args, const mp_obj_t *args)
{ {
uint8_t offset_x = mp_obj_get_int(args[1]); uint8_t offset_x = mp_obj_get_int(args[1]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment