Did _eve, fontio, framebufferio, and frequencyio

This commit is contained in:
dherrada 2020-05-07 11:56:46 -04:00
parent 2ebe3035df
commit a3d5adb43c
No known key found for this signature in database
GPG Key ID: CE2ADBAB8775CE81
8 changed files with 371 additions and 364 deletions

View File

@ -34,7 +34,20 @@
#include "shared-module/_eve/__init__.h"
#include "shared-bindings/_eve/__init__.h"
//| :mod:`_eve` --- low-level BridgeTek EVE bindings
//| """:mod:`_eve` --- low-level BridgeTek EVE bindings
//| ================================================
//|
//| .. module:: _eve
@ -43,7 +56,7 @@
//|
//| The `_eve` module provides a class _EVE which
//| contains methods for constructing EVE command
//| buffers and appending basic graphics commands.
//| buffers and appending basic graphics commands."""
//|
typedef struct _mp_obj__EVE_t {
@ -63,11 +76,11 @@ STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register);
//| .. method:: flush()
//|
//| Send any queued drawing commands directly to the hardware.
//| def flush(self, ) -> Any:
//| """Send any queued drawing commands directly to the hardware.
//|
//| :param int width: The width of the grid in tiles, or 1 for sprites.
//| :param int width: The width of the grid in tiles, or 1 for sprites."""
//| ...
//|
STATIC mp_obj_t _flush(mp_obj_t self) {
common_hal__eve_flush(EVEHAL(self));
@ -75,11 +88,11 @@ STATIC mp_obj_t _flush(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
//| .. method:: cc(b)
//|
//| Append bytes to the command FIFO.
//| def cc(self, b: bytes) -> Any:
//| """Append bytes to the command FIFO.
//|
//| :param bytes b: The bytes to add
//| :param bytes b: The bytes to add"""
//| ...
//|
STATIC mp_obj_t _cc(mp_obj_t self, mp_obj_t b) {
mp_buffer_info_t buffer_info;
@ -91,14 +104,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc);
//{
//| .. method:: AlphaFunc(func, ref)
//|
//| Set the alpha test function
//| def AlphaFunc(self, func: int, ref: int) -> Any:
//| """Set the alpha test function
//|
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
//| :param int ref: specifies the reference value for the alpha test. Range 0-255. The initial value is 0
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -109,14 +122,14 @@ STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc);
//| .. method:: Begin(prim)
//|
//| Begin drawing a graphics primitive
//| def Begin(self, prim: int) -> Any:
//| """Begin drawing a graphics primitive
//|
//| :param int prim: graphics primitive.
//|
//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.
//|
//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``."""
//| ...
//|
STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) {
uint32_t prim = mp_obj_get_int_truncated(a0);
@ -125,11 +138,11 @@ STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(begin_obj, _begin);
//| .. method:: BitmapExtFormat(format)
//| def BitmapExtFormat(self, format: int) -> Any:
//| """Set the bitmap format
//|
//| Set the bitmap format
//|
//| :param int format: bitmap pixel format.
//| :param int format: bitmap pixel format."""
//| ...
//|
STATIC mp_obj_t _bitmapextformat(mp_obj_t self, mp_obj_t a0) {
@ -139,13 +152,13 @@ STATIC mp_obj_t _bitmapextformat(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat);
//| .. method:: BitmapHandle(handle)
//|
//| Set the bitmap handle
//| def BitmapHandle(self, handle: int) -> Any:
//| """Set the bitmap handle
//|
//| :param int handle: bitmap handle. Range 0-31. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) {
@ -155,12 +168,12 @@ STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaphandle_obj, _bitmaphandle);
//| .. method:: BitmapLayoutH(linestride, height)
//|
//| Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps
//| def BitmapLayoutH(self, linestride: int, height: int) -> Any:
//| """Set the source bitmap memory format and layout for the current handle. high bits for large bitmaps
//|
//| :param int linestride: high part of bitmap line stride, in bytes. Range 0-7
//| :param int height: high part of bitmap height, in lines. Range 0-3
//| :param int height: high part of bitmap height, in lines. Range 0-3"""
//| ...
//|
STATIC mp_obj_t _bitmaplayouth(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -171,13 +184,13 @@ STATIC mp_obj_t _bitmaplayouth(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaplayouth_obj, _bitmaplayouth);
//| .. method:: BitmapLayout(format, linestride, height)
//|
//| Set the source bitmap memory format and layout for the current handle
//| def BitmapLayout(self, format: int, linestride: int, height: int) -> Any:
//| """Set the source bitmap memory format and layout for the current handle
//|
//| :param int format: bitmap pixel format, or GLFORMAT to use BITMAP_EXT_FORMAT instead. Range 0-31
//| :param int linestride: bitmap line stride, in bytes. Range 0-1023
//| :param int height: bitmap height, in lines. Range 0-511
//| :param int height: bitmap height, in lines. Range 0-511"""
//| ...
//|
STATIC mp_obj_t _bitmaplayout(size_t n_args, const mp_obj_t *args) {
@ -189,12 +202,12 @@ STATIC mp_obj_t _bitmaplayout(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmaplayout_obj, 4, 4, _bitmaplayout);
//| .. method:: BitmapSizeH(width, height)
//|
//| Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps
//| def BitmapSizeH(self, width: int, height: int) -> Any:
//| """Set the screen drawing of bitmaps for the current handle. high bits for large bitmaps
//|
//| :param int width: high part of drawn bitmap width, in pixels. Range 0-3
//| :param int height: high part of drawn bitmap height, in pixels. Range 0-3
//| :param int height: high part of drawn bitmap height, in pixels. Range 0-3"""
//| ...
//|
STATIC mp_obj_t _bitmapsizeh(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -205,15 +218,15 @@ STATIC mp_obj_t _bitmapsizeh(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmapsizeh_obj, _bitmapsizeh);
//| .. method:: BitmapSize(filter, wrapx, wrapy, width, height)
//|
//| Set the screen drawing of bitmaps for the current handle
//| def BitmapSize(self, filter: int, wrapx: int, wrapy: int, width: int, height: int) -> Any:
//| """Set the screen drawing of bitmaps for the current handle
//|
//| :param int filter: bitmap filtering mode, one of ``NEAREST`` or ``BILINEAR``. Range 0-1
//| :param int wrapx: bitmap :math:`x` wrap mode, one of ``REPEAT`` or ``BORDER``. Range 0-1
//| :param int wrapy: bitmap :math:`y` wrap mode, one of ``REPEAT`` or ``BORDER``. Range 0-1
//| :param int width: drawn bitmap width, in pixels. Range 0-511
//| :param int height: drawn bitmap height, in pixels. Range 0-511
//| :param int height: drawn bitmap height, in pixels. Range 0-511"""
//| ...
//|
STATIC mp_obj_t _bitmapsize(size_t n_args, const mp_obj_t *args) {
@ -227,11 +240,11 @@ STATIC mp_obj_t _bitmapsize(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize);
//| .. method:: BitmapSource(addr)
//| def BitmapSource(self, addr: int) -> Any:
//| """Set the source address for bitmap graphics
//|
//| Set the source address for bitmap graphics
//|
//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215
//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215"""
//| ...
//|
STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) {
@ -241,14 +254,14 @@ STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapsource_obj, _bitmapsource);
//| .. method:: BitmapSwizzle(r, g, b, a)
//|
//| Set the source for the r,g,b and a channels of a bitmap
//| def BitmapSwizzle(self, r: int, g: int, b: int, a: int) -> Any:
//| """Set the source for the r,g,b and a channels of a bitmap
//|
//| :param int r: red component source channel. Range 0-7
//| :param int g: green component source channel. Range 0-7
//| :param int b: blue component source channel. Range 0-7
//| :param int a: alpha component source channel. Range 0-7
//| :param int a: alpha component source channel. Range 0-7"""
//| ...
//|
STATIC mp_obj_t _bitmapswizzle(size_t n_args, const mp_obj_t *args) {
@ -261,16 +274,16 @@ STATIC mp_obj_t _bitmapswizzle(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizzle);
//| .. method:: BitmapTransformA(p, v)
//|
//| Set the :math:`a` component of the bitmap transform matrix
//| def BitmapTransformA(self, p: Any, v: int) -> Any:
//| """Set the :math:`a` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`a` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256
//|
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -281,16 +294,16 @@ STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
//| .. method:: BitmapTransformB(p, v)
//|
//| Set the :math:`b` component of the bitmap transform matrix
//| def BitmapTransformB(self, p: Any, v: int) -> Any:
//| """Set the :math:`b` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`b` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0
//|
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -301,13 +314,13 @@ STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
//| .. method:: BitmapTransformC(v)
//|
//| Set the :math:`c` component of the bitmap transform matrix
//| def BitmapTransformC(self, v: int) -> Any:
//| """Set the :math:`c` component of the bitmap transform matrix
//|
//| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
@ -317,16 +330,16 @@ STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
//| .. method:: BitmapTransformD(p, v)
//|
//| Set the :math:`d` component of the bitmap transform matrix
//| def BitmapTransformD(self, p: Any, v: int) -> Any:
//| """Set the :math:`d` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`d` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0
//|
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -337,16 +350,16 @@ STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
//| .. method:: BitmapTransformE(p, v)
//|
//| Set the :math:`e` component of the bitmap transform matrix
//| def BitmapTransformE(self, p: Any, v: int) -> Any:
//| """Set the :math:`e` component of the bitmap transform matrix
//|
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`e` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256
//|
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -357,13 +370,13 @@ STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
//| .. method:: BitmapTransformF(v)
//|
//| Set the :math:`f` component of the bitmap transform matrix
//| def BitmapTransformF(self, v: int) -> Any:
//| """Set the :math:`f` component of the bitmap transform matrix
//|
//| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
@ -373,14 +386,14 @@ STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
//| .. method:: BlendFunc(src, dst)
//|
//| Set pixel arithmetic
//| def BlendFunc(self, src: int, dst: int) -> Any:
//| """Set pixel arithmetic
//|
//| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2)
//| :param int dst: specifies how the destination blending factor is computed, one of the same constants as **src**. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4)
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -391,11 +404,11 @@ STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(blendfunc_obj, _blendfunc);
//| .. method:: Call(dest)
//| def Call(self, dest: int) -> Any:
//| """Execute a sequence of commands at another location in the display list
//|
//| Execute a sequence of commands at another location in the display list
//|
//| :param int dest: display list address. Range 0-65535
//| :param int dest: display list address. Range 0-65535"""
//| ...
//|
STATIC mp_obj_t _call(mp_obj_t self, mp_obj_t a0) {
@ -405,13 +418,13 @@ STATIC mp_obj_t _call(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call);
//| .. method:: Cell(cell)
//|
//| Set the bitmap cell number for the vertex2f command
//| def Cell(self, cell: int) -> Any:
//| """Set the bitmap cell number for the vertex2f command
//|
//| :param int cell: bitmap cell number. Range 0-127. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) {
@ -421,13 +434,13 @@ STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell);
//| .. method:: ClearColorA(alpha)
//|
//| Set clear value for the alpha channel
//| def ClearColorA(self, alpha: int) -> Any:
//| """Set clear value for the alpha channel
//|
//| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) {
@ -437,15 +450,15 @@ STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora);
//| .. method:: ClearColorRGB(red, green, blue)
//|
//| Set clear values for red, green and blue channels
//| def ClearColorRGB(self, red: int, green: int, blue: int) -> Any:
//| """Set clear values for red, green and blue channels
//|
//| :param int red: red value used when the color buffer is cleared. Range 0-255. The initial value is 0
//| :param int green: green value used when the color buffer is cleared. Range 0-255. The initial value is 0
//| :param int blue: blue value used when the color buffer is cleared. Range 0-255. The initial value is 0
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) {
@ -457,13 +470,13 @@ STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clearcolorrgb_obj, 4, 4, _clearcolorrgb);
//| .. method:: Clear(c, s, t)
//|
//| Clear buffers to preset values
//| def Clear(self, c: int, s: int, t: int) -> Any:
//| """Clear buffers to preset values
//|
//| :param int c: clear color buffer. Range 0-1
//| :param int s: clear stencil buffer. Range 0-1
//| :param int t: clear tag buffer. Range 0-1
//| :param int t: clear tag buffer. Range 0-1"""
//| ...
//|
STATIC mp_obj_t _clear(size_t n_args, const mp_obj_t *args) {
@ -475,13 +488,13 @@ STATIC mp_obj_t _clear(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear);
//| .. method:: ClearStencil(s)
//|
//| Set clear value for the stencil buffer
//| def ClearStencil(self, s: int) -> Any:
//| """Set clear value for the stencil buffer
//|
//| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) {
@ -491,13 +504,12 @@ STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil);
//| .. method:: ClearTag(s)
//|
//| Set clear value for the tag buffer
//| def ClearTag(self, s: int) -> Any:
//| """Set clear value for the tag buffer
//|
//| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//|
STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) {
@ -507,13 +519,13 @@ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag);
//| .. method:: ColorA(alpha)
//|
//| Set the current color alpha
//| def ColorA(self, alpha: int) -> Any:
//| """Set the current color alpha
//|
//| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) {
@ -523,16 +535,16 @@ STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora);
//| .. method:: ColorMask(r, g, b, a)
//|
//| Enable and disable writing of frame buffer color components
//| def ColorMask(self, r: int, g: int, b: int, a: int) -> Any:
//| """Enable and disable writing of frame buffer color components
//|
//| :param int r: allow updates to the frame buffer red component. Range 0-1. The initial value is 1
//| :param int g: allow updates to the frame buffer green component. Range 0-1. The initial value is 1
//| :param int b: allow updates to the frame buffer blue component. Range 0-1. The initial value is 1
//| :param int a: allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) {
@ -545,15 +557,15 @@ STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask);
//| .. method:: ColorRGB(red, green, blue)
//|
//| Set the drawing color
//| def ColorRGB(self, red: int, green: int, blue: int) -> Any:
//| """Set the drawing color
//|
//| :param int red: red value for the current color. Range 0-255. The initial value is 255
//| :param int green: green for the current color. Range 0-255. The initial value is 255
//| :param int blue: blue for the current color. Range 0-255. The initial value is 255
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) {
@ -565,9 +577,8 @@ STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colorrgb_obj, 4, 4, _colorrgb);
//| .. method:: Display()
//|
//| End the display list
//| def Display(self, ) -> Any: ...
//| """End the display list"""
//|
STATIC mp_obj_t _display(mp_obj_t self) {
@ -577,12 +588,12 @@ STATIC mp_obj_t _display(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display);
//| .. method:: End()
//| def End(self, ) -> Any:
//| """End drawing a graphics primitive
//|
//| End drawing a graphics primitive
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`."""
//| ...
//|
//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.
//|
STATIC mp_obj_t _end(mp_obj_t self) {
@ -591,11 +602,11 @@ STATIC mp_obj_t _end(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(end_obj, _end);
//| .. method:: Jump(dest)
//| def Jump(self, dest: int) -> Any:
//| """Execute commands at another location in the display list
//|
//| Execute commands at another location in the display list
//|
//| :param int dest: display list address. Range 0-65535
//| :param int dest: display list address. Range 0-65535"""
//| ...
//|
STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) {
@ -605,13 +616,13 @@ STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump);
//| .. method:: LineWidth(width)
//|
//| Set the width of rasterized lines
//| def LineWidth(self, width: int) -> Any:
//| """Set the width of rasterized lines
//|
//| :param int width: line width in :math:`1/16` pixel. Range 0-4095. The initial value is 16
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) {
@ -621,11 +632,11 @@ STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth);
//| .. method:: Macro(m)
//| def Macro(self, m: int) -> Any:
//| """Execute a single command from a macro register
//|
//| Execute a single command from a macro register
//|
//| :param int m: macro register to read. Range 0-1
//| :param int m: macro register to read. Range 0-1"""
//| ...
//|
STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) {
@ -635,9 +646,9 @@ STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro);
//| .. method:: Nop()
//|
//| No operation
//| def Nop(self, ) -> Any:
//| """No operation"""
//| ...
//|
STATIC mp_obj_t _nop(mp_obj_t self) {
@ -647,13 +658,13 @@ STATIC mp_obj_t _nop(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop);
//| .. method:: PaletteSource(addr)
//|
//| Set the base address of the palette
//| def PaletteSource(self, addr: int) -> Any:
//| """Set the base address of the palette
//|
//| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) {
@ -663,13 +674,13 @@ STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource);
//| .. method:: PointSize(size)
//|
//| Set the radius of rasterized points
//| def PointSize(self, size: int) -> Any:
//| """Set the radius of rasterized points
//|
//| :param int size: point radius in :math:`1/16` pixel. Range 0-8191. The initial value is 16
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
@ -679,9 +690,9 @@ STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize);
//| .. method:: RestoreContext()
//|
//| Restore the current graphics context from the context stack
//| def RestoreContext(self, ) -> Any:
//| """Restore the current graphics context from the context stack"""
//| ...
//|
STATIC mp_obj_t _restorecontext(mp_obj_t self) {
@ -691,9 +702,9 @@ STATIC mp_obj_t _restorecontext(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext);
//| .. method:: Return()
//|
//| Return from a previous call command
//| def Return(self, ) -> Any:
//| """Return from a previous call command"""
//| ...
//|
STATIC mp_obj_t _return(mp_obj_t self) {
@ -703,9 +714,9 @@ STATIC mp_obj_t _return(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return);
//| .. method:: SaveContext()
//|
//| Push the current graphics context on the context stack
//| def SaveContext(self, ) -> Any:
//| """Push the current graphics context on the context stack"""
//| ...
//|
STATIC mp_obj_t _savecontext(mp_obj_t self) {
@ -715,14 +726,14 @@ STATIC mp_obj_t _savecontext(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext);
//| .. method:: ScissorSize(width, height)
//|
//| Set the size of the scissor clip rectangle
//| def ScissorSize(self, width: int, height: int) -> Any:
//| """Set the size of the scissor clip rectangle
//|
//| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize
//| :param int height: The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -733,14 +744,14 @@ STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize);
//| .. method:: ScissorXY(x, y)
//|
//| Set the top left corner of the scissor clip rectangle
//| def ScissorXY(self, x: int, y: int) -> Any:
//| """Set the top left corner of the scissor clip rectangle
//|
//| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
//| :param int y: The :math:`y` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -751,15 +762,15 @@ STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy);
//| .. method:: StencilFunc(func, ref, mask)
//|
//| Set function and reference value for stencil testing
//| def StencilFunc(self, func: int, ref: int, mask: int) -> Any:
//| """Set function and reference value for stencil testing
//|
//| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7)
//| :param int ref: specifies the reference value for the stencil test. Range 0-255. The initial value is 0
//| :param int mask: specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) {
@ -771,13 +782,13 @@ STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc);
//| .. method:: StencilMask(mask)
//|
//| Control the writing of individual bits in the stencil planes
//| def StencilMask(self, mask: int) -> Any:
//| """Control the writing of individual bits in the stencil planes
//|
//| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) {
@ -787,14 +798,14 @@ STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask);
//| .. method:: StencilOp(sfail, spass)
//|
//| Set stencil test actions
//| def StencilOp(self, sfail: int, spass: int) -> Any:
//| """Set stencil test actions
//|
//| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1)
//| :param int spass: specifies the action to take when the stencil test passes, one of the same constants as **sfail**. Range 0-7. The initial value is KEEP(1)
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
@ -805,13 +816,13 @@ STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop);
//| .. method:: TagMask(mask)
//|
//| Control the writing of the tag buffer
//| def TagMask(self, mask: int) -> Any:
//| """Control the writing of the tag buffer
//|
//| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) {
@ -821,13 +832,13 @@ STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask);
//| .. method:: Tag(s)
//|
//| Set the current tag value
//| def Tag(self, s: int) -> Any:
//| """Set the current tag value
//|
//| :param int s: tag value. Range 0-255. The initial value is 255
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) {
@ -837,13 +848,13 @@ STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(tag_obj, _tag);
//| .. method:: VertexTranslateX(x)
//|
//| Set the vertex transformation's x translation component
//| def VertexTranslateX(self, x: int) -> Any:
//| """Set the vertex transformation's x translation component
//|
//| :param int x: signed x-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) {
@ -853,13 +864,13 @@ STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex);
//| .. method:: VertexTranslateY(y)
//|
//| Set the vertex transformation's y translation component
//| def VertexTranslateY(self, y: int) -> Any:
//| """Set the vertex transformation's y translation component
//|
//| :param int y: signed y-coordinate in :math:`1/16` pixel. Range 0-131071. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
@ -870,13 +881,13 @@ STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey);
//| .. method:: VertexFormat(frac)
//|
//| Set the precision of vertex2f coordinates
//| def VertexFormat(self, frac: int) -> Any:
//| """Set the precision of vertex2f coordinates
//|
//| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`."""
//| ...
//|
STATIC mp_obj_t _vertexformat(mp_obj_t self, mp_obj_t a0) {
@ -886,15 +897,15 @@ STATIC mp_obj_t _vertexformat(mp_obj_t self, mp_obj_t a0) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertexformat_obj, _vertexformat);
//| .. method:: Vertex2ii(x, y, handle, cell)
//|
//| :param int x: x-coordinate in pixels. Range 0-511
//| def Vertex2ii(self, x: int, y: int, handle: int, cell: int) -> Any:
//| """:param int x: x-coordinate in pixels. Range 0-511
//| :param int y: y-coordinate in pixels. Range 0-511
//| :param int handle: bitmap handle. Range 0-31
//| :param int cell: cell number. Range 0-127
//|
//| This method is an alternative to :meth:`Vertex2f`.
//|
//| This method is an alternative to :meth:`Vertex2f`."""
//| ...
//|
STATIC mp_obj_t _vertex2ii(size_t n_args, const mp_obj_t *args) {
uint32_t x = mp_obj_get_int_truncated(args[1]);
@ -961,12 +972,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii);
// Hand-written functions {
//| .. method:: Vertex2f(b)
//|
//| Draw a point.
//| def Vertex2f(self, b: Any) -> Any:
//| """Draw a point.
//|
//| :param float x: pixel x-coordinate
//| :param float y: pixel y-coordinate
//| :param float y: pixel y-coordinate"""
//| ...
//|
STATIC mp_obj_t _vertex2f(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
mp_float_t x = mp_obj_get_float(a0);
@ -980,14 +991,14 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f);
#define ADD_X(self, x) \
common_hal__eve_add(EVEHAL(self), sizeof(x), &(x));
//| .. method:: cmd0(n)
//|
//| Append the command word n to the FIFO
//| def cmd0(self, n: int) -> Any:
//| """Append the command word n to the FIFO
//|
//| :param int n: The command code
//|
//| This method is used by the ``eve`` module to efficiently add
//| commands to the FIFO.
//| commands to the FIFO."""
//| ...
//|
STATIC mp_obj_t _cmd0(mp_obj_t self, mp_obj_t n) {
@ -997,9 +1008,8 @@ STATIC mp_obj_t _cmd0(mp_obj_t self, mp_obj_t n) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0);
//| .. method:: cmd(n, fmt, args)
//|
//| Append a command packet to the FIFO.
//| def cmd(self, n: int, fmt: str, args: tuple) -> Any:
//| """Append a command packet to the FIFO.
//|
//| :param int n: The command code
//| :param str fmt: The command format `struct` layout
@ -1008,7 +1018,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cmd0_obj, _cmd0);
//| Supported format codes: h, H, i, I.
//|
//| This method is used by the ``eve`` module to efficiently add
//| commands to the FIFO.
//| commands to the FIFO."""
//| ...
//|
STATIC mp_obj_t _cmd(size_t n_args, const mp_obj_t *args) {
mp_obj_t self = args[0];

View File

@ -36,25 +36,25 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
//| .. currentmodule:: fontio
//| class BuiltinFont:
//| """.. currentmodule:: fontio
//|
//| :class:`BuiltinFont` -- A font built into CircuitPython
//| =========================================================================================
//| :class:`BuiltinFont` -- A font built into CircuitPython
//| =========================================================================================
//|
//| A font built into CircuitPython.
//| A font built into CircuitPython."""
//|
//| .. class:: BuiltinFont()
//|
//| Creation not supported. Available fonts are defined when CircuitPython is built. See the
//| `Adafruit_CircuitPython_Bitmap_Font <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_
//| library for dynamically loaded fonts.
//| def __init__(self, ):
//| """Creation not supported. Available fonts are defined when CircuitPython is built. See the
//| `Adafruit_CircuitPython_Bitmap_Font <https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font>`_
//| library for dynamically loaded fonts."""
//| ...
//|
//| .. attribute:: bitmap
//|
//| Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use
//| bitmap: Any = ...
//| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use
//| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and
//| `terminalio.Terminal`.
//| `terminalio.Terminal`."""
//|
STATIC mp_obj_t fontio_builtinfont_obj_get_bitmap(mp_obj_t self_in) {
fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in);
@ -69,9 +69,9 @@ const mp_obj_property_t fontio_builtinfont_bitmap_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. method:: get_bounding_box()
//|
//| Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height.
//| def get_bounding_box(self, ) -> Any:
//| """Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height."""
//| ...
//|
STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) {
fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in);
@ -81,9 +81,9 @@ STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) {
MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builtinfont_obj_get_bounding_box);
//| .. method:: get_glyph(codepoint)
//|
//| Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available.
//| def get_glyph(self, codepoint: Any) -> Any:
//| """Returns a `fontio.Glyph` for the given codepoint or None if no glyph is available."""
//| ...
//|
STATIC mp_obj_t fontio_builtinfont_obj_get_glyph(mp_obj_t self_in, mp_obj_t codepoint_obj) {
fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -28,23 +28,24 @@
#include <stdint.h>
//| .. currentmodule:: fontio
//| class Glyph:
//| """.. currentmodule:: fontio
//|
//| :class:`Glyph` -- Storage of glyph info
//| ==========================================================================
//| :class:`Glyph` -- Storage of glyph info
//| =========================================================================="""
//|
//| .. class:: Glyph(bitmap, tile_index, width, height, dx, dy, shift_x, shift_y)
//| def __init__(self, bitmap: displayio.Bitmap, tile_index: int, width: int, height: int, dx: int, dy: int, shift_x: int, shift_y: int):
//| """Named tuple used to capture a single glyph and its attributes.
//|
//| Named tuple used to capture a single glyph and its attributes.
//|
//| :param displayio.Bitmap bitmap: the bitmap including the glyph
//| :param int tile_index: the tile index within the bitmap
//| :param int width: the width of the glyph's bitmap
//| :param int height: the height of the glyph's bitmap
//| :param int dx: x adjustment to the bitmap's position
//| :param int dy: y adjustment to the bitmap's position
//| :param int shift_x: the x difference to the next glyph
//| :param int shift_y: the y difference to the next glyph
//| :param displayio.Bitmap bitmap: the bitmap including the glyph
//| :param int tile_index: the tile index within the bitmap
//| :param int width: the width of the glyph's bitmap
//| :param int height: the height of the glyph's bitmap
//| :param int dx: x adjustment to the bitmap's position
//| :param int dy: y adjustment to the bitmap's position
//| :param int shift_x: the x difference to the next glyph
//| :param int shift_y: the y difference to the next glyph"""
//| ...
//|
const mp_obj_namedtuple_type_t fontio_glyph_type = {
.base = {

View File

@ -33,7 +33,7 @@
#include "shared-bindings/fontio/BuiltinFont.h"
#include "shared-bindings/fontio/Glyph.h"
//| :mod:`fontio` --- Core font related data structures
//| """:mod:`fontio` --- Core font related data structures
//| =========================================================================
//|
//| .. module:: fontio
@ -48,7 +48,7 @@
//| :maxdepth: 3
//|
//| BuiltinFont
//| Glyph
//| Glyph"""
//|
STATIC const mp_rom_map_elem_t fontio_module_globals_table[] = {

View File

@ -40,23 +40,24 @@
#include "shared-module/displayio/__init__.h"
#include "supervisor/shared/translate.h"
//| .. currentmodule:: framebufferio
//| class FramebufferDisplay:
//| """.. currentmodule:: framebufferio
//|
//| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
//| ================================================================================
//| :class:`FramebufferDisplay` -- Manage updating a display with framebuffer in RAM
//| ================================================================================
//|
//| This initializes a display and connects it into CircuitPython. Unlike other
//| objects in CircuitPython, Display objects live until `displayio.release_displays()`
//| is called. This is done so that CircuitPython can use the display itself.
//| This initializes a display and connects it into CircuitPython. Unlike other
//| objects in CircuitPython, Display objects live until `displayio.release_displays()`
//| is called. This is done so that CircuitPython can use the display itself."""
//|
//| .. class:: FramebufferDisplay(framebuffer, *, rotation=0, auto_refresh=True)
//| def __init__(self, framebuffer: Any, *, rotation: int = 0, auto_refresh: bool = True):
//| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
//|
//| Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc)
//|
//| :param framebuffer: The framebuffer that the display is connected to
//| :type framebuffer: any core object implementing the framebuffer protocol
//| :param bool auto_refresh: Automatically refresh the screen
//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)
//| :param framebuffer: The framebuffer that the display is connected to
//| :type framebuffer: any core object implementing the framebuffer protocol
//| :param bool auto_refresh: Automatically refresh the screen
//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)"""
//| ...
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_framebuffer, ARG_rotation, ARG_auto_refresh, NUM_ARGS };
@ -96,12 +97,12 @@ static framebufferio_framebufferdisplay_obj_t* native_display(mp_obj_t display_o
return MP_OBJ_TO_PTR(native_display);
}
//| .. method:: show(group)
//| def show(self, group: Group) -> Any:
//| """Switches to displaying the given group of layers. When group is None, the default
//| CircuitPython terminal will be shown.
//|
//| Switches to displaying the given group of layers. When group is None, the default
//| CircuitPython terminal will be shown.
//|
//| :param Group group: The group to show.
//| :param Group group: The group to show."""
//| ...
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
@ -118,21 +119,21 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_o
}
MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show);
//| .. method:: refresh(*, target_frames_per_second=60, minimum_frames_per_second=1)
//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> Any:
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
//| returning True. If the call has taken too long since the last refresh call for the given
//| target frame rate, then the refresh returns False immediately without updating the screen to
//| hopefully help getting caught up.
//|
//| When auto refresh is off, waits for the target frame rate and then refreshes the display,
//| returning True. If the call has taken too long since the last refresh call for the given
//| target frame rate, then the refresh returns False immediately without updating the screen to
//| hopefully help getting caught up.
//| If the time since the last successful refresh is below the minimum frame rate, then an
//| exception will be raised. Set minimum_frames_per_second to 0 to disable.
//|
//| If the time since the last successful refresh is below the minimum frame rate, then an
//| exception will be raised. Set minimum_frames_per_second to 0 to disable.
//| When auto refresh is on, updates the display immediately. (The display will also update
//| without calls to this.)
//|
//| When auto refresh is on, updates the display immediately. (The display will also update
//| without calls to this.)
//|
//| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated.
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.
//| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated.
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second."""
//| ...
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second };
@ -153,9 +154,8 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, cons
}
MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, framebufferio_framebufferdisplay_obj_refresh);
//| .. attribute:: auto_refresh
//|
//| True when the display is refreshed automatically.
//| auto_refresh: Any = ...
//| """True when the display is refreshed automatically."""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
@ -179,11 +179,10 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_refresh_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: brightness
//|
//| The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
//| brightness: Any = ...
//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
//| `auto_brightness` is True, the value of `brightness` will change automatically.
//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.
//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False."""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_brightness(mp_obj_t self_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
@ -217,12 +216,11 @@ const mp_obj_property_t framebufferio_framebufferdisplay_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: auto_brightness
//|
//| True when the display brightness is adjusted automatically, based on an ambient
//| auto_brightness: Any = ...
//| """True when the display brightness is adjusted automatically, based on an ambient
//| light sensor or other method. Note that some displays may have this set to True by default,
//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False
//| if `brightness` is set manually.
//| if `brightness` is set manually."""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_brightness(mp_obj_t self_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
@ -249,9 +247,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_auto_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: width
//|
//| Gets the width of the framebuffer
//| width: Any = ...
//| """Gets the width of the framebuffer"""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
@ -266,9 +263,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: height
//|
//| Gets the height of the framebuffer
//| height: Any = ...
//| """Gets the height of the framebuffer"""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
@ -283,9 +279,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_height_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: rotation
//|
//| The rotation of the display as an int in degrees.
//| rotation: Any = ...
//| """The rotation of the display as an int in degrees."""
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) {
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
@ -307,9 +302,8 @@ const mp_obj_property_t framebufferio_framebufferdisplay_rotation_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: framebuffer
//|
//| The framebuffer being used by the display
//| framebuffer: Any = ...
//| """The framebuffer being used by the display"""
//|
//|
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_framebuffer(mp_obj_t self_in) {
@ -326,12 +320,13 @@ const mp_obj_property_t framebufferio_framebufferframebuffer_obj = {
};
//| .. method:: fill_row(y, buffer)
//| def fill_row(self, y: int, buffer: bytearray) -> Any:
//| """Extract the pixels from a single row
//|
//| Extract the pixels from a single row
//| :param int y: The top edge of the area
//| :param bytearray buffer: The buffer in which to place the pixel data"""
//| ...
//|
//| :param int y: The top edge of the area
//| :param bytearray buffer: The buffer in which to place the pixel data
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_y, ARG_buffer };
static const mp_arg_t allowed_args[] = {

View File

@ -28,7 +28,7 @@
#include "shared-bindings/framebufferio/__init__.h"
#include "shared-bindings/framebufferio/FramebufferDisplay.h"
//| :mod:`framebufferio` --- Native framebuffer display driving
//| """:mod:`framebufferio` --- Native framebuffer display driving
//| =========================================================================
//|
//| .. module:: framebufferio
@ -46,7 +46,7 @@
//| .. toctree::
//| :maxdepth: 3
//|
//| FramebufferDisplay
//| FramebufferDisplay"""
//|
#if CIRCUITPY_FRAMEBUFFERIO

View File

@ -35,43 +35,44 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
//| .. currentmodule:: frequencyio
//| class FrequencyIn:
//| """.. currentmodule:: frequencyio
//|
//| :class:`FrequencyIn` -- Read a frequency signal
//| ========================================================
//| :class:`FrequencyIn` -- Read a frequency signal
//| ========================================================
//|
//| FrequencyIn is used to measure the frequency, in hertz, of a digital signal
//| on an incoming pin. Accuracy has shown to be within 10%, if not better. It
//| is recommended to utilize an average of multiple samples to smooth out readings.
//| FrequencyIn is used to measure the frequency, in hertz, of a digital signal
//| on an incoming pin. Accuracy has shown to be within 10%, if not better. It
//| is recommended to utilize an average of multiple samples to smooth out readings.
//|
//| Frequencies below 1KHz are not currently detectable.
//| Frequencies below 1KHz are not currently detectable.
//|
//| FrequencyIn will not determine pulse width (use ``PulseIn``).
//| FrequencyIn will not determine pulse width (use ``PulseIn``)."""
//|
//| .. class:: FrequencyIn(pin, capture_period=10)
//| def __init__(self, pin: microcontroller.Pin, capture_period: int = 10):
//| """Create a FrequencyIn object associated with the given pin.
//|
//| Create a FrequencyIn object associated with the given pin.
//| :param ~microcontroller.Pin pin: Pin to read frequency from.
//| :param int capture_period: Keyword argument to set the measurement period, in
//| milliseconds. Default is 10ms; range is 1ms - 500ms.
//|
//| :param ~microcontroller.Pin pin: Pin to read frequency from.
//| :param int capture_period: Keyword argument to set the measurement period, in
//| milliseconds. Default is 10ms; range is 1ms - 500ms.
//| Read the incoming frequency from a pin::
//|
//| Read the incoming frequency from a pin::
//| import frequencyio
//| import board
//|
//| import frequencyio
//| import board
//| frequency = frequencyio.FrequencyIn(board.D11)
//|
//| frequency = frequencyio.FrequencyIn(board.D11)
//| # Loop while printing the detected frequency
//| while True:
//| print(frequency.value)
//|
//| # Loop while printing the detected frequency
//| while True:
//| print(frequency.value)
//|
//| # Optional clear() will reset the value
//| # to zero. Without this, if the incoming
//| # signal stops, the last reading will remain
//| # as the value.
//| frequency.clear()
//| # Optional clear() will reset the value
//| # to zero. Without this, if the incoming
//| # signal stops, the last reading will remain
//| # as the value.
//| frequency.clear()"""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size_t n_args,
const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -96,9 +97,9 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size
return MP_OBJ_FROM_PTR(self);
}
//| .. method:: deinit()
//|
//| Deinitialises the FrequencyIn and releases any hardware resources for reuse.
//| def deinit(self, ) -> Any:
//| """Deinitialises the FrequencyIn and releases any hardware resources for reuse."""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_deinit(mp_obj_t self_in) {
frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -113,16 +114,16 @@ STATIC void check_for_deinit(frequencyio_frequencyin_obj_t *self) {
}
}
//| .. method:: __enter__()
//|
//| No-op used by Context Managers.
//| def __enter__(self, ) -> Any:
//| """No-op used by Context Managers."""
//| ...
//|
// Provided by context manager helper.
//| .. method:: __exit__()
//|
//| Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info.
//| def __exit__(self, ) -> Any:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_obj___exit__(size_t n_args, const mp_obj_t *args) {
(void)n_args;
@ -131,9 +132,9 @@ STATIC mp_obj_t frequencyio_frequencyin_obj___exit__(size_t n_args, const mp_obj
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(frequencyio_frequencyin___exit___obj, 4, 4, frequencyio_frequencyin_obj___exit__);
//| .. method:: pause()
//|
//| Pause frequency capture.
//| def pause(self, ) -> Any:
//| """Pause frequency capture."""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_obj_pause(mp_obj_t self_in) {
frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -144,9 +145,9 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_pause(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_pause_obj, frequencyio_frequencyin_obj_pause);
//| .. method:: resume()
//|
//| Resumes frequency capture.
//| def resume(self, ) -> Any:
//| """Resumes frequency capture."""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_obj_resume(mp_obj_t self_in) {
frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -157,9 +158,9 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_resume_obj, frequencyio_frequencyin_obj_resume);
//| .. method:: clear()
//|
//| Clears the last detected frequency capture value.
//| def clear(self, ) -> Any:
//| """Clears the last detected frequency capture value."""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_obj_clear(mp_obj_t self_in) {
@ -171,14 +172,13 @@ STATIC mp_obj_t frequencyio_frequencyin_obj_clear(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_clear_obj, frequencyio_frequencyin_obj_clear);
//| .. attribute:: capture_period
//|
//| The capture measurement period. Lower incoming frequencies will be measured
//| capture_period: Any = ...
//| """The capture measurement period. Lower incoming frequencies will be measured
//| more accurately with longer capture periods. Higher frequencies are more
//| accurate with shorter capture periods.
//|
//| .. note:: When setting a new ``capture_period``, all previous capture information is
//| cleared with a call to ``clear()``.
//| .. note:: When setting a new ``capture_period``, all previous capture information is
//| cleared with a call to ``clear()``."""
//|
STATIC mp_obj_t frequencyio_frequencyin_obj_get_capture_period(mp_obj_t self_in) {
frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -204,9 +204,9 @@ const mp_obj_property_t frequencyio_frequencyin_capture_period_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. method:: __get__(index)
//|
//| Returns the value of the last frequency captured.
//| def __get__(self, index: Any) -> Any:
//| """Returns the value of the last frequency captured."""
//| ...
//|
STATIC mp_obj_t frequencyio_frequencyin_obj_get_value(mp_obj_t self_in) {
frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -33,7 +33,7 @@
#include "shared-bindings/frequencyio/__init__.h"
#include "shared-bindings/frequencyio/FrequencyIn.h"
//| :mod:`frequencyio` --- Support for frequency based protocols
//| """:mod:`frequencyio` --- Support for frequency based protocols
//| =============================================================
//|
//| .. module:: frequencyio
@ -73,7 +73,7 @@
//| :py:data:`~frequencyio.FrequencyIn.capture_period`, and then sleep 0.1 seconds.
//| CircuitPython will automatically turn off FrequencyIn capture when it resets all
//| hardware after program completion. Use ``deinit()`` or a ``with`` statement
//| to do it yourself.
//| to do it yourself."""
//|
STATIC const mp_rom_map_elem_t frequencyio_module_globals_table[] = {