2828#include "shared-bindings/microcontroller/Pin.h"
2929#include "shared-module/displayio/__init__.h"
3030
31-
31+ //| class AuroraMemoryFramebuffer:
32+ //| """A framebuffer for Pervasive Displays Aurora E-paper display. These displays are 2 color only.
33+ //|
34+ //| This initializes a display and connects it to CircuitPython.
35+ //|
36+ //| For Example::
37+ //|
38+ //| import busio
39+ //| import framebufferio
40+ //| from aurora_epaper import AuroraMemoryFramebuffer
41+ //| spi = busio.SPI(EINK_CLKS, EINK_MOSI, EINK_MISO)
42+ //| aurora = AuroraMemoryFramebuffer(spi, EINK_CS, EINK_RST, EINK_BUSY, EINK_DISCHARGE, HEIGHT, WIDTH)
43+ //| display = framebufferio.FramebufferDisplay(t, auto_refresh=False)
44+ //| display.refresh()
45+ //|
46+ //| For more information on how these displays are driven see:
47+ //| https://www.pervasivedisplays.com/wp-content/uploads/2023/02/4P018-00_04_G2_Aurora-Mb_COG_Driver_Interface_Timing_for_small-size_20231107.pdf
48+ //| """
49+ //|
50+ //| def __init__(
51+ //| self,
52+ //| spi_bus: busio.SPI,
53+ //| chip_select: microcontroller.Pin,
54+ //| reset: microcontroller.Pin,
55+ //| busy: microcontroller.Pin,
56+ //| discharge: microcontroller.Pin,
57+ //| width: int,
58+ //| height: int,
59+ //| power: Optional[microcontroller.Pin] = None,
60+ //| free_bus: Optional[bool] = True,
61+ //| ) -> None:
62+ //| """Create a framebuffer for the Aurora CoG display.
63+ //|
64+ //| .. note:: Displays of size 1.9" and 2.6" are not tested, and exibit unexpected behavior.
65+ //|
66+ //| :param busio.SPI spi_bus: The SPI bus that the display is connected to
67+ //| :param microcontroller.Pin chip_select: The pin connected to the displays chip select input
68+ //| :param microcontroller.Pin reset: The pin connected to the displays reset input
69+ //| :param microcontroller.Pin busy: The pin connected to the displays busy output
70+ //| :param microcontroller.Pin discharge: The pin connected to the displays discharge input
71+ //| :param int width: The width of the display in pixels
72+ //| :param int height: The height of the display in pixels
73+ //| :param microcontroller.Pin power: The pin that controls power to the display (optional).
74+ //| :param bool free_bus: Determines whether the SPI bus passed in will be freed when the frame buffer is freed.
75+ //| """
76+ //|...
3277static mp_obj_t aurora_epaper_framebuffer_make_new (const mp_obj_type_t * type , size_t n_args , size_t n_kw , const mp_obj_t * all_args ) {
3378 enum { ARG_spi_bus , ARG_chip_select , ARG_reset , ARG_busy , ARG_discharge , ARG_width , ARG_height , ARG_power , ARG_free_bus , NUM_ARGS };
3479 static const mp_arg_t allowed_args [] = {
@@ -71,7 +116,11 @@ static mp_int_t aurora_epaper_framebuffer_get_buffer(mp_obj_t self_in, mp_buffer
71116 return 0 ;
72117}
73118
74-
119+ //| def deinit(self) -> None:
120+ //| """Free the resources (pins, timers, etc.) associated with this
121+ //| AuroraMemoryFramebuffer instance. After deinitialization, no further operations
122+ //| may be performed."""
123+ //| ...
75124static mp_obj_t aurora_epaper_framebuffer_deinit (mp_obj_t self_in ) {
76125 aurora_epaper_framebuffer_obj_t * self = (aurora_epaper_framebuffer_obj_t * )self_in ;
77126 common_hal_aurora_epaper_framebuffer_deinit (self );
@@ -80,7 +129,13 @@ static mp_obj_t aurora_epaper_framebuffer_deinit(mp_obj_t self_in) {
80129}
81130static MP_DEFINE_CONST_FUN_OBJ_1 (aurora_epaper_framebuffer_deinit_obj , aurora_epaper_framebuffer_deinit ) ;
82131
83-
132+ //| def set_temperature(
133+ //| self, celsius: int
134+ //| ) -> None:
135+ //| """Set the ambient temperature (in celsius) for the display driver.
136+ //| Higher temperature means faster update speed.
137+ //| """
138+ //| ...
84139static mp_obj_t aurora_epaper_frambuffer_set_temperature (mp_obj_t self_in , mp_obj_t temperature ) {
85140 aurora_epaper_framebuffer_obj_t * self = (aurora_epaper_framebuffer_obj_t * )self_in ;
86141
@@ -90,7 +145,10 @@ static mp_obj_t aurora_epaper_frambuffer_set_temperature(mp_obj_t self_in, mp_ob
90145}
91146static MP_DEFINE_CONST_FUN_OBJ_2 (aurora_epaper_frambuffer_set_temperature_obj , aurora_epaper_frambuffer_set_temperature ) ;
92147
93-
148+ //| free_bus: bool
149+ //| """When True the spi bus passed into the device will be freed on deinit.
150+ //| If you have multiple displays this could be used to keep the other active on soft reset."""
151+ //| ...
94152static mp_obj_t aurora_epaper_framebuffer_get_free_bus (mp_obj_t self_in ) {
95153 aurora_epaper_framebuffer_obj_t * self = (aurora_epaper_framebuffer_obj_t * )self_in ;
96154 return mp_obj_new_bool (self -> free_bus );
0 commit comments