Skip to content

Commit bafe45f

Browse files
committed
Docs
1 parent 1214b69 commit bafe45f

File tree

3 files changed

+82
-11
lines changed

3 files changed

+82
-11
lines changed

shared-bindings/aurora_epaper/aurora_framebuffer.c

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,52 @@
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+
//|...
3277
static 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+
//| ...
75124
static 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
}
81130
static 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+
//| ...
84139
static 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
}
91146
static 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+
//| ...
94152
static 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);

shared-bindings/aurora_epaper/aurora_framebuffer.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (c) wyrdsec (MIT License)
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
* this software and associated documentation files (the "Software"), to deal in
6+
* the Software without restriction, including without limitation the rights to
7+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8+
* the Software, and to permit persons to whom the Software is furnished to do so,
9+
* subject to the following conditions:
10+
* - The above copyright notice and this permission notice shall be included in
11+
* all copies or substantial portions of the Software.
12+
* - The Software is provided "as is", without warranty of any kind, express or
13+
* implied, including but not limited to the warranties of merchantability,
14+
* fitness for a particular purpose and noninfringement. In no event shall the
15+
* authors or copyright holders be liable for any claim, damages or other
16+
* liability, whether in an action of contract, tort or otherwise, arising from,
17+
* out of or in connection with the Software or the use or other dealings in the
18+
* Software.
19+
*/
120
#pragma once
221

322
#include "py/objtype.h"

shared-module/aurora_epaper/aurora_framebuffer.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,4 @@ void common_hal_aurora_epaper_framebuffer_power_off(aurora_epaper_framebuffer_ob
7575
void common_hal_aurora_epaper_framebuffer_draw_frame(aurora_epaper_framebuffer_obj_t *self, uint8_t *buf, uint32_t whiteMap, uint32_t blackMap, uint8_t border, uint16_t iterations);
7676
void common_hal_aurora_epaper_framebuffer_draw_line(aurora_epaper_framebuffer_obj_t *self, uint8_t *buf, int row, uint32_t whiteMap, uint32_t blackMap, uint8_t border);
7777

78-
void common_hal_aurora_epaper_framebuffer_collect_ptrs(aurora_epaper_framebuffer_obj_t *);
79-
80-
/* Notes
81-
- https://learn.adafruit.com/extending-circuitpython?view=all
82-
- https://micropython-usermod.readthedocs.io/en/latest/usermods_05.html
83-
- https://docs.circuitpython.org/en/latest/shared-bindings/framebufferio/index.html
84-
*/
78+
void common_hal_aurora_epaper_framebuffer_collect_ptrs(aurora_epaper_framebuffer_obj_t *);

0 commit comments

Comments
 (0)