11/*
22 * Copyright (c) wyrdsec (MIT License)
3- *
3+ *
44 * Permission is hereby granted, free of charge, to any person obtaining a copy of
55 * this software and associated documentation files (the "Software"), to deal in
66 * the Software without restriction, including without limitation the rights to
2828#include "shared-bindings/microcontroller/Pin.h"
2929#include "shared-module/displayio/__init__.h"
3030
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- //|...
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+ // |...
7777static 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 ) {
7878 enum { ARG_spi_bus , ARG_chip_select , ARG_reset , ARG_busy , ARG_discharge , ARG_width , ARG_height , ARG_power , ARG_free_bus , NUM_ARGS };
7979 static const mp_arg_t allowed_args [] = {
@@ -116,26 +116,26 @@ static mp_int_t aurora_epaper_framebuffer_get_buffer(mp_obj_t self_in, mp_buffer
116116 return 0 ;
117117}
118118
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- //| ...
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+ // | ...
124124static mp_obj_t aurora_epaper_framebuffer_deinit (mp_obj_t self_in ) {
125125 aurora_epaper_framebuffer_obj_t * self = (aurora_epaper_framebuffer_obj_t * )self_in ;
126126 common_hal_aurora_epaper_framebuffer_deinit (self );
127-
127+
128128 return mp_const_none ;
129129}
130130static MP_DEFINE_CONST_FUN_OBJ_1 (aurora_epaper_framebuffer_deinit_obj , aurora_epaper_framebuffer_deinit ) ;
131131
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- //| ...
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+ // | ...
139139static mp_obj_t aurora_epaper_frambuffer_set_temperature (mp_obj_t self_in , mp_obj_t temperature ) {
140140 aurora_epaper_framebuffer_obj_t * self = (aurora_epaper_framebuffer_obj_t * )self_in ;
141141
@@ -145,10 +145,10 @@ static mp_obj_t aurora_epaper_frambuffer_set_temperature(mp_obj_t self_in, mp_ob
145145}
146146static MP_DEFINE_CONST_FUN_OBJ_2 (aurora_epaper_frambuffer_set_temperature_obj , aurora_epaper_frambuffer_set_temperature ) ;
147147
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- //| ...
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+ // | ...
152152static mp_obj_t aurora_epaper_framebuffer_get_free_bus (mp_obj_t self_in ) {
153153 aurora_epaper_framebuffer_obj_t * self = (aurora_epaper_framebuffer_obj_t * )self_in ;
154154 return mp_obj_new_bool (self -> free_bus );
@@ -182,4 +182,4 @@ MP_DEFINE_CONST_OBJ_TYPE(
182182 locals_dict , & aurora_epaper_framebuffer_locals_dict ,
183183 buffer , aurora_epaper_framebuffer_get_buffer ,
184184 protocol , & aurora_epaper_framebuffer_proto
185- );
185+ );
0 commit comments