Split displayio hardware support from core
These are moved: * Display -> busdisplay.BusDisplay * FourWire -> fourwire.FourWire * EPaperDisplay -> epaperdisplay.EPaperDisplay * I2CDisplay -> i2cdisplaybus.I2CDisplayBus `paralleldisplay` is now `paralleldisplaybus` (and registered as `paralleldisplay` too). Bus related helpers are split out of display_core into bus_core. It is in still displayio since it is a dependency of both busdisplay and epaperdisplay. Fixes #7667
This commit is contained in:
parent
168c40e940
commit
e1df598199
10
main.c
10
main.c
@ -94,6 +94,10 @@
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_EPAPERDISPLAY
|
||||
#include "shared-bindings/epaperdisplay/EPaperDisplay.h"
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_KEYPAD
|
||||
#include "shared-module/keypad/__init__.h"
|
||||
#endif
|
||||
@ -534,7 +538,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {
|
||||
|
||||
// Program has finished running.
|
||||
bool printed_press_any_key = false;
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#if CIRCUITPY_EPAPERDISPLAY
|
||||
size_t time_to_epaper_refresh = 1;
|
||||
#endif
|
||||
|
||||
@ -682,7 +686,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {
|
||||
// Refresh the ePaper display if we have one. That way it'll show an error message.
|
||||
// Skip if we're about to autoreload. Otherwise we may delay when user code can update
|
||||
// the display.
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#if CIRCUITPY_EPAPERDISPLAY
|
||||
if (time_to_epaper_refresh > 0 && !autoreload_pending()) {
|
||||
time_to_epaper_refresh = maybe_refresh_epaperdisplay();
|
||||
}
|
||||
@ -724,7 +728,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) {
|
||||
}
|
||||
time_to_next_change = total_time - tick_diff;
|
||||
}
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#if CIRCUITPY_EPAPERDISPLAY
|
||||
if (time_to_epaper_refresh > 0 && time_to_next_change > 0) {
|
||||
time_to_next_change = MIN(time_to_next_change, time_to_epaper_refresh);
|
||||
}
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "supervisor/board.h"
|
||||
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -69,11 +69,11 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PA28, // Command or data
|
||||
&pin_PA01, // Chip select
|
||||
@ -82,9 +82,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
128, // Width
|
||||
128, // Height
|
||||
|
@ -28,11 +28,12 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/busdisplay/BusDisplay.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -47,13 +48,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PA01, &pin_PA00, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PB31, // TFT_DC Command or data
|
||||
&pin_PA27, // TFT_CS Chip select
|
||||
@ -62,9 +63,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -28,11 +28,11 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -48,13 +48,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA12, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PA07, // TFT_DC Command or data
|
||||
&pin_PA06, // TFT_CS Chip select
|
||||
@ -63,9 +63,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -28,12 +28,12 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/time/__init__.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
#define HEIGHT 400
|
||||
@ -57,13 +57,13 @@ uint8_t refresh_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PB05, // EPD_DC Command or data
|
||||
&pin_PB07, // EPD_CS Chip select
|
||||
@ -72,9 +72,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &displayio_epaperdisplay_type;
|
||||
common_hal_displayio_epaperdisplay_construct(display,
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &epaperdisplay_epaperdisplay_type;
|
||||
common_hal_epaperdisplay_epaperdisplay_construct(display,
|
||||
bus,
|
||||
start_sequence,
|
||||
sizeof(start_sequence),
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "supervisor/board.h"
|
||||
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -46,13 +46,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PA23, &pin_PA22, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
NULL, // Command or data
|
||||
&pin_PA19, // Chip select
|
||||
@ -61,9 +61,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
96, // Width
|
||||
68, // Height
|
||||
|
@ -29,11 +29,11 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
typedef struct {
|
||||
const uint32_t *config_data;
|
||||
@ -97,13 +97,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA15, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PA16, // TFT_DC Command or data
|
||||
&pin_PA11, // TFT_CS Chip select
|
||||
@ -115,9 +115,9 @@ void board_init(void) {
|
||||
uint32_t cfg0 = lookupCfg(CFG_DISPLAY_CFG0, 0x000000);
|
||||
uint32_t offX = (cfg0 >> 8) & 0xff;
|
||||
uint32_t offY = (cfg0 >> 16) & 0xff;
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
160, // Width (after rotation)
|
||||
128, // Height (after rotation)
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
@ -68,13 +68,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PB05, // TFT_DC Command or data
|
||||
&pin_PB07, // TFT_CS Chip select
|
||||
@ -83,9 +83,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
160, // Width (after rotation)
|
||||
128, // Height (after rotation)
|
||||
|
@ -28,12 +28,12 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -70,13 +70,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PB05, // TFT_DC Command or data
|
||||
&pin_PB12, // TFT_CS Chip select
|
||||
@ -85,9 +85,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
160, // Width
|
||||
128, // Height
|
||||
|
@ -61,9 +61,9 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
paralleldisplay_parallelbus_obj_t *bus = &allocate_display_bus()->parallel_bus;
|
||||
bus->base.type = ¶lleldisplay_parallelbus_type;
|
||||
common_hal_paralleldisplay_parallelbus_construct(bus,
|
||||
paralleldisplaybus_parallelbus_obj_t *bus = &allocate_display_bus()->parallel_bus;
|
||||
bus->base.type = ¶lleldisplaybus_parallelbus_type;
|
||||
common_hal_paralleldisplaybus_parallelbus_construct(bus,
|
||||
&pin_PA16, // Data0
|
||||
&pin_PB05, // Command or data
|
||||
&pin_PB06, // Chip select
|
||||
@ -72,9 +72,9 @@ void board_init(void) {
|
||||
&pin_PA00, // Reset
|
||||
0); // Frequency
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width
|
||||
240, // Height
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "hal/include/hal_gpio.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
@ -78,9 +78,9 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
paralleldisplay_parallelbus_obj_t *bus = &allocate_display_bus()->parallel_bus;
|
||||
bus->base.type = ¶lleldisplay_parallelbus_type;
|
||||
common_hal_paralleldisplay_parallelbus_construct(bus,
|
||||
paralleldisplaybus_parallelbus_obj_t *bus = &allocate_display_bus()->parallel_bus;
|
||||
bus->base.type = ¶lleldisplaybus_parallelbus_type;
|
||||
common_hal_paralleldisplaybus_parallelbus_construct(bus,
|
||||
&pin_PA16, // Data0
|
||||
&pin_PB05, // Command or data
|
||||
&pin_PB06, // Chip select
|
||||
@ -89,9 +89,9 @@ void board_init(void) {
|
||||
&pin_PA00, // Reset
|
||||
0); // Frequency
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
480, // Width
|
||||
320, // Height
|
||||
|
@ -28,12 +28,12 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
digitalio_digitalinout_obj_t CTR_5V;
|
||||
digitalio_digitalinout_obj_t CTR_3V3;
|
||||
digitalio_digitalinout_obj_t USB_HOST_ENABLE;
|
||||
@ -65,13 +65,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_PB20, &pin_PB19, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PC06, // TFT_DC Command or data
|
||||
&pin_PB21, // TFT_CS Chip select
|
||||
@ -80,9 +80,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width
|
||||
240, // Height
|
||||
|
@ -28,12 +28,12 @@
|
||||
#include "supervisor/board.h"
|
||||
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -70,10 +70,10 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_PA09, // Command or data
|
||||
&pin_PA08, // Chip select
|
||||
@ -82,9 +82,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
128, // Width
|
||||
128, // Height
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplaybus/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplaybus_parallelbus_construct(paralleldisplaybus_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
@ -87,7 +87,7 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu
|
||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||
never_reset_pin_number(reset->number);
|
||||
common_hal_paralleldisplay_parallelbus_reset(self);
|
||||
common_hal_paralleldisplaybus_parallelbus_reset(self);
|
||||
}
|
||||
|
||||
never_reset_pin_number(command->number);
|
||||
@ -98,7 +98,7 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplaybus_parallelbus_deinit(paralleldisplaybus_parallelbus_obj_t *self) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
reset_pin_number(self->data0_pin + i);
|
||||
}
|
||||
@ -110,8 +110,8 @@ void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_o
|
||||
reset_pin_number(self->reset.pin->number);
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset.base.type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
@ -122,19 +122,19 @@ bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplaybus_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplaybus_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
|
||||
uint32_t *clear_write = (uint32_t *)&self->write_group->OUTCLR.reg;
|
||||
uint32_t *set_write = (uint32_t *)&self->write_group->OUTSET.reg;
|
||||
@ -146,7 +146,7 @@ void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
void common_hal_paralleldisplaybus_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||
}
|
@ -24,8 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
|
||||
@ -40,6 +39,4 @@ typedef struct {
|
||||
uint8_t data0_pin;
|
||||
PortGroup *write_group;
|
||||
uint32_t write_mask;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
} paralleldisplaybus_parallelbus_obj_t;
|
@ -11,7 +11,7 @@ CIRCUITPY_COUNTIO = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CTARGET = 0
|
||||
CIRCUITPY_NVM = 0
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
CIRCUITPY_PARALLELDISPLAYBUS = 0
|
||||
CIRCUITPY_PULSEIO = 0
|
||||
CIRCUITPY_PWMIO = 0
|
||||
CIRCUITPY_ROTARYIO = 0
|
||||
|
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/busio/I2C.h"
|
||||
@ -59,17 +59,17 @@ void board_init(void) {
|
||||
// common_hal_busio_i2c_construct(i2c, &pin_GPIO23, &pin_GPIO22, 100000, 0);
|
||||
// common_hal_busio_i2c_never_reset(i2c);
|
||||
|
||||
displayio_i2cdisplay_obj_t *bus = &allocate_display_bus()->i2cdisplay_bus;
|
||||
bus->base.type = &displayio_i2cdisplay_type;
|
||||
common_hal_displayio_i2cdisplay_construct(bus,
|
||||
i2cdisplaybus_i2cdisplaybus_obj_t *bus = &allocate_display_bus()->i2cdisplay_bus;
|
||||
bus->base.type = &i2cdisplaybus_i2cdisplaybus_type;
|
||||
common_hal_i2cdisplaybus_i2cdisplaybus_construct(bus,
|
||||
i2c,
|
||||
0x3c,
|
||||
NULL
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
72, // Width
|
||||
40, // Height
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
@ -38,7 +38,7 @@
|
||||
#include "esp_err.h"
|
||||
#include "driver/i2c.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -116,9 +116,9 @@ static void io_expander_backlight_init(void) {
|
||||
void board_init(void) {
|
||||
io_expander_backlight_init();
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO40, // TFT_DC Command or data
|
||||
&pin_GPIO39, // TFT_CS Chip select
|
||||
@ -127,9 +127,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -72,10 +72,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO40, // DC
|
||||
@ -85,10 +85,10 @@ void board_init(void) {
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -72,10 +72,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO39, // DC
|
||||
@ -85,10 +85,10 @@ void board_init(void) {
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -72,10 +72,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO40, // DC
|
||||
@ -85,10 +85,10 @@ void board_init(void) {
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -72,10 +72,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO39, // DC
|
||||
@ -85,10 +85,10 @@ void board_init(void) {
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE = dio
|
||||
CIRCUITPY_ESP_FLASH_MODE = qio
|
||||
CIRCUITPY_ESP_FLASH_FREQ = 80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE = 4MB
|
||||
|
||||
|
@ -28,14 +28,14 @@
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -50,13 +50,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO39, // TFT_DC Command or data
|
||||
&pin_GPIO40, // TFT_CS Chip select
|
||||
@ -65,9 +65,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
@ -114,13 +114,13 @@ const uint8_t refresh_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO7, // EPD_DC Command or data
|
||||
&pin_GPIO8, // EPD_CS Chip select
|
||||
@ -129,9 +129,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &displayio_epaperdisplay_type;
|
||||
common_hal_displayio_epaperdisplay_construct(
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &epaperdisplay_epaperdisplay_type;
|
||||
common_hal_epaperdisplay_epaperdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
display_start_sequence, sizeof(display_start_sequence),
|
||||
@ -189,10 +189,10 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display;
|
||||
if (display->base.type == &displayio_epaperdisplay_type) {
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &displays[0].epaper_display;
|
||||
if (display->base.type == &epaperdisplay_epaperdisplay_type) {
|
||||
size_t i = 0;
|
||||
while (common_hal_displayio_epaperdisplay_get_busy(display)) {
|
||||
while (common_hal_epaperdisplay_epaperdisplay_get_busy(display)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
i++;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
@ -43,13 +43,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO7, &pin_GPIO6, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO4, // TFT_DC Command or data
|
||||
&pin_GPIO5, // TFT_CS Chip select
|
||||
@ -58,9 +58,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width
|
||||
240, // Height
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
@ -44,13 +44,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO7, &pin_GPIO6, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO4, // TFT_DC Command or data
|
||||
&pin_GPIO5, // TFT_CS Chip select
|
||||
@ -59,9 +59,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width
|
||||
240, // Height
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -71,10 +71,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO43, // DC
|
||||
@ -84,10 +84,10 @@ void board_init(void) {
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
@ -71,13 +71,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO6, &pin_GPIO7, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO4, // TFT_DC Command or data
|
||||
&pin_GPIO5, // TFT_CS Chip select
|
||||
@ -86,9 +86,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width
|
||||
240, // Height
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
@ -63,13 +63,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO23, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO21, // TFT_DC Command or data
|
||||
&pin_GPIO5, // TFT_CS Chip select
|
||||
@ -78,9 +78,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -72,10 +72,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO34, // DC
|
||||
@ -85,10 +85,10 @@ void board_init(void) {
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -65,7 +65,7 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
static void display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
@ -77,9 +77,9 @@ static void display_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO35, // DC
|
||||
@ -90,10 +90,10 @@ static void display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
@ -43,13 +43,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO12, &pin_GPIO11, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO13, // TFT_DC Command or data
|
||||
&pin_GPIO10, // TFT_CS Chip select
|
||||
@ -58,9 +58,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width
|
||||
170, // Height
|
||||
|
@ -65,7 +65,7 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
static void display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
@ -77,9 +77,9 @@ static void display_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO37, // DC
|
||||
@ -90,10 +90,10 @@ static void display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -45,7 +45,7 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
static void display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
@ -57,9 +57,9 @@ static void display_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO16, // DC
|
||||
@ -71,10 +71,10 @@ static void display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -48,7 +48,7 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
static void display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
@ -61,9 +61,9 @@ static void display_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO27, // DC
|
||||
@ -74,10 +74,10 @@ static void display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/busio/I2C.h"
|
||||
@ -54,17 +54,17 @@ uint8_t display_init_sequence[] = { // SSD1306
|
||||
static void display_init(void) {
|
||||
busio_i2c_obj_t *i2c = common_hal_board_create_i2c(0);
|
||||
|
||||
displayio_i2cdisplay_obj_t *bus = &allocate_display_bus()->i2cdisplay_bus;
|
||||
bus->base.type = &displayio_i2cdisplay_type;
|
||||
common_hal_displayio_i2cdisplay_construct(bus,
|
||||
i2cdisplaybus_i2cdisplaybus_obj_t *bus = &allocate_display_bus()->i2cdisplay_bus;
|
||||
bus->base.type = &i2cdisplaybus_i2cdisplaybus_type;
|
||||
common_hal_i2cdisplaybus_i2cdisplaybus_construct(bus,
|
||||
i2c,
|
||||
0x3c,
|
||||
&pin_GPIO18 // reset
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
128, // Width
|
||||
32, // Height
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -51,14 +51,14 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
// busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO17, &pin_GPIO21, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO33, // DC
|
||||
@ -68,10 +68,10 @@ void board_init(void) {
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
128, // width (after rotation)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/busio/I2C.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
#include "../../pmic/axp192/axp192.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
#define PMIC_POWER_SOURCE_USB 0
|
||||
@ -333,10 +333,10 @@ static bool pmic_init(busio_i2c_obj_t *i2c) {
|
||||
|
||||
static bool display_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO15, // DC
|
||||
@ -347,10 +347,10 @@ static bool display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
320, // width (after rotation)
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
|
||||
// display init sequence according to M5Gfx
|
||||
@ -57,10 +57,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO27, // DC
|
||||
@ -71,10 +71,10 @@ void board_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
320, // width (after rotation)
|
||||
|
@ -27,13 +27,13 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
|
||||
// display init sequence according to M5Gfx
|
||||
@ -57,10 +57,10 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
void board_init(void) {
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO27, // DC
|
||||
@ -71,10 +71,10 @@ void board_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
320, // width (after rotation)
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
@ -50,9 +50,9 @@ void board_init(void) {
|
||||
// common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
// // Set up the DisplayIO pin object
|
||||
// displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
// bus->base.type = &displayio_fourwire_type;
|
||||
// common_hal_displayio_fourwire_construct(bus,
|
||||
// fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
// bus->base.type = &fourwire_fourwire_type;
|
||||
// common_hal_fourwire_fourwire_construct(bus,
|
||||
// spi,
|
||||
// &pin_GPIO20, // EPD_DC Command or data
|
||||
// &pin_GPIO15, // EPD_CS Chip select
|
||||
@ -61,10 +61,10 @@ void board_init(void) {
|
||||
// 0, // Polarity
|
||||
// 0); // Phase
|
||||
|
||||
// displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
// display->base.type = &displayio_epaperdisplay_type;
|
||||
// epaperdisplay_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
// display->base.type = &epaperdisplay_epaperdisplay_type;
|
||||
|
||||
// common_hal_displayio_epaperdisplay_construct(
|
||||
// common_hal_epaperdisplay_epaperdisplay_construct(
|
||||
// display,
|
||||
// bus,
|
||||
// display_start_sequence, sizeof(display_start_sequence),
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/busio/I2C.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
@ -165,14 +165,14 @@ static bool pmic_init(busio_i2c_obj_t *i2c) {
|
||||
}
|
||||
|
||||
static bool display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO13, &pin_GPIO15, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO23, // DC
|
||||
@ -183,10 +183,10 @@ static bool display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
80, // width (after rotation)
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/busio/I2C.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
@ -165,14 +165,14 @@ static bool pmic_init(busio_i2c_obj_t *i2c) {
|
||||
}
|
||||
|
||||
static bool display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO13, &pin_GPIO15, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO23, // DC
|
||||
@ -183,10 +183,10 @@ static bool display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
135, // width (after rotation)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
|
@ -141,7 +141,7 @@ uint8_t display_init_sequence[] = {
|
||||
void board_init(void) {
|
||||
// Display
|
||||
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
@ -153,9 +153,9 @@ void board_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO14, // DC
|
||||
@ -166,9 +166,9 @@ void board_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -64,7 +64,7 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
static void display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
@ -76,9 +76,9 @@ static void display_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO18, // DC
|
||||
@ -89,10 +89,10 @@ static void display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
160, // width (after rotation)
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplaybus/ParallelBus.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
@ -43,7 +43,7 @@
|
||||
* - data0 pin must be byte aligned
|
||||
*/
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_construct_nonsequential(paralleldisplay_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplaybus_parallelbus_construct_nonsequential(paralleldisplaybus_parallelbus_obj_t *self,
|
||||
uint8_t n_pins, const mcu_pin_obj_t **data_pins,
|
||||
const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
@ -111,7 +111,7 @@ void common_hal_paralleldisplay_parallelbus_construct_nonsequential(paralleldisp
|
||||
}
|
||||
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplaybus_parallelbus_construct(paralleldisplaybus_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
char buf[7];
|
||||
@ -121,11 +121,11 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu
|
||||
data_pins[i] = validate_obj_is_free_pin(
|
||||
mp_obj_dict_get(MP_OBJ_FROM_PTR(&mcu_pin_globals), mp_obj_new_str(buf, strlen(buf))), MP_QSTR_pin);
|
||||
}
|
||||
common_hal_paralleldisplay_parallelbus_construct_nonsequential(self, 8, data_pins, command, chip_select, write, read, reset, frequency);
|
||||
common_hal_paralleldisplaybus_parallelbus_construct_nonsequential(self, 8, data_pins, command, chip_select, write, read, reset, frequency);
|
||||
}
|
||||
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplaybus_parallelbus_deinit(paralleldisplaybus_parallelbus_obj_t *self) {
|
||||
if (!self->handle) {
|
||||
return;
|
||||
}
|
||||
@ -145,9 +145,9 @@ void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_o
|
||||
port_i2s_reset_instance(0);
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplaybus_parallelbus_reset(mp_obj_t obj) {
|
||||
/* SNIP - same as from SAMD and NRF ports */
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset_pin_number == NO_PIN) {
|
||||
return false;
|
||||
}
|
||||
@ -159,13 +159,13 @@ bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplaybus_parallelbus_bus_free(mp_obj_t obj) {
|
||||
/* SNIP - same as from SAMD and NRF ports */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool lock_acquired = false;
|
||||
i2s_lcd_acquire_nonblocking(self->handle, 1, &lock_acquired);
|
||||
if (lock_acquired) {
|
||||
@ -174,17 +174,17 @@ bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
return lock_acquired;
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplaybus_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (data_length) {
|
||||
gpio_set_level(self->config.pin_num_rs, byte_type == DISPLAY_DATA);
|
||||
i2s_lcd_write(self->handle, data, data_length);
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
void common_hal_paralleldisplaybus_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
i2s_lcd_release(self->handle);
|
||||
gpio_set_level(self->config.pin_num_cs, true);
|
||||
}
|
@ -24,8 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
#include "i2s_lcd_driver.h"
|
||||
@ -36,6 +35,4 @@ typedef struct {
|
||||
gpio_num_t reset_pin_number;
|
||||
i2s_lcd_config_t config;
|
||||
i2s_lcd_handle_t handle;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
} paralleldisplaybus_parallelbus_obj_t;
|
@ -37,7 +37,7 @@ CIRCUITPY_IMAGECAPTURE = 0
|
||||
CIRCUITPY_MEMORYMAP ?= 1
|
||||
CIRCUITPY_NVM ?= 1
|
||||
# Turn off because it uses the old I2S driver which conflicts with the new ADC driver.
|
||||
CIRCUITPY_PARALLELDISPLAY ?= 0
|
||||
CIRCUITPY_PARALLELDISPLAYBUS ?= 0
|
||||
CIRCUITPY_PS2IO ?= 1
|
||||
CIRCUITPY_RGBMATRIX ?= 1
|
||||
CIRCUITPY_ROTARYIO ?= 1
|
||||
|
@ -24,7 +24,7 @@ CIRCUITPY_COUNTIO = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CTARGET = 0
|
||||
CIRCUITPY_NVM = 0
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
CIRCUITPY_PARALLELDISPLAYBUS = 0
|
||||
CIRCUITPY_PULSEIO = 0
|
||||
CIRCUITPY_ROTARYIO = 1
|
||||
CIRCUITPY_ROTARYIO_SOFTENCODER = 1
|
||||
|
@ -28,11 +28,11 @@
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -47,13 +47,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_P0_14, &pin_P0_15, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_P0_13, // TFT_DC Command or data
|
||||
&pin_P0_12, // TFT_CS Chip select
|
||||
@ -62,9 +62,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/framebufferio/FramebufferDisplay.h"
|
||||
#include "shared-bindings/sharpdisplay/SharpMemoryFramebuffer.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
@ -28,11 +28,11 @@
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -47,13 +47,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_P0_07, &pin_P1_08, NULL, false); // SCK, MOSI, MISO, not half-duplex
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_P0_27, // TFT_DC Command or data
|
||||
&pin_P0_05, // TFT_CS Chip select
|
||||
@ -63,9 +63,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -29,11 +29,11 @@
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -48,13 +48,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_P0_08, // TFT_DC Command or data
|
||||
&pin_P0_06, // TFT_CS Chip select
|
||||
@ -63,9 +63,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -28,11 +28,11 @@
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -47,13 +47,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_P0_08, // TFT_DC Command or data
|
||||
&pin_P0_14, // TFT_CS Chip select
|
||||
@ -62,9 +62,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplaybus/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/microcontroller/__init__.h"
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplaybus_parallelbus_construct(paralleldisplaybus_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
@ -94,7 +94,7 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu
|
||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||
never_reset_pin_number(reset->number);
|
||||
common_hal_paralleldisplay_parallelbus_reset(self);
|
||||
common_hal_paralleldisplaybus_parallelbus_reset(self);
|
||||
}
|
||||
|
||||
never_reset_pin_number(command->number);
|
||||
@ -106,7 +106,7 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplaybus_parallelbus_deinit(paralleldisplaybus_parallelbus_obj_t *self) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
reset_pin_number(self->data0_pin + i);
|
||||
}
|
||||
@ -118,8 +118,8 @@ void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_o
|
||||
reset_pin_number(self->reset.pin->number);
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset.base.type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
@ -130,20 +130,20 @@ bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplaybus_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
// This ignores chip_select behaviour because data is clocked in by the write line toggling.
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplaybus_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
|
||||
uint32_t *clear_write = (uint32_t *)&self->write_group->OUTCLR;
|
||||
uint32_t *set_write = (uint32_t *)&self->write_group->OUTSET;
|
||||
@ -155,7 +155,7 @@ void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
void common_hal_paralleldisplaybus_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||
}
|
@ -24,8 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
|
||||
@ -40,6 +39,4 @@ typedef struct {
|
||||
uint8_t data0_pin;
|
||||
NRF_GPIO_Type *write_group;
|
||||
uint32_t write_mask;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
} paralleldisplaybus_parallelbus_obj_t;
|
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
@ -34,7 +34,7 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -59,13 +59,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO26, &pin_GPIO27, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO24, // Command or data
|
||||
&pin_GPIO22, // Chip select
|
||||
@ -74,9 +74,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
128, // Width
|
||||
64, // Height
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
// display init sequence from CircuitPython library https://github.com/adafruit/Adafruit_CircuitPython_ST7735R/blob/dfae353330cf051d1f31db9e4b681c8d70900cc5/adafruit_st7735r.py
|
||||
uint8_t display_init_sequence[] = {
|
||||
@ -78,13 +78,13 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO22, // DC
|
||||
&pin_GPIO20, // CS
|
||||
@ -93,9 +93,9 @@ void board_init(void) {
|
||||
0,
|
||||
0);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
160, // Width
|
||||
128, // Height
|
||||
|
@ -66,7 +66,7 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
static void display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
@ -78,9 +78,9 @@ static void display_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO1, // DC
|
||||
@ -91,10 +91,10 @@ static void display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -64,13 +64,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO17, // TFT_DC Command or data
|
||||
&pin_GPIO21, // TFT_CS Chip select
|
||||
@ -79,9 +79,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width
|
||||
240, // Height
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
@ -274,14 +274,14 @@ void board_init(void) {
|
||||
common_hal_digitalio_digitalinout_never_reset(&enable_pin_obj);
|
||||
|
||||
// Set up the SPI object used to control the display
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
// Set up the DisplayIO pin object
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO20, // EPD_DC Command or data
|
||||
&pin_GPIO17, // EPD_CS Chip select
|
||||
@ -291,9 +291,9 @@ void board_init(void) {
|
||||
0); // Phase
|
||||
|
||||
// Set up the DisplayIO epaper object
|
||||
displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &displayio_epaperdisplay_type;
|
||||
common_hal_displayio_epaperdisplay_construct(
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &epaperdisplay_epaperdisplay_type;
|
||||
common_hal_epaperdisplay_epaperdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
display_start_sequence, sizeof(display_start_sequence),
|
||||
@ -328,9 +328,9 @@ void board_init(void) {
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display;
|
||||
if (display->base.type == &displayio_epaperdisplay_type) {
|
||||
while (common_hal_displayio_epaperdisplay_get_busy(display)) {
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &displays[0].epaper_display;
|
||||
if (display->base.type == &epaperdisplay_epaperdisplay_type) {
|
||||
while (common_hal_epaperdisplay_epaperdisplay_get_busy(display)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
@ -279,9 +279,9 @@ void board_init(void) {
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
// Set up the DisplayIO pin object
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO20, // EPD_DC Command or data
|
||||
&pin_GPIO17, // EPD_CS Chip select
|
||||
@ -291,9 +291,9 @@ void board_init(void) {
|
||||
0); // Phase
|
||||
|
||||
// Set up the DisplayIO epaper object
|
||||
displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &displayio_epaperdisplay_type;
|
||||
common_hal_displayio_epaperdisplay_construct(
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &epaperdisplay_epaperdisplay_type;
|
||||
common_hal_epaperdisplay_epaperdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
display_start_sequence, sizeof(display_start_sequence),
|
||||
@ -328,9 +328,9 @@ void board_init(void) {
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display;
|
||||
if (display->base.type == &displayio_epaperdisplay_type) {
|
||||
while (common_hal_displayio_epaperdisplay_get_busy(display)) {
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &displays[0].epaper_display;
|
||||
if (display->base.type == &epaperdisplay_epaperdisplay_type) {
|
||||
while (common_hal_epaperdisplay_epaperdisplay_get_busy(display)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
@ -62,11 +62,11 @@ const uint8_t refresh_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO28, // EPD_DC Command or data
|
||||
&pin_GPIO17, // EPD_CS Chip select
|
||||
@ -75,9 +75,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &displayio_epaperdisplay_type;
|
||||
common_hal_displayio_epaperdisplay_construct(
|
||||
epaperdisplay_epaperdisplay_obj_t *display = &allocate_display()->epaper_display;
|
||||
display->base.type = &epaperdisplay_epaperdisplay_type;
|
||||
common_hal_epaperdisplay_epaperdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
display_start_sequence, sizeof(display_start_sequence),
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "supervisor/shared/board.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
fourwire_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
@ -64,13 +64,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO6, &pin_GPIO7, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO9, // TFT_DC Command or data
|
||||
&pin_GPIO5, // TFT_CS Chip select
|
||||
@ -79,9 +79,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
240, // Width
|
||||
240, // Height
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
|
||||
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
@ -64,13 +64,13 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(spi, &pin_GPIO2, &pin_GPIO3, NULL, false);
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
spi,
|
||||
&pin_GPIO4, // TFT_DC Command or data
|
||||
&pin_GPIO5, // TFT_CS Chip select
|
||||
@ -79,9 +79,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
320, // Width (after rotation)
|
||||
240, // Height (after rotation)
|
||||
|
@ -63,7 +63,7 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
static void display_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
busio_spi_obj_t *spi = &bus->inline_bus;
|
||||
common_hal_busio_spi_construct(
|
||||
spi,
|
||||
@ -75,9 +75,9 @@ static void display_init(void) {
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
common_hal_fourwire_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO8, // DC
|
||||
@ -88,9 +88,9 @@ static void display_init(void) {
|
||||
0 // phase
|
||||
);
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
display,
|
||||
bus,
|
||||
160, // width (after rotation)
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplaybus/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -43,7 +43,7 @@ static const uint16_t parallel_program[] = {
|
||||
// .wrap
|
||||
};
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplaybus_parallelbus_construct(paralleldisplaybus_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {
|
||||
|
||||
@ -84,7 +84,7 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu
|
||||
common_hal_digitalio_digitalinout_construct(&self->reset, reset);
|
||||
common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL);
|
||||
never_reset_pin_number(reset->number);
|
||||
common_hal_paralleldisplay_parallelbus_reset(self);
|
||||
common_hal_paralleldisplaybus_parallelbus_reset(self);
|
||||
}
|
||||
|
||||
never_reset_pin_number(command->number);
|
||||
@ -117,7 +117,7 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu
|
||||
common_hal_rp2pio_statemachine_never_reset(&self->state_machine);
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
|
||||
void common_hal_paralleldisplaybus_parallelbus_deinit(paralleldisplaybus_parallelbus_obj_t *self) {
|
||||
common_hal_rp2pio_statemachine_deinit(&self->state_machine);
|
||||
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
@ -135,8 +135,8 @@ void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_o
|
||||
}
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_reset(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
if (self->reset.base.type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
@ -147,26 +147,26 @@ bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
|
||||
bool common_hal_paralleldisplaybus_parallelbus_bus_free(mp_obj_t obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplaybus_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length) {
|
||||
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
|
||||
common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA);
|
||||
common_hal_rp2pio_statemachine_write(&self->state_machine, data, data_length, 1, false);
|
||||
}
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
void common_hal_paralleldisplaybus_parallelbus_end_transaction(mp_obj_t obj) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
|
||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
|
||||
}
|
@ -24,8 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/digitalio/DigitalInOut.h"
|
||||
#include "bindings/rp2pio/StateMachine.h"
|
||||
@ -40,6 +39,4 @@ typedef struct {
|
||||
uint8_t write;
|
||||
uint8_t data0_pin;
|
||||
rp2pio_statemachine_obj_t state_machine;
|
||||
} paralleldisplay_parallelbus_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
|
||||
} paralleldisplaybus_parallelbus_obj_t;
|
@ -1,6 +1,6 @@
|
||||
LONGINT_IMPL ?= MPZ
|
||||
INTERNAL_LIBM ?= 1
|
||||
USB_NUM_ENDPOINT_PAIRS ?= 0
|
||||
USB_NUM_ENDPOINT_PAIRS = 0
|
||||
|
||||
CIRCUITPY_ANALOGIO ?= 1
|
||||
CIRCUITPY_BLEIO ?= 1
|
||||
@ -27,11 +27,11 @@ ifeq ($(MCU_SERIES),MG24)
|
||||
CIRCUITPY_I2CTARGET ?= 0
|
||||
CIRCUITPY_KEYPAD ?= 0
|
||||
CIRCUITPY_NEOPIXEL_WRITE ?= 0
|
||||
CIRCUITPY_PARALLELDISPLAY ?= 0
|
||||
CIRCUITPY_PARALLELDISPLAYBUS ?= 0
|
||||
CIRCUITPY_PULSEIO ?= 0
|
||||
CIRCUITPY_ROTARYIO ?= 0
|
||||
CIRCUITPY_TOUCHIO ?= 0
|
||||
CIRCUITPY_USB ?= 0
|
||||
CIRCUITPY_USB = 0
|
||||
endif
|
||||
|
||||
CIRCUITPY_BUILD_EXTENSIONS ?= bin
|
||||
|
@ -70,10 +70,10 @@ uint8_t display_init_sequence[] = {
|
||||
};
|
||||
|
||||
void board_init(void) {
|
||||
displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus;
|
||||
bus->base.type = &fourwire_fourwire_type;
|
||||
busio_spi_obj_t *internal_spi = &supervisor_flash_spi_bus;
|
||||
common_hal_displayio_fourwire_construct(bus,
|
||||
common_hal_fourwire_fourwire_construct(bus,
|
||||
internal_spi,
|
||||
&pin_PA08, // Command or data
|
||||
&pin_PB12, // Chip select
|
||||
@ -82,9 +82,9 @@ void board_init(void) {
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(display,
|
||||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
|
||||
display->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(display,
|
||||
bus,
|
||||
160, // Width
|
||||
128, // Height
|
||||
|
@ -87,5 +87,5 @@ ifeq ($(MCU_SERIES),L4)
|
||||
UF2_FAMILY_ID ?= 0x00ff6919
|
||||
endif
|
||||
|
||||
CIRCUITPY_PARALLELDISPLAY := 0
|
||||
CIRCUITPY_PARALLELDISPLAYBUS := 0
|
||||
CIRCUITPY_BUILD_EXTENSIONS ?= bin
|
||||
|
@ -152,6 +152,9 @@ endif
|
||||
ifeq ($(CIRCUITPY_BUSDEVICE),1)
|
||||
SRC_PATTERNS += adafruit_bus_device/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_BUSDISPLAY),1)
|
||||
SRC_PATTERNS += busdisplay/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_BUSIO),1)
|
||||
SRC_PATTERNS += busio/%
|
||||
endif
|
||||
@ -176,6 +179,9 @@ endif
|
||||
ifeq ($(CIRCUITPY__EVE),1)
|
||||
SRC_PATTERNS += _eve/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_EPAPERDISPLAY),1)
|
||||
SRC_PATTERNS += epaperdisplay/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_ESPCAMERA),1)
|
||||
SRC_PATTERNS += espcamera/%
|
||||
endif
|
||||
@ -191,6 +197,9 @@ endif
|
||||
ifeq ($(CIRCUITPY_FLOPPYIO),1)
|
||||
SRC_PATTERNS += floppyio/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_FOURWIRE),1)
|
||||
SRC_PATTERNS += fourwire/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_FRAMEBUFFERIO),1)
|
||||
SRC_PATTERNS += framebufferio/%
|
||||
endif
|
||||
@ -212,6 +221,9 @@ endif
|
||||
ifeq ($(CIRCUITPY_HASHLIB),1)
|
||||
SRC_PATTERNS += hashlib/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_I2CDISPLAYBUS),1)
|
||||
SRC_PATTERNS += i2cdisplaybus/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_I2CTARGET),1)
|
||||
SRC_PATTERNS += i2ctarget/%
|
||||
endif
|
||||
@ -260,8 +272,8 @@ endif
|
||||
ifeq ($(CIRCUITPY_DUALBANK),1)
|
||||
SRC_PATTERNS += dualbank/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_PARALLELDISPLAY),1)
|
||||
SRC_PATTERNS += paralleldisplay/%
|
||||
ifeq ($(CIRCUITPY_PARALLELDISPLAYBUS),1)
|
||||
SRC_PATTERNS += paralleldisplaybus/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_PEW),1)
|
||||
SRC_PATTERNS += _pew/%
|
||||
@ -465,7 +477,7 @@ SRC_COMMON_HAL_ALL = \
|
||||
nvm/ByteArray.c \
|
||||
nvm/__init__.c \
|
||||
os/__init__.c \
|
||||
paralleldisplay/ParallelBus.c \
|
||||
paralleldisplaybus/ParallelBus.c \
|
||||
ps2io/Ps2.c \
|
||||
ps2io/__init__.c \
|
||||
pulseio/PulseIn.c \
|
||||
@ -534,8 +546,7 @@ $(filter $(SRC_PATTERNS), \
|
||||
microcontroller/RunMode.c \
|
||||
msgpack/__init__.c \
|
||||
msgpack/ExtType.c \
|
||||
paralleldisplay/__init__.c \
|
||||
paralleldisplay/ParallelBus.c \
|
||||
paralleldisplaybus/__init__.c \
|
||||
qrio/PixelPolicy.c \
|
||||
qrio/QRInfo.c \
|
||||
supervisor/RunReason.c \
|
||||
@ -587,32 +598,35 @@ SRC_SHARED_MODULE_ALL = \
|
||||
adafruit_bus_device/__init__.c \
|
||||
adafruit_bus_device/i2c_device/I2CDevice.c \
|
||||
adafruit_bus_device/spi_device/SPIDevice.c \
|
||||
busdisplay/__init__.c \
|
||||
busdisplay/BusDisplay.c \
|
||||
canio/Match.c \
|
||||
canio/Message.c \
|
||||
canio/RemoteTransmissionRequest.c \
|
||||
displayio/Bitmap.c \
|
||||
displayio/ColorConverter.c \
|
||||
displayio/Display.c \
|
||||
displayio/EPaperDisplay.c \
|
||||
displayio/FourWire.c \
|
||||
displayio/Group.c \
|
||||
displayio/I2CDisplay.c \
|
||||
displayio/OnDiskBitmap.c \
|
||||
displayio/Palette.c \
|
||||
displayio/Shape.c \
|
||||
displayio/TileGrid.c \
|
||||
displayio/area.c \
|
||||
displayio/__init__.c \
|
||||
dotclockframebuffer/__init__.c \
|
||||
epaperdisplay/__init__.c \
|
||||
epaperdisplay/EPaperDisplay.c \
|
||||
floppyio/__init__.c \
|
||||
fontio/BuiltinFont.c \
|
||||
fontio/__init__.c \
|
||||
fourwire/__init__.c \
|
||||
fourwire/FourWire.c \
|
||||
framebufferio/FramebufferDisplay.c \
|
||||
framebufferio/__init__.c \
|
||||
getpass/__init__.c \
|
||||
gifio/__init__.c \
|
||||
gifio/GifWriter.c \
|
||||
gifio/OnDiskGif.c \
|
||||
i2cdisplaybus/__init__.c \
|
||||
i2cdisplaybus/I2CDisplayBus.c \
|
||||
imagecapture/ParallelImageCapture.c \
|
||||
ipaddress/IPv4Address.c \
|
||||
ipaddress/__init__.c \
|
||||
@ -633,7 +647,7 @@ SRC_SHARED_MODULE_ALL = \
|
||||
onewireio/__init__.c \
|
||||
onewireio/OneWire.c \
|
||||
os/__init__.c \
|
||||
paralleldisplay/ParallelBus.c \
|
||||
paralleldisplaybus/ParallelBus.c \
|
||||
qrio/__init__.c \
|
||||
qrio/QRDecoder.c \
|
||||
rainbowio/__init__.c \
|
||||
@ -745,6 +759,7 @@ endif
|
||||
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
|
||||
SRC_SHARED_MODULE_INTERNAL = \
|
||||
$(filter $(SRC_PATTERNS), \
|
||||
displayio/bus_core.c \
|
||||
displayio/display_core.c \
|
||||
os/getenv.c \
|
||||
usb/utf16le.c \
|
||||
|
@ -203,12 +203,24 @@ CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
|
||||
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
|
||||
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
|
||||
|
||||
CIRCUITPY_BUSDISPLAY ?= $(CIRCUITPY_DISPLAYIO)
|
||||
CFLAGS += -DCIRCUITPY_BUSDISPLAY=$(CIRCUITPY_BUSDISPLAY)
|
||||
|
||||
CIRCUITPY_FOURWIRE ?= $(CIRCUITPY_DISPLAYIO)
|
||||
CFLAGS += -DCIRCUITPY_FOURWIRE=$(CIRCUITPY_FOURWIRE)
|
||||
|
||||
CIRCUITPY_EPAPERDISPLAY ?= $(CIRCUITPY_DISPLAYIO)
|
||||
CFLAGS += -DCIRCUITPY_EPAPERDISPLAY=$(CIRCUITPY_EPAPERDISPLAY)
|
||||
|
||||
CIRCUITPY_I2CDISPLAYBUS ?= $(CIRCUITPY_DISPLAYIO)
|
||||
CFLAGS += -DCIRCUITPY_I2CDISPLAYBUS=$(CIRCUITPY_I2CDISPLAYBUS)
|
||||
|
||||
ifeq ($(CIRCUITPY_DISPLAYIO),1)
|
||||
CIRCUITPY_PARALLELDISPLAY ?= $(CIRCUITPY_FULL_BUILD)
|
||||
CIRCUITPY_PARALLELDISPLAYBUS ?= $(CIRCUITPY_FULL_BUILD)
|
||||
else
|
||||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
CIRCUITPY_PARALLELDISPLAYBUS = 0
|
||||
endif
|
||||
CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY)
|
||||
CFLAGS += -DCIRCUITPY_PARALLELDISPLAYBUS=$(CIRCUITPY_PARALLELDISPLAYBUS)
|
||||
|
||||
CIRCUITPY_DOTCLOCKFRAMEBUFFER ?= 0
|
||||
CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER)
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "py/mperrno.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/Display.h"
|
||||
#include "shared-bindings/busdisplay/BusDisplay.h"
|
||||
#include "shared-module/_stage/__init__.h"
|
||||
#include "shared-module/displayio/display_core.h"
|
||||
#include "Layer.h"
|
||||
@ -46,7 +46,7 @@
|
||||
//| y1: int,
|
||||
//| layers: List[Layer],
|
||||
//| buffer: WriteableBuffer,
|
||||
//| display: displayio.Display,
|
||||
//| display: busdisplay.BusDisplay,
|
||||
//| scale: int,
|
||||
//| background: int,
|
||||
//| ) -> None:
|
||||
@ -59,7 +59,7 @@
|
||||
//| :param layers: A list of the :py:class:`~_stage.Layer` objects.
|
||||
//| :type layers: list[Layer]
|
||||
//| :param ~circuitpython_typing.WriteableBuffer buffer: A buffer to use for rendering.
|
||||
//| :param ~displayio.Display display: The display to use.
|
||||
//| :param ~busdisplay.BusDisplay display: The display to use.
|
||||
//| :param int scale: How many times should the image be scaled up.
|
||||
//| :param int background: What color to display when nothing is there.
|
||||
//|
|
||||
@ -86,11 +86,11 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
|
||||
size_t buffer_size = bufinfo.len / 2; // 16-bit indexing
|
||||
|
||||
mp_obj_t native_display = mp_obj_cast_to_native_base(args[6],
|
||||
&displayio_display_type);
|
||||
if (!mp_obj_is_type(native_display, &displayio_display_type)) {
|
||||
&busdisplay_busdisplay_type);
|
||||
if (!mp_obj_is_type(native_display, &busdisplay_busdisplay_type)) {
|
||||
mp_raise_TypeError(translate("argument num/types mismatch"));
|
||||
}
|
||||
displayio_display_obj_t *display = MP_OBJ_TO_PTR(native_display);
|
||||
busdisplay_busdisplay_obj_t *display = MP_OBJ_TO_PTR(native_display);
|
||||
uint8_t scale = mp_obj_get_int(args[7]);
|
||||
int16_t vx = mp_obj_get_int(args[8]);
|
||||
int16_t vy = mp_obj_get_int(args[9]);
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/Display.h"
|
||||
#include "shared-bindings/busdisplay/BusDisplay.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -38,15 +38,22 @@
|
||||
#include "shared-bindings/util.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
//| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"]
|
||||
//| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`"""
|
||||
//| import displayio
|
||||
//| import fourwire
|
||||
//| import i2cdisplaybus
|
||||
//| import paralleldisplaybus
|
||||
//|
|
||||
//| _DisplayBus = Union[
|
||||
//| "fourwire.FourWire", "paralleldisplaybus.ParallelBus", "i2cdisplaybus.I2CDisplayBus"
|
||||
//| ]
|
||||
//| """:py:class:`fourwire.FourWire`, :py:class:`paralleldisplaybus.ParallelBus` or :py:class:`i2cdisplaybus.I2CDisplayBus`"""
|
||||
//|
|
||||
|
||||
//| class Display:
|
||||
//| class BusDisplay:
|
||||
//| """Manage updating a display over a display bus
|
||||
//|
|
||||
//| This initializes a display and connects it into CircuitPython. Unlike other
|
||||
//| objects in CircuitPython, Display objects live until `displayio.release_displays()`
|
||||
//| objects in CircuitPython, display objects live until `displayio.release_displays()`
|
||||
//| is called. This is done so that CircuitPython can use the display itself.
|
||||
//|
|
||||
//| Most people should not use this class directly. Use a specific display driver instead that will
|
||||
@ -80,7 +87,7 @@
|
||||
//| backlight_on_high: bool = True,
|
||||
//| SH1107_addressing: bool = False
|
||||
//| ) -> None:
|
||||
//| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplay`).
|
||||
//| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplayBus`).
|
||||
//|
|
||||
//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a
|
||||
//| command byte followed by a byte to determine the parameter count and delay. When the top bit
|
||||
@ -138,7 +145,7 @@
|
||||
//| :param int backlight_pwm_frequency: The frequency to use to drive the PWM for backlight brightness control. Default is 50000.
|
||||
//| """
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
STATIC mp_obj_t busdisplay_busdisplay_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
size_t n_kw, const mp_obj_t *all_args) {
|
||||
enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart,
|
||||
ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row,
|
||||
@ -202,10 +209,10 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
|
||||
}
|
||||
|
||||
primary_display_t *disp = allocate_display_or_raise();
|
||||
displayio_display_obj_t *self = &disp->display;
|
||||
busdisplay_busdisplay_obj_t *self = &disp->display;
|
||||
|
||||
self->base.type = &displayio_display_type;
|
||||
common_hal_displayio_display_construct(
|
||||
self->base.type = &busdisplay_busdisplay_type;
|
||||
common_hal_busdisplay_busdisplay_construct(
|
||||
self,
|
||||
display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation,
|
||||
color_depth, args[ARG_grayscale].u_bool,
|
||||
@ -232,8 +239,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a
|
||||
}
|
||||
|
||||
// Helper to ensure we have the native super class instead of a subclass.
|
||||
static displayio_display_obj_t *native_display(mp_obj_t display_obj) {
|
||||
mp_obj_t native_display = mp_obj_cast_to_native_base(display_obj, &displayio_display_type);
|
||||
static busdisplay_busdisplay_obj_t *native_display(mp_obj_t display_obj) {
|
||||
mp_obj_t native_display = mp_obj_cast_to_native_base(display_obj, &busdisplay_busdisplay_type);
|
||||
mp_obj_assert_native_inited(native_display);
|
||||
return MP_OBJ_TO_PTR(native_display);
|
||||
}
|
||||
@ -264,7 +271,7 @@ static displayio_display_obj_t *native_display(mp_obj_t display_obj) {
|
||||
//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.
|
||||
//| """
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t busdisplay_busdisplay_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 };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_target_frames_per_second, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||
@ -274,7 +281,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
displayio_display_obj_t *self = native_display(pos_args[0]);
|
||||
busdisplay_busdisplay_obj_t *self = native_display(pos_args[0]);
|
||||
uint32_t maximum_ms_per_real_frame = NO_FPS_LIMIT;
|
||||
mp_int_t minimum_frames_per_second = args[ARG_minimum_frames_per_second].u_int;
|
||||
if (minimum_frames_per_second > 0) {
|
||||
@ -288,140 +295,140 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos
|
||||
target_ms_per_frame = 1000 / mp_obj_get_int(args[ARG_target_frames_per_second].u_obj);
|
||||
}
|
||||
|
||||
return mp_obj_new_bool(common_hal_displayio_display_refresh(self, target_ms_per_frame, maximum_ms_per_real_frame));
|
||||
return mp_obj_new_bool(common_hal_busdisplay_busdisplay_refresh(self, target_ms_per_frame, maximum_ms_per_real_frame));
|
||||
}
|
||||
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(busdisplay_busdisplay_refresh_obj, 1, busdisplay_busdisplay_obj_refresh);
|
||||
|
||||
//| auto_refresh: bool
|
||||
//| """True when the display is refreshed automatically."""
|
||||
STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
return mp_obj_new_bool(common_hal_displayio_display_get_auto_refresh(self));
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_get_auto_refresh(mp_obj_t self_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
return mp_obj_new_bool(common_hal_busdisplay_busdisplay_get_auto_refresh(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_auto_refresh_obj, displayio_display_obj_get_auto_refresh);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busdisplay_busdisplay_get_auto_refresh_obj, busdisplay_busdisplay_obj_get_auto_refresh);
|
||||
|
||||
STATIC mp_obj_t displayio_display_obj_set_auto_refresh(mp_obj_t self_in, mp_obj_t auto_refresh) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_set_auto_refresh(mp_obj_t self_in, mp_obj_t auto_refresh) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
|
||||
common_hal_displayio_display_set_auto_refresh(self, mp_obj_is_true(auto_refresh));
|
||||
common_hal_busdisplay_busdisplay_set_auto_refresh(self, mp_obj_is_true(auto_refresh));
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_auto_refresh_obj, displayio_display_obj_set_auto_refresh);
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(busdisplay_busdisplay_set_auto_refresh_obj, busdisplay_busdisplay_obj_set_auto_refresh);
|
||||
|
||||
MP_PROPERTY_GETSET(displayio_display_auto_refresh_obj,
|
||||
(mp_obj_t)&displayio_display_get_auto_refresh_obj,
|
||||
(mp_obj_t)&displayio_display_set_auto_refresh_obj);
|
||||
MP_PROPERTY_GETSET(busdisplay_busdisplay_auto_refresh_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_get_auto_refresh_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_set_auto_refresh_obj);
|
||||
|
||||
//| brightness: float
|
||||
//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness."""
|
||||
STATIC mp_obj_t displayio_display_obj_get_brightness(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
mp_float_t brightness = common_hal_displayio_display_get_brightness(self);
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_get_brightness(mp_obj_t self_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
mp_float_t brightness = common_hal_busdisplay_busdisplay_get_brightness(self);
|
||||
if (brightness < 0) {
|
||||
mp_raise_RuntimeError(translate("Brightness not adjustable"));
|
||||
}
|
||||
return mp_obj_new_float(brightness);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_brightness_obj, displayio_display_obj_get_brightness);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busdisplay_busdisplay_get_brightness_obj, busdisplay_busdisplay_obj_get_brightness);
|
||||
|
||||
STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
mp_float_t brightness = mp_obj_get_float(brightness_obj);
|
||||
if (brightness < 0 || brightness > 1.0) {
|
||||
mp_raise_ValueError_varg(translate("%q must be %d-%d"), MP_QSTR_brightness, 0, 1);
|
||||
}
|
||||
bool ok = common_hal_displayio_display_set_brightness(self, brightness);
|
||||
bool ok = common_hal_busdisplay_busdisplay_set_brightness(self, brightness);
|
||||
if (!ok) {
|
||||
mp_raise_RuntimeError(translate("Brightness not adjustable"));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_brightness_obj, displayio_display_obj_set_brightness);
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(busdisplay_busdisplay_set_brightness_obj, busdisplay_busdisplay_obj_set_brightness);
|
||||
|
||||
MP_PROPERTY_GETSET(displayio_display_brightness_obj,
|
||||
(mp_obj_t)&displayio_display_get_brightness_obj,
|
||||
(mp_obj_t)&displayio_display_set_brightness_obj);
|
||||
MP_PROPERTY_GETSET(busdisplay_busdisplay_brightness_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_get_brightness_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_set_brightness_obj);
|
||||
|
||||
//| width: int
|
||||
//| """Gets the width of the board"""
|
||||
STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_width(self));
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_get_width(mp_obj_t self_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_busdisplay_busdisplay_get_width(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_width_obj, displayio_display_obj_get_width);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busdisplay_busdisplay_get_width_obj, busdisplay_busdisplay_obj_get_width);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_display_width_obj,
|
||||
(mp_obj_t)&displayio_display_get_width_obj);
|
||||
MP_PROPERTY_GETTER(busdisplay_busdisplay_width_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_get_width_obj);
|
||||
|
||||
//| height: int
|
||||
//| """Gets the height of the board"""
|
||||
STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_height(self));
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_get_height(mp_obj_t self_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_busdisplay_busdisplay_get_height(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_height_obj, displayio_display_obj_get_height);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busdisplay_busdisplay_get_height_obj, busdisplay_busdisplay_obj_get_height);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_display_height_obj,
|
||||
(mp_obj_t)&displayio_display_get_height_obj);
|
||||
MP_PROPERTY_GETTER(busdisplay_busdisplay_height_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_get_height_obj);
|
||||
|
||||
//| rotation: int
|
||||
//| """The rotation of the display as an int in degrees."""
|
||||
STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_rotation(self));
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_get_rotation(mp_obj_t self_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_busdisplay_busdisplay_get_rotation(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_rotation_obj, displayio_display_obj_get_rotation);
|
||||
STATIC mp_obj_t displayio_display_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
common_hal_displayio_display_set_rotation(self, mp_obj_get_int(value));
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busdisplay_busdisplay_get_rotation_obj, busdisplay_busdisplay_obj_get_rotation);
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
common_hal_busdisplay_busdisplay_set_rotation(self, mp_obj_get_int(value));
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_rotation_obj, displayio_display_obj_set_rotation);
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(busdisplay_busdisplay_set_rotation_obj, busdisplay_busdisplay_obj_set_rotation);
|
||||
|
||||
|
||||
MP_PROPERTY_GETSET(displayio_display_rotation_obj,
|
||||
(mp_obj_t)&displayio_display_get_rotation_obj,
|
||||
(mp_obj_t)&displayio_display_set_rotation_obj);
|
||||
MP_PROPERTY_GETSET(busdisplay_busdisplay_rotation_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_get_rotation_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_set_rotation_obj);
|
||||
|
||||
//| bus: _DisplayBus
|
||||
//| """The bus being used by the display"""
|
||||
STATIC mp_obj_t displayio_display_obj_get_bus(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
return common_hal_displayio_display_get_bus(self);
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_get_bus(mp_obj_t self_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
return common_hal_busdisplay_busdisplay_get_bus(self);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_bus_obj, displayio_display_obj_get_bus);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busdisplay_busdisplay_get_bus_obj, busdisplay_busdisplay_obj_get_bus);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_display_bus_obj,
|
||||
(mp_obj_t)&displayio_display_get_bus_obj);
|
||||
MP_PROPERTY_GETTER(busdisplay_busdisplay_bus_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_get_bus_obj);
|
||||
|
||||
//| root_group: Group
|
||||
//| root_group: displayio.Group
|
||||
//| """The root group on the display.
|
||||
//| If the root group is set to `displayio.CIRCUITPYTHON_TERMINAL`, the default CircuitPython terminal will be shown.
|
||||
//| If the root group is set to ``None``, no output will be shown.
|
||||
//| """
|
||||
STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
return common_hal_displayio_display_get_root_group(self);
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_get_root_group(mp_obj_t self_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
return common_hal_busdisplay_busdisplay_get_root_group(self);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_root_group_obj, displayio_display_obj_get_root_group);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(busdisplay_busdisplay_get_root_group_obj, busdisplay_busdisplay_obj_get_root_group);
|
||||
|
||||
STATIC mp_obj_t displayio_display_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) {
|
||||
displayio_display_obj_t *self = native_display(self_in);
|
||||
STATIC mp_obj_t busdisplay_busdisplay_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) {
|
||||
busdisplay_busdisplay_obj_t *self = native_display(self_in);
|
||||
displayio_group_t *group = NULL;
|
||||
if (group_in != mp_const_none) {
|
||||
group = MP_OBJ_TO_PTR(native_group(group_in));
|
||||
}
|
||||
|
||||
common_hal_displayio_display_set_root_group(self, group);
|
||||
common_hal_busdisplay_busdisplay_set_root_group(self, group);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_root_group_obj, displayio_display_obj_set_root_group);
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(busdisplay_busdisplay_set_root_group_obj, busdisplay_busdisplay_obj_set_root_group);
|
||||
|
||||
MP_PROPERTY_GETSET(displayio_display_root_group_obj,
|
||||
(mp_obj_t)&displayio_display_get_root_group_obj,
|
||||
(mp_obj_t)&displayio_display_set_root_group_obj);
|
||||
MP_PROPERTY_GETSET(busdisplay_busdisplay_root_group_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_get_root_group_obj,
|
||||
(mp_obj_t)&busdisplay_busdisplay_set_root_group_obj);
|
||||
|
||||
|
||||
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer:
|
||||
@ -432,7 +439,7 @@ MP_PROPERTY_GETSET(displayio_display_root_group_obj,
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t busdisplay_busdisplay_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[] = {
|
||||
{ MP_QSTR_y, MP_ARG_INT | MP_ARG_REQUIRED, {.u_int = -1} },
|
||||
@ -440,7 +447,7 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
displayio_display_obj_t *self = native_display(pos_args[0]);
|
||||
busdisplay_busdisplay_obj_t *self = native_display(pos_args[0]);
|
||||
mp_int_t y = args[ARG_y].u_int;
|
||||
mp_obj_t *result = args[ARG_buffer].u_obj;
|
||||
|
||||
@ -481,28 +488,28 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po
|
||||
mp_raise_ValueError(translate("Buffer too small"));
|
||||
}
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_fill_row_obj, 1, displayio_display_obj_fill_row);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(busdisplay_busdisplay_fill_row_obj, 1, busdisplay_busdisplay_obj_fill_row);
|
||||
|
||||
STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_display_refresh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&displayio_display_fill_row_obj) },
|
||||
STATIC const mp_rom_map_elem_t busdisplay_busdisplay_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&busdisplay_busdisplay_refresh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&busdisplay_busdisplay_fill_row_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&displayio_display_auto_refresh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&busdisplay_busdisplay_auto_refresh_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&busdisplay_busdisplay_brightness_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_display_width_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_height_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&displayio_display_rotation_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_display_bus_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&displayio_display_root_group_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&busdisplay_busdisplay_width_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&busdisplay_busdisplay_height_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&busdisplay_busdisplay_rotation_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&busdisplay_busdisplay_bus_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&busdisplay_busdisplay_root_group_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_display_locals_dict, displayio_display_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(busdisplay_busdisplay_locals_dict, busdisplay_busdisplay_locals_dict_table);
|
||||
|
||||
MP_DEFINE_CONST_OBJ_TYPE(
|
||||
displayio_display_type,
|
||||
MP_QSTR_Display,
|
||||
busdisplay_busdisplay_type,
|
||||
MP_QSTR_BusDisplay,
|
||||
MP_TYPE_FLAG_NONE,
|
||||
make_new, displayio_display_make_new,
|
||||
locals_dict, &displayio_display_locals_dict
|
||||
make_new, busdisplay_busdisplay_make_new,
|
||||
locals_dict, &busdisplay_busdisplay_locals_dict
|
||||
);
|
@ -24,20 +24,19 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-module/displayio/Display.h"
|
||||
#include "shared-module/busdisplay/BusDisplay.h"
|
||||
#include "shared-module/displayio/Group.h"
|
||||
|
||||
extern const mp_obj_type_t displayio_display_type;
|
||||
extern const mp_obj_type_t busdisplay_busdisplay_type;
|
||||
|
||||
#define NO_BRIGHTNESS_COMMAND 0x100
|
||||
#define NO_FPS_LIMIT 0xffffffff
|
||||
|
||||
void common_hal_displayio_display_construct(displayio_display_obj_t *self,
|
||||
void common_hal_busdisplay_busdisplay_construct(busdisplay_busdisplay_obj_t *self,
|
||||
mp_obj_t bus, uint16_t width, uint16_t height,
|
||||
int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale,
|
||||
bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word,
|
||||
@ -47,24 +46,22 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
|
||||
bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second,
|
||||
bool backlight_on_high, bool SH1107_addressing, uint16_t backlight_pwm_frequency);
|
||||
|
||||
bool common_hal_displayio_display_refresh(displayio_display_obj_t *self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame);
|
||||
bool common_hal_busdisplay_busdisplay_refresh(busdisplay_busdisplay_obj_t *self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame);
|
||||
|
||||
bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t *self);
|
||||
void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t *self, bool auto_refresh);
|
||||
bool common_hal_busdisplay_busdisplay_get_auto_refresh(busdisplay_busdisplay_obj_t *self);
|
||||
void common_hal_busdisplay_busdisplay_set_auto_refresh(busdisplay_busdisplay_obj_t *self, bool auto_refresh);
|
||||
|
||||
uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t *self);
|
||||
uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t *self);
|
||||
uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t *self);
|
||||
void common_hal_displayio_display_set_rotation(displayio_display_obj_t *self, int rotation);
|
||||
uint16_t common_hal_busdisplay_busdisplay_get_width(busdisplay_busdisplay_obj_t *self);
|
||||
uint16_t common_hal_busdisplay_busdisplay_get_height(busdisplay_busdisplay_obj_t *self);
|
||||
uint16_t common_hal_busdisplay_busdisplay_get_rotation(busdisplay_busdisplay_obj_t *self);
|
||||
void common_hal_busdisplay_busdisplay_set_rotation(busdisplay_busdisplay_obj_t *self, int rotation);
|
||||
|
||||
bool common_hal_displayio_display_get_dither(displayio_display_obj_t *self);
|
||||
void common_hal_displayio_display_set_dither(displayio_display_obj_t *self, bool dither);
|
||||
bool common_hal_busdisplay_busdisplay_get_dither(busdisplay_busdisplay_obj_t *self);
|
||||
void common_hal_busdisplay_busdisplay_set_dither(busdisplay_busdisplay_obj_t *self, bool dither);
|
||||
|
||||
mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t *self);
|
||||
bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, mp_float_t brightness);
|
||||
mp_float_t common_hal_busdisplay_busdisplay_get_brightness(busdisplay_busdisplay_obj_t *self);
|
||||
bool common_hal_busdisplay_busdisplay_set_brightness(busdisplay_busdisplay_obj_t *self, mp_float_t brightness);
|
||||
|
||||
mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self);
|
||||
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self);
|
||||
mp_obj_t common_hal_displayio_display_set_root_group(displayio_display_obj_t *self, displayio_group_t *root_group);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H
|
||||
mp_obj_t common_hal_busdisplay_busdisplay_get_bus(busdisplay_busdisplay_obj_t *self);
|
||||
mp_obj_t common_hal_busdisplay_busdisplay_get_root_group(busdisplay_busdisplay_obj_t *self);
|
||||
mp_obj_t common_hal_busdisplay_busdisplay_set_root_group(busdisplay_busdisplay_obj_t *self, displayio_group_t *root_group);
|
53
shared-bindings/busdisplay/__init__.c
Normal file
53
shared-bindings/busdisplay/__init__.c
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/enum.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/busdisplay/__init__.h"
|
||||
#include "shared-bindings/busdisplay/BusDisplay.h"
|
||||
|
||||
//| """Displays a `displayio` object tree on an external device with a built-in
|
||||
//| framebuffer
|
||||
//|
|
||||
//| """
|
||||
|
||||
STATIC const mp_rom_map_elem_t busdisplay_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_BusDisplay), MP_ROM_PTR(&busdisplay_busdisplay_type) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(busdisplay_module_globals, busdisplay_module_globals_table);
|
||||
|
||||
const mp_obj_module_t busdisplay_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&busdisplay_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_busdisplay, busdisplay_module);
|
@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/Shape.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/binary.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/util.h"
|
||||
|
||||
//| class Shape:
|
||||
//| """Represents a shape made by defining boundaries that may be mirrored."""
|
||||
//|
|
||||
//| def __init__(
|
||||
//| self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False
|
||||
//| ) -> None:
|
||||
//| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the
|
||||
//| column boundaries of the shape on each row. Each row's boundary defaults to the full row.
|
||||
//|
|
||||
//| :param int width: The number of pixels wide
|
||||
//| :param int height: The number of pixels high
|
||||
//| :param bool mirror_x: When true the left boundary is mirrored to the right.
|
||||
//| :param bool mirror_y: When true the top boundary is mirrored to the bottom."""
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
enum { ARG_width, ARG_height, ARG_mirror_x, ARG_mirror_y };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_width, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_height, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_mirror_x, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
|
||||
{ MP_QSTR_mirror_y, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} },
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_int_t width = mp_arg_validate_int_min(args[ARG_width].u_int, 1, MP_QSTR_width);
|
||||
mp_int_t height = mp_arg_validate_int_min(args[ARG_height].u_int, 1, MP_QSTR_height);
|
||||
|
||||
displayio_shape_t *self = mp_obj_malloc(displayio_shape_t, &displayio_shape_type);
|
||||
common_hal_displayio_shape_construct(self,
|
||||
width,
|
||||
height,
|
||||
args[ARG_mirror_x].u_bool,
|
||||
args[ARG_mirror_y].u_bool);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
|
||||
//| def set_boundary(self, y: int, start_x: int, end_x: int) -> None:
|
||||
//| """Loads pre-packed data into the given row."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t displayio_shape_obj_set_boundary(size_t n_args, const mp_obj_t *args) {
|
||||
(void)n_args;
|
||||
displayio_shape_t *self = MP_OBJ_TO_PTR(args[0]);
|
||||
mp_int_t y = mp_arg_validate_type_int(args[1], MP_QSTR_y);
|
||||
mp_int_t start_x = mp_arg_validate_type_int(args[2], MP_QSTR_start_x);
|
||||
mp_int_t end_x = mp_arg_validate_type_int(args[3], MP_QSTR_end_x);
|
||||
common_hal_displayio_shape_set_boundary(self, y, start_x, end_x);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(displayio_shape_set_boundary_obj, 4, 4, displayio_shape_obj_set_boundary);
|
||||
|
||||
STATIC const mp_rom_map_elem_t displayio_shape_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_set_boundary), MP_ROM_PTR(&displayio_shape_set_boundary_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_shape_locals_dict, displayio_shape_locals_dict_table);
|
||||
|
||||
MP_DEFINE_CONST_OBJ_TYPE(
|
||||
displayio_shape_type,
|
||||
MP_QSTR_Shape,
|
||||
MP_TYPE_FLAG_NONE,
|
||||
make_new, displayio_shape_make_new,
|
||||
locals_dict, &displayio_shape_locals_dict
|
||||
);
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SHAPE_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SHAPE_H
|
||||
|
||||
#include "shared-module/displayio/Shape.h"
|
||||
|
||||
extern const mp_obj_type_t displayio_shape_type;
|
||||
|
||||
void common_hal_displayio_shape_construct(displayio_shape_t *self, uint32_t width,
|
||||
uint32_t height, bool mirror_x, bool mirror_y);
|
||||
|
||||
void common_hal_displayio_shape_set_boundary(displayio_shape_t *self, uint16_t y, uint16_t start_x,
|
||||
uint16_t end_x);
|
||||
uint32_t common_hal_displayio_shape_get_pixel(void *shape, int16_t x, int16_t y);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_SHAPE_H
|
@ -37,7 +37,6 @@
|
||||
#include "shared-bindings/displayio/ColorConverter.h"
|
||||
#include "shared-bindings/displayio/OnDiskBitmap.h"
|
||||
#include "shared-bindings/displayio/Palette.h"
|
||||
#include "shared-bindings/displayio/Shape.h"
|
||||
|
||||
//| class TileGrid:
|
||||
//| """A grid of tiles sourced out of one bitmap
|
||||
@ -49,7 +48,7 @@
|
||||
//|
|
||||
//| def __init__(
|
||||
//| self,
|
||||
//| bitmap: Union[Bitmap, OnDiskBitmap, Shape],
|
||||
//| bitmap: Union[Bitmap, OnDiskBitmap],
|
||||
//| *,
|
||||
//| pixel_shader: Union[ColorConverter, Palette],
|
||||
//| width: int = 1,
|
||||
@ -68,7 +67,7 @@
|
||||
//|
|
||||
//| tile_width and tile_height match the height of the bitmap by default.
|
||||
//|
|
||||
//| :param Bitmap,OnDiskBitmap,Shape bitmap: The bitmap storing one or more tiles.
|
||||
//| :param Bitmap,OnDiskBitmap bitmap: The bitmap storing one or more tiles.
|
||||
//| :param ColorConverter,Palette pixel_shader: The pixel shader that produces colors from values
|
||||
//| :param int width: Width of the grid in tiles.
|
||||
//| :param int height: Height of the grid in tiles.
|
||||
@ -97,19 +96,12 @@ STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_
|
||||
|
||||
uint16_t bitmap_width;
|
||||
uint16_t bitmap_height;
|
||||
mp_obj_t native = mp_obj_cast_to_native_base(bitmap, &displayio_shape_type);
|
||||
if (native != MP_OBJ_NULL) {
|
||||
displayio_shape_t *bmp = MP_OBJ_TO_PTR(native);
|
||||
bitmap_width = bmp->width;
|
||||
bitmap_height = bmp->height;
|
||||
} else if (mp_obj_is_type(bitmap, &displayio_bitmap_type)) {
|
||||
if (mp_obj_is_type(bitmap, &displayio_bitmap_type)) {
|
||||
displayio_bitmap_t *bmp = MP_OBJ_TO_PTR(bitmap);
|
||||
native = bitmap;
|
||||
bitmap_width = bmp->width;
|
||||
bitmap_height = bmp->height;
|
||||
} else if (mp_obj_is_type(bitmap, &displayio_ondiskbitmap_type)) {
|
||||
displayio_ondiskbitmap_t *bmp = MP_OBJ_TO_PTR(bitmap);
|
||||
native = bitmap;
|
||||
bitmap_width = bmp->width;
|
||||
bitmap_height = bmp->height;
|
||||
} else {
|
||||
@ -139,7 +131,7 @@ STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_
|
||||
int16_t y = args[ARG_y].u_int;
|
||||
|
||||
displayio_tilegrid_t *self = mp_obj_malloc(displayio_tilegrid_t, &displayio_tilegrid_type);
|
||||
common_hal_displayio_tilegrid_construct(self, native,
|
||||
common_hal_displayio_tilegrid_construct(self, bitmap,
|
||||
bitmap_width / tile_width, bitmap_height / tile_height,
|
||||
pixel_shader, args[ARG_width].u_int, args[ARG_height].u_int,
|
||||
tile_width, tile_height, x, y, args[ARG_default_tile].u_int);
|
||||
@ -362,7 +354,7 @@ MP_PROPERTY_GETSET(displayio_tilegrid_pixel_shader_obj,
|
||||
(mp_obj_t)&displayio_tilegrid_get_pixel_shader_obj,
|
||||
(mp_obj_t)&displayio_tilegrid_set_pixel_shader_obj);
|
||||
|
||||
//| bitmap: Union[Bitmap, OnDiskBitmap, Shape]
|
||||
//| bitmap: Union[Bitmap, OnDiskBitmap]
|
||||
//| """The bitmap of the tilegrid."""
|
||||
STATIC mp_obj_t displayio_tilegrid_obj_get_bitmap(mp_obj_t self_in) {
|
||||
displayio_tilegrid_t *self = native_tilegrid(self_in);
|
||||
@ -375,40 +367,25 @@ STATIC mp_obj_t displayio_tilegrid_obj_set_bitmap(mp_obj_t self_in, mp_obj_t bit
|
||||
|
||||
uint16_t new_bitmap_width;
|
||||
uint16_t new_bitmap_height;
|
||||
mp_obj_t native = mp_obj_cast_to_native_base(bitmap, &displayio_shape_type);
|
||||
if (native != MP_OBJ_NULL) {
|
||||
displayio_shape_t *bmp = MP_OBJ_TO_PTR(native);
|
||||
new_bitmap_width = bmp->width;
|
||||
new_bitmap_height = bmp->height;
|
||||
} else if (mp_obj_is_type(bitmap, &displayio_bitmap_type)) {
|
||||
if (mp_obj_is_type(bitmap, &displayio_bitmap_type)) {
|
||||
displayio_bitmap_t *bmp = MP_OBJ_TO_PTR(bitmap);
|
||||
native = bitmap;
|
||||
new_bitmap_width = bmp->width;
|
||||
new_bitmap_height = bmp->height;
|
||||
} else if (mp_obj_is_type(bitmap, &displayio_ondiskbitmap_type)) {
|
||||
displayio_ondiskbitmap_t *bmp = MP_OBJ_TO_PTR(bitmap);
|
||||
native = bitmap;
|
||||
new_bitmap_width = bmp->width;
|
||||
new_bitmap_height = bmp->height;
|
||||
} else {
|
||||
mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_bitmap);
|
||||
}
|
||||
|
||||
mp_obj_t old_native = mp_obj_cast_to_native_base(self->bitmap, &displayio_shape_type);
|
||||
if (old_native != MP_OBJ_NULL) {
|
||||
displayio_shape_t *old_bmp = MP_OBJ_TO_PTR(old_native);
|
||||
if (old_bmp->width != new_bitmap_width || old_bmp->height != new_bitmap_height) {
|
||||
mp_raise_ValueError(translate("New bitmap must be same size as old bitmap"));
|
||||
}
|
||||
} else if (mp_obj_is_type(self->bitmap, &displayio_bitmap_type)) {
|
||||
if (mp_obj_is_type(self->bitmap, &displayio_bitmap_type)) {
|
||||
displayio_bitmap_t *old_bmp = MP_OBJ_TO_PTR(self->bitmap);
|
||||
old_native = self->bitmap;
|
||||
if (old_bmp->width != new_bitmap_width || old_bmp->height != new_bitmap_height) {
|
||||
mp_raise_ValueError(translate("New bitmap must be same size as old bitmap"));
|
||||
}
|
||||
} else if (mp_obj_is_type(self->bitmap, &displayio_ondiskbitmap_type)) {
|
||||
displayio_ondiskbitmap_t *old_bmp = MP_OBJ_TO_PTR(self->bitmap);
|
||||
old_native = self->bitmap;
|
||||
if (old_bmp->width != new_bitmap_width || old_bmp->height != new_bitmap_height) {
|
||||
mp_raise_ValueError(translate("New bitmap must be same size as old bitmap"));
|
||||
}
|
||||
|
@ -30,27 +30,34 @@
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if CIRCUITPY_BUSDISPLAY
|
||||
#include "shared-bindings/busdisplay/BusDisplay.h"
|
||||
#endif
|
||||
#include "shared-bindings/displayio/__init__.h"
|
||||
#include "shared-bindings/displayio/Bitmap.h"
|
||||
#include "shared-bindings/displayio/ColorConverter.h"
|
||||
#include "shared-bindings/displayio/Display.h"
|
||||
#include "shared-bindings/displayio/EPaperDisplay.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/displayio/Group.h"
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/displayio/OnDiskBitmap.h"
|
||||
#include "shared-bindings/displayio/Palette.h"
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#endif
|
||||
#include "shared-bindings/displayio/Shape.h"
|
||||
#include "shared-bindings/displayio/TileGrid.h"
|
||||
#if CIRCUITPY_EPAPERDISPLAY
|
||||
#include "shared-bindings/epaperdisplay/EPaperDisplay.h"
|
||||
#endif
|
||||
#if CIRCUITPY_FOURWIRE
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
#endif
|
||||
#if CIRCUITPY_I2CDISPLAYBUS
|
||||
#include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h"
|
||||
#endif
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
//| """Native helpers for driving displays
|
||||
//| """High level, display object compositing system
|
||||
//|
|
||||
//| The `displayio` module contains classes to manage display output
|
||||
//| including synchronizing with refresh rates and partial updating.
|
||||
//| The `displayio` module contains classes to define what objects to display.
|
||||
//| It is optimized for low memory use and, therefore, computes final pixel
|
||||
//| values for dirty regions as needed.
|
||||
//|
|
||||
//| Separate modules manage transmitting the display contents to a display.
|
||||
//|
|
||||
//| For more a more thorough explanation and guide for using `displayio`, please
|
||||
//| refer to `this Learn guide
|
||||
@ -61,7 +68,10 @@
|
||||
//| """The `displayio.Group` that is the displayed serial terminal (REPL)."""
|
||||
//|
|
||||
|
||||
//| import paralleldisplay
|
||||
//| from busdisplay import BusDisplay as Display
|
||||
//| from epaperdisplay import EPaperDisplay
|
||||
//| from fourwire import FourWire
|
||||
//| from i2cdisplaybus import I2CDisplayBus as I2CDisplay
|
||||
//|
|
||||
|
||||
//| def release_displays() -> None:
|
||||
@ -85,18 +95,23 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_Bitmap), MP_ROM_PTR(&displayio_bitmap_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ColorConverter), MP_ROM_PTR(&displayio_colorconverter_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Colorspace), MP_ROM_PTR(&displayio_colorspace_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Display), MP_ROM_PTR(&displayio_display_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_EPaperDisplay), MP_ROM_PTR(&displayio_epaperdisplay_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Group), MP_ROM_PTR(&displayio_group_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_OnDiskBitmap), MP_ROM_PTR(&displayio_ondiskbitmap_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Palette), MP_ROM_PTR(&displayio_palette_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Shape), MP_ROM_PTR(&displayio_shape_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TileGrid), MP_ROM_PTR(&displayio_tilegrid_type) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&displayio_fourwire_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2CDisplay), MP_ROM_PTR(&displayio_i2cdisplay_type) },
|
||||
#if CIRCUITPY_PARALLELDISPLAY
|
||||
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(¶lleldisplay_parallelbus_type) },
|
||||
// Remove these in CircuitPython 10
|
||||
#if CIRCUITPY_BUSDISPLAY
|
||||
{ MP_ROM_QSTR(MP_QSTR_Display), MP_ROM_PTR(&busdisplay_busdisplay_type) },
|
||||
#endif
|
||||
#if CIRCUITPY_EPAPERDISPLAY
|
||||
{ MP_ROM_QSTR(MP_QSTR_EPaperDisplay), MP_ROM_PTR(&epaperdisplay_epaperdisplay_type) },
|
||||
#endif
|
||||
#if CIRCUITPY_FOURWIRE
|
||||
{ MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&fourwire_fourwire_type) },
|
||||
#endif
|
||||
#if CIRCUITPY_I2CDISPLAYBUS
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2CDisplay), MP_ROM_PTR(&i2cdisplaybus_i2cdisplaybus_type) },
|
||||
#endif
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
|
||||
|
@ -24,22 +24,11 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO___INIT___H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO___INIT___H
|
||||
#pragma once
|
||||
|
||||
#include "py/enum.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef enum {
|
||||
DISPLAY_COMMAND,
|
||||
DISPLAY_DATA
|
||||
} display_byte_type_t;
|
||||
|
||||
typedef enum {
|
||||
CHIP_SELECT_UNTOUCHED,
|
||||
CHIP_SELECT_TOGGLE_EVERY_BYTE
|
||||
} display_chip_select_behavior_t;
|
||||
|
||||
typedef enum displayio_colorspace {
|
||||
DISPLAYIO_COLORSPACE_RGB888,
|
||||
DISPLAYIO_COLORSPACE_RGB565,
|
||||
@ -53,16 +42,27 @@ typedef enum displayio_colorspace {
|
||||
DISPLAYIO_COLORSPACE_L8,
|
||||
} displayio_colorspace_t;
|
||||
|
||||
void common_hal_displayio_release_displays(void);
|
||||
|
||||
extern const mp_obj_type_t displayio_colorspace_type;
|
||||
extern const cp_enum_obj_t displayio_colorspace_RGB888_obj;
|
||||
|
||||
|
||||
// Used in the various bus displays: BusDisplay, EPaperDisplay and ParallelDisplay
|
||||
// Supported by shared-module/displayio/bus_core.c
|
||||
typedef enum {
|
||||
DISPLAY_COMMAND,
|
||||
DISPLAY_DATA
|
||||
} display_byte_type_t;
|
||||
|
||||
typedef enum {
|
||||
CHIP_SELECT_UNTOUCHED,
|
||||
CHIP_SELECT_TOGGLE_EVERY_BYTE
|
||||
} display_chip_select_behavior_t;
|
||||
|
||||
typedef bool (*display_bus_bus_reset)(mp_obj_t bus);
|
||||
typedef bool (*display_bus_bus_free)(mp_obj_t bus);
|
||||
typedef bool (*display_bus_begin_transaction)(mp_obj_t bus);
|
||||
typedef void (*display_bus_send)(mp_obj_t bus, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
|
||||
typedef void (*display_bus_end_transaction)(mp_obj_t bus);
|
||||
|
||||
void common_hal_displayio_release_displays(void);
|
||||
|
||||
extern const mp_obj_type_t displayio_colorspace_type;
|
||||
extern const cp_enum_obj_t displayio_colorspace_RGB888_obj;
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO___INIT___H
|
||||
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/EPaperDisplay.h"
|
||||
#include "shared-bindings/epaperdisplay/EPaperDisplay.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -38,6 +38,8 @@
|
||||
#include "shared-bindings/util.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
//| from busdisplay import _DisplayBus
|
||||
//|
|
||||
//| class EPaperDisplay:
|
||||
//| """Manage updating an epaper display over a display bus
|
||||
//|
|
||||
@ -82,7 +84,7 @@
|
||||
//| start_up_time: float = 0,
|
||||
//| address_little_endian: bool = False
|
||||
//| ) -> None:
|
||||
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `paralleldisplay.ParallelBus`).
|
||||
//| """Create a EPaperDisplay object on the given display bus (`fourwire.FourWire` or `paralleldisplaybus.ParallelBus`).
|
||||
//|
|
||||
//| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every
|
||||
//| command begins with a command byte followed by a byte to determine the parameter count and
|
||||
@ -93,7 +95,7 @@
|
||||
//| extra long 500 ms delay instead of 255 ms. The next byte will begin a new command definition.
|
||||
//|
|
||||
//| :param display_bus: The bus that the display is connected to
|
||||
//| :type _DisplayBus: displayio.FourWire or paralleldisplay.ParallelBus
|
||||
//| :type _DisplayBus: fourwire.FourWire or paralleldisplaybus.ParallelBus
|
||||
//| :param ~circuitpython_typing.ReadableBuffer start_sequence: Byte-packed command sequence.
|
||||
//| :param ~circuitpython_typing.ReadableBuffer stop_sequence: Byte-packed command sequence.
|
||||
//| :param int width: Width in pixels
|
||||
@ -125,7 +127,7 @@
|
||||
//| :param bool address_little_endian: Send the least significant byte (not bit) of multi-byte addresses first. Ignored when ram is addressed with one byte
|
||||
//| """
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height,
|
||||
ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation,
|
||||
ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command,
|
||||
@ -185,7 +187,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size
|
||||
}
|
||||
|
||||
primary_display_t *disp = allocate_display_or_raise();
|
||||
displayio_epaperdisplay_obj_t *self = &disp->epaper_display;
|
||||
epaperdisplay_epaperdisplay_obj_t *self = &disp->epaper_display;
|
||||
|
||||
mp_float_t refresh_time = mp_obj_get_float(args[ARG_refresh_time].u_obj);
|
||||
mp_float_t seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj);
|
||||
@ -218,8 +220,8 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size
|
||||
mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_refresh_display_command);
|
||||
}
|
||||
|
||||
self->base.type = &displayio_epaperdisplay_type;
|
||||
common_hal_displayio_epaperdisplay_construct(
|
||||
self->base.type = &epaperdisplay_epaperdisplay_type;
|
||||
common_hal_epaperdisplay_epaperdisplay_construct(
|
||||
self,
|
||||
display_bus,
|
||||
start_bufinfo.buf, start_bufinfo.len, start_up_time, stop_bufinfo.buf, stop_bufinfo.len,
|
||||
@ -238,8 +240,8 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size
|
||||
}
|
||||
|
||||
// Helper to ensure we have the native super class instead of a subclass.
|
||||
static displayio_epaperdisplay_obj_t *native_display(mp_obj_t display_obj) {
|
||||
mp_obj_t native_display = mp_obj_cast_to_native_base(display_obj, &displayio_epaperdisplay_type);
|
||||
static epaperdisplay_epaperdisplay_obj_t *native_display(mp_obj_t display_obj) {
|
||||
mp_obj_t native_display = mp_obj_cast_to_native_base(display_obj, &epaperdisplay_epaperdisplay_type);
|
||||
mp_obj_assert_native_inited(native_display);
|
||||
return MP_OBJ_TO_PTR(native_display);
|
||||
}
|
||||
@ -249,13 +251,13 @@ static displayio_epaperdisplay_obj_t *native_display(mp_obj_t display_obj) {
|
||||
//| ) -> None:
|
||||
//| """Updates the ``start_sequence`` and ``seconds_per_frame`` parameters to enable
|
||||
//| varying the refresh mode of the display."""
|
||||
STATIC mp_obj_t displayio_epaperdisplay_update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_start_sequence, ARG_seconds_per_frame };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_start_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_seconds_per_frame, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(180)} },
|
||||
};
|
||||
displayio_epaperdisplay_obj_t *self = native_display(pos_args[0]);
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(pos_args[0]);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
@ -265,147 +267,147 @@ STATIC mp_obj_t displayio_epaperdisplay_update_refresh_mode(size_t n_args, const
|
||||
float seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj);
|
||||
|
||||
// Update parameters
|
||||
displayio_epaperdisplay_change_refresh_mode_parameters(self, &start_sequence, seconds_per_frame);
|
||||
epaperdisplay_epaperdisplay_change_refresh_mode_parameters(self, &start_sequence, seconds_per_frame);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_epaperdisplay_update_refresh_mode_obj, 1, displayio_epaperdisplay_update_refresh_mode);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(epaperdisplay_epaperdisplay_update_refresh_mode_obj, 1, epaperdisplay_epaperdisplay_update_refresh_mode);
|
||||
|
||||
//| def refresh(self) -> None:
|
||||
//| """Refreshes the display immediately or raises an exception if too soon. Use
|
||||
//| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur."""
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_refresh(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
bool ok = common_hal_displayio_epaperdisplay_refresh(self);
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_refresh(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
bool ok = common_hal_epaperdisplay_epaperdisplay_refresh(self);
|
||||
if (!ok) {
|
||||
mp_raise_RuntimeError(translate("Refresh too soon"));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperdisplay_obj_refresh);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_refresh_obj, epaperdisplay_epaperdisplay_obj_refresh);
|
||||
|
||||
//| time_to_refresh: float
|
||||
//| """Time, in fractional seconds, until the ePaper display can be refreshed."""
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return mp_obj_new_float(common_hal_displayio_epaperdisplay_get_time_to_refresh(self) / 1000.0);
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return mp_obj_new_float(common_hal_epaperdisplay_epaperdisplay_get_time_to_refresh(self) / 1000.0);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_time_to_refresh_obj, displayio_epaperdisplay_obj_get_time_to_refresh);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_get_time_to_refresh_obj, epaperdisplay_epaperdisplay_obj_get_time_to_refresh);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_epaperdisplay_time_to_refresh_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_get_time_to_refresh_obj);
|
||||
MP_PROPERTY_GETTER(epaperdisplay_epaperdisplay_time_to_refresh_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_get_time_to_refresh_obj);
|
||||
|
||||
//| busy: bool
|
||||
//| """True when the display is refreshing. This uses the ``busy_pin`` when available or the
|
||||
//| ``refresh_time`` otherwise."""
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_busy(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return mp_obj_new_bool(common_hal_displayio_epaperdisplay_get_busy(self));
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_get_busy(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return mp_obj_new_bool(common_hal_epaperdisplay_epaperdisplay_get_busy(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_busy_obj, displayio_epaperdisplay_obj_get_busy);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_get_busy_obj, epaperdisplay_epaperdisplay_obj_get_busy);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_epaperdisplay_busy_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_get_busy_obj);
|
||||
MP_PROPERTY_GETTER(epaperdisplay_epaperdisplay_busy_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_get_busy_obj);
|
||||
|
||||
//| width: int
|
||||
//| """Gets the width of the display in pixels"""
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_width(self));
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_get_width(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_epaperdisplay_epaperdisplay_get_width(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_width_obj, displayio_epaperdisplay_obj_get_width);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_get_width_obj, epaperdisplay_epaperdisplay_obj_get_width);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_epaperdisplay_width_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_get_width_obj);
|
||||
MP_PROPERTY_GETTER(epaperdisplay_epaperdisplay_width_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_get_width_obj);
|
||||
|
||||
//| height: int
|
||||
//| """Gets the height of the display in pixels"""
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_height(self));
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_get_height(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_epaperdisplay_epaperdisplay_get_height(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_height_obj, displayio_epaperdisplay_obj_get_height);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_get_height_obj, epaperdisplay_epaperdisplay_obj_get_height);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_epaperdisplay_height_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_get_height_obj);
|
||||
MP_PROPERTY_GETTER(epaperdisplay_epaperdisplay_height_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_get_height_obj);
|
||||
|
||||
//| rotation: int
|
||||
//| """The rotation of the display as an int in degrees."""
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_rotation(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_rotation(self));
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_get_rotation(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_epaperdisplay_epaperdisplay_get_rotation(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_rotation_obj, displayio_epaperdisplay_obj_get_rotation);
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
common_hal_displayio_epaperdisplay_set_rotation(self, mp_obj_get_int(value));
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_get_rotation_obj, epaperdisplay_epaperdisplay_obj_get_rotation);
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
common_hal_epaperdisplay_epaperdisplay_set_rotation(self, mp_obj_get_int(value));
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_set_rotation_obj, displayio_epaperdisplay_obj_set_rotation);
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(epaperdisplay_epaperdisplay_set_rotation_obj, epaperdisplay_epaperdisplay_obj_set_rotation);
|
||||
|
||||
|
||||
MP_PROPERTY_GETSET(displayio_epaperdisplay_rotation_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_get_rotation_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_set_rotation_obj);
|
||||
MP_PROPERTY_GETSET(epaperdisplay_epaperdisplay_rotation_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_get_rotation_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_set_rotation_obj);
|
||||
|
||||
//| bus: _DisplayBus
|
||||
//| """The bus being used by the display"""
|
||||
//|
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return common_hal_displayio_epaperdisplay_get_bus(self);
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_get_bus(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return common_hal_epaperdisplay_epaperdisplay_get_bus(self);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_bus_obj, displayio_epaperdisplay_obj_get_bus);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_get_bus_obj, epaperdisplay_epaperdisplay_obj_get_bus);
|
||||
|
||||
MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_get_bus_obj);
|
||||
MP_PROPERTY_GETTER(epaperdisplay_epaperdisplay_bus_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_get_bus_obj);
|
||||
|
||||
//| root_group: Group
|
||||
//| root_group: displayio.Group
|
||||
//| """The root group on the epaper display.
|
||||
//| If the root group is set to `displayio.CIRCUITPYTHON_TERMINAL`, the default CircuitPython terminal will be shown.
|
||||
//| If the root group is set to ``None``, no output will be shown.
|
||||
//| """
|
||||
//|
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_get_root_group(mp_obj_t self_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return common_hal_displayio_epaperdisplay_get_root_group(self);
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_get_root_group(mp_obj_t self_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
return common_hal_epaperdisplay_epaperdisplay_get_root_group(self);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_root_group_obj, displayio_epaperdisplay_obj_get_root_group);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(epaperdisplay_epaperdisplay_get_root_group_obj, epaperdisplay_epaperdisplay_obj_get_root_group);
|
||||
|
||||
STATIC mp_obj_t displayio_epaperdisplay_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) {
|
||||
displayio_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
STATIC mp_obj_t epaperdisplay_epaperdisplay_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) {
|
||||
epaperdisplay_epaperdisplay_obj_t *self = native_display(self_in);
|
||||
displayio_group_t *group = NULL;
|
||||
if (group_in != mp_const_none) {
|
||||
group = MP_OBJ_TO_PTR(native_group(group_in));
|
||||
}
|
||||
|
||||
common_hal_displayio_epaperdisplay_set_root_group(self, group);
|
||||
common_hal_epaperdisplay_epaperdisplay_set_root_group(self, group);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_set_root_group_obj, displayio_epaperdisplay_obj_set_root_group);
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(epaperdisplay_epaperdisplay_set_root_group_obj, epaperdisplay_epaperdisplay_obj_set_root_group);
|
||||
|
||||
MP_PROPERTY_GETSET(displayio_epaperdisplay_root_group_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_get_root_group_obj,
|
||||
(mp_obj_t)&displayio_epaperdisplay_set_root_group_obj);
|
||||
MP_PROPERTY_GETSET(epaperdisplay_epaperdisplay_root_group_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_get_root_group_obj,
|
||||
(mp_obj_t)&epaperdisplay_epaperdisplay_set_root_group_obj);
|
||||
|
||||
STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&displayio_epaperdisplay_update_refresh_mode_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) },
|
||||
STATIC const mp_rom_map_elem_t epaperdisplay_epaperdisplay_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&epaperdisplay_epaperdisplay_update_refresh_mode_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&epaperdisplay_epaperdisplay_refresh_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&displayio_epaperdisplay_rotation_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&displayio_epaperdisplay_root_group_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&epaperdisplay_epaperdisplay_width_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&epaperdisplay_epaperdisplay_height_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&epaperdisplay_epaperdisplay_rotation_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&epaperdisplay_epaperdisplay_bus_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&epaperdisplay_epaperdisplay_busy_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&epaperdisplay_epaperdisplay_time_to_refresh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&epaperdisplay_epaperdisplay_root_group_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(epaperdisplay_epaperdisplay_locals_dict, epaperdisplay_epaperdisplay_locals_dict_table);
|
||||
|
||||
MP_DEFINE_CONST_OBJ_TYPE(
|
||||
displayio_epaperdisplay_type,
|
||||
epaperdisplay_epaperdisplay_type,
|
||||
MP_QSTR_EPaperDisplay,
|
||||
MP_TYPE_FLAG_NONE,
|
||||
make_new, displayio_epaperdisplay_make_new,
|
||||
locals_dict, &displayio_epaperdisplay_locals_dict
|
||||
make_new, epaperdisplay_epaperdisplay_make_new,
|
||||
locals_dict, &epaperdisplay_epaperdisplay_locals_dict
|
||||
);
|
@ -24,19 +24,18 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-module/displayio/EPaperDisplay.h"
|
||||
#include "shared-module/epaperdisplay/EPaperDisplay.h"
|
||||
#include "shared-module/displayio/Group.h"
|
||||
|
||||
extern const mp_obj_type_t displayio_epaperdisplay_type;
|
||||
extern const mp_obj_type_t epaperdisplay_epaperdisplay_type;
|
||||
|
||||
#define NO_COMMAND 0x100
|
||||
|
||||
void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self,
|
||||
void common_hal_epaperdisplay_epaperdisplay_construct(epaperdisplay_epaperdisplay_obj_t *self,
|
||||
mp_obj_t bus, const uint8_t *start_sequence, uint16_t start_sequence_len, mp_float_t start_up_time,
|
||||
const uint8_t *stop_sequence, uint16_t stop_sequence_len,
|
||||
uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height,
|
||||
@ -50,20 +49,18 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t
|
||||
bool always_toggle_chip_select, bool grayscale, bool acep, bool two_byte_sequence_length,
|
||||
bool address_little_endian);
|
||||
|
||||
bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t *self);
|
||||
bool common_hal_epaperdisplay_epaperdisplay_refresh(epaperdisplay_epaperdisplay_obj_t *self);
|
||||
|
||||
mp_obj_t common_hal_displayio_epaperdisplay_get_root_group(displayio_epaperdisplay_obj_t *self);
|
||||
bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group);
|
||||
mp_obj_t common_hal_epaperdisplay_epaperdisplay_get_root_group(epaperdisplay_epaperdisplay_obj_t *self);
|
||||
bool common_hal_epaperdisplay_epaperdisplay_set_root_group(epaperdisplay_epaperdisplay_obj_t *self, displayio_group_t *root_group);
|
||||
|
||||
// Returns time in milliseconds.
|
||||
uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t *self);
|
||||
bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t *self);
|
||||
uint32_t common_hal_epaperdisplay_epaperdisplay_get_time_to_refresh(epaperdisplay_epaperdisplay_obj_t *self);
|
||||
bool common_hal_epaperdisplay_epaperdisplay_get_busy(epaperdisplay_epaperdisplay_obj_t *self);
|
||||
|
||||
uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t *self);
|
||||
uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t *self);
|
||||
uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay_obj_t *self);
|
||||
void common_hal_displayio_epaperdisplay_set_rotation(displayio_epaperdisplay_obj_t *self, int rotation);
|
||||
uint16_t common_hal_epaperdisplay_epaperdisplay_get_width(epaperdisplay_epaperdisplay_obj_t *self);
|
||||
uint16_t common_hal_epaperdisplay_epaperdisplay_get_height(epaperdisplay_epaperdisplay_obj_t *self);
|
||||
uint16_t common_hal_epaperdisplay_epaperdisplay_get_rotation(epaperdisplay_epaperdisplay_obj_t *self);
|
||||
void common_hal_epaperdisplay_epaperdisplay_set_rotation(epaperdisplay_epaperdisplay_obj_t *self, int rotation);
|
||||
|
||||
mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_t *self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H
|
||||
mp_obj_t common_hal_epaperdisplay_epaperdisplay_get_bus(epaperdisplay_epaperdisplay_obj_t *self);
|
52
shared-bindings/epaperdisplay/__init__.c
Normal file
52
shared-bindings/epaperdisplay/__init__.c
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/enum.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/epaperdisplay/__init__.h"
|
||||
#include "shared-bindings/epaperdisplay/EPaperDisplay.h"
|
||||
|
||||
//| """Displays a `displayio` object tree on an e-paper display
|
||||
//|
|
||||
//| """
|
||||
|
||||
STATIC const mp_rom_map_elem_t epaperdisplay_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_EPaperDisplay), MP_ROM_PTR(&epaperdisplay_epaperdisplay_type) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(epaperdisplay_module_globals, epaperdisplay_module_globals_table);
|
||||
|
||||
const mp_obj_module_t epaperdisplay_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&epaperdisplay_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_epaperdisplay, epaperdisplay_module);
|
27
shared-bindings/epaperdisplay/__init__.h
Normal file
27
shared-bindings/epaperdisplay/__init__.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
//| :param int phase: the edge of the clock that data is captured. First (0)
|
||||
//| or second (1). Rising or falling depends on clock polarity."""
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
STATIC mp_obj_t fourwire_fourwire_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
enum { ARG_spi_bus, ARG_command, ARG_chip_select, ARG_reset, ARG_baudrate, ARG_polarity, ARG_phase };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_spi_bus, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
@ -94,13 +94,13 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_
|
||||
|
||||
mp_obj_t spi = mp_arg_validate_type(args[ARG_spi_bus].u_obj, &busio_spi_type, MP_QSTR_spi_bus);
|
||||
|
||||
displayio_fourwire_obj_t *self = &allocate_display_bus_or_raise()->fourwire_bus;
|
||||
self->base.type = &displayio_fourwire_type;
|
||||
fourwire_fourwire_obj_t *self = &allocate_display_bus_or_raise()->fourwire_bus;
|
||||
self->base.type = &fourwire_fourwire_type;
|
||||
|
||||
uint8_t polarity = (uint8_t)mp_arg_validate_int_range(args[ARG_polarity].u_int, 0, 1, MP_QSTR_polarity);
|
||||
uint8_t phase = (uint8_t)mp_arg_validate_int_range(args[ARG_phase].u_int, 0, 1, MP_QSTR_phase);
|
||||
|
||||
common_hal_displayio_fourwire_construct(self,
|
||||
common_hal_fourwire_fourwire_construct(self,
|
||||
MP_OBJ_TO_PTR(spi), command, chip_select, reset, args[ARG_baudrate].u_int, polarity, phase);
|
||||
return self;
|
||||
}
|
||||
@ -109,15 +109,15 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_
|
||||
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
||||
//| is available."""
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) {
|
||||
displayio_fourwire_obj_t *self = self_in;
|
||||
STATIC mp_obj_t fourwire_fourwire_obj_reset(mp_obj_t self_in) {
|
||||
fourwire_fourwire_obj_t *self = self_in;
|
||||
|
||||
if (!common_hal_displayio_fourwire_reset(self)) {
|
||||
if (!common_hal_fourwire_fourwire_reset(self)) {
|
||||
mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset);
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_reset);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(fourwire_fourwire_reset_obj, fourwire_fourwire_obj_reset);
|
||||
|
||||
//| def send(
|
||||
//| self, command: int, data: ReadableBuffer, *, toggle_every_byte: bool = False
|
||||
@ -126,7 +126,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_r
|
||||
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC mp_obj_t fourwire_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_command, ARG_data, ARG_toggle_every_byte };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_command, MP_ARG_INT | MP_ARG_REQUIRED },
|
||||
@ -138,37 +138,37 @@ STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_a
|
||||
|
||||
mp_int_t command_int = mp_arg_validate_int_range(args[ARG_command].u_int, 0, 255, MP_QSTR_command);
|
||||
|
||||
displayio_fourwire_obj_t *self = pos_args[0];
|
||||
fourwire_fourwire_obj_t *self = pos_args[0];
|
||||
uint8_t command = command_int;
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[ARG_data].u_obj, &bufinfo, MP_BUFFER_READ);
|
||||
|
||||
// Wait for display bus to be available.
|
||||
while (!common_hal_displayio_fourwire_begin_transaction(self)) {
|
||||
while (!common_hal_fourwire_fourwire_begin_transaction(self)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED;
|
||||
if (args[ARG_toggle_every_byte].u_bool) {
|
||||
chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE;
|
||||
}
|
||||
common_hal_displayio_fourwire_send(self, DISPLAY_COMMAND, chip_select, &command, 1);
|
||||
common_hal_displayio_fourwire_send(self, DISPLAY_DATA, chip_select, ((uint8_t *)bufinfo.buf), bufinfo.len);
|
||||
common_hal_displayio_fourwire_end_transaction(self);
|
||||
common_hal_fourwire_fourwire_send(self, DISPLAY_COMMAND, chip_select, &command, 1);
|
||||
common_hal_fourwire_fourwire_send(self, DISPLAY_DATA, chip_select, ((uint8_t *)bufinfo.buf), bufinfo.len);
|
||||
common_hal_fourwire_fourwire_end_transaction(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_fourwire_send_obj, 1, displayio_fourwire_obj_send);
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(fourwire_fourwire_send_obj, 1, fourwire_fourwire_obj_send);
|
||||
|
||||
STATIC const mp_rom_map_elem_t displayio_fourwire_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&displayio_fourwire_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_fourwire_send_obj) },
|
||||
STATIC const mp_rom_map_elem_t fourwire_fourwire_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&fourwire_fourwire_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&fourwire_fourwire_send_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_fourwire_locals_dict, displayio_fourwire_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(fourwire_fourwire_locals_dict, fourwire_fourwire_locals_dict_table);
|
||||
|
||||
MP_DEFINE_CONST_OBJ_TYPE(
|
||||
displayio_fourwire_type,
|
||||
fourwire_fourwire_type,
|
||||
MP_QSTR_FourWire,
|
||||
MP_TYPE_FLAG_NONE,
|
||||
make_new, displayio_fourwire_make_new,
|
||||
locals_dict, &displayio_fourwire_locals_dict
|
||||
make_new, fourwire_fourwire_make_new,
|
||||
locals_dict, &fourwire_fourwire_locals_dict
|
||||
);
|
@ -24,33 +24,30 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_FOURWIRE_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_FOURWIRE_H
|
||||
#pragma once
|
||||
|
||||
#include "shared-module/displayio/FourWire.h"
|
||||
#include "shared-module/fourwire/FourWire.h"
|
||||
|
||||
#include "shared-bindings/displayio/__init__.h"
|
||||
#include "shared-bindings/fourwire/__init__.h"
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
#include "shared-module/displayio/Group.h"
|
||||
|
||||
extern const mp_obj_type_t displayio_fourwire_type;
|
||||
extern const mp_obj_type_t fourwire_fourwire_type;
|
||||
|
||||
void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t *self,
|
||||
void common_hal_fourwire_fourwire_construct(fourwire_fourwire_obj_t *self,
|
||||
busio_spi_obj_t *spi, const mcu_pin_obj_t *command,
|
||||
const mcu_pin_obj_t *chip_select, const mcu_pin_obj_t *reset, uint32_t baudrate,
|
||||
uint8_t polarity, uint8_t phase);
|
||||
|
||||
void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t *self);
|
||||
void common_hal_fourwire_fourwire_deinit(fourwire_fourwire_obj_t *self);
|
||||
|
||||
bool common_hal_displayio_fourwire_reset(mp_obj_t self);
|
||||
bool common_hal_displayio_fourwire_bus_free(mp_obj_t self);
|
||||
bool common_hal_fourwire_fourwire_reset(mp_obj_t self);
|
||||
bool common_hal_fourwire_fourwire_bus_free(mp_obj_t self);
|
||||
|
||||
bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t self);
|
||||
bool common_hal_fourwire_fourwire_begin_transaction(mp_obj_t self);
|
||||
|
||||
void common_hal_displayio_fourwire_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
void common_hal_fourwire_fourwire_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
|
||||
|
||||
void common_hal_displayio_fourwire_end_transaction(mp_obj_t self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_FOURWIRE_H
|
||||
void common_hal_fourwire_fourwire_end_transaction(mp_obj_t self);
|
52
shared-bindings/fourwire/__init__.c
Normal file
52
shared-bindings/fourwire/__init__.c
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/enum.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/fourwire/__init__.h"
|
||||
#include "shared-bindings/fourwire/FourWire.h"
|
||||
|
||||
//| """Connects to a BusDisplay over a four wire bus
|
||||
//|
|
||||
//| """
|
||||
|
||||
STATIC const mp_rom_map_elem_t fourwire_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_busdisplay) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&fourwire_fourwire_type) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(fourwire_module_globals, fourwire_module_globals_table);
|
||||
|
||||
const mp_obj_module_t fourwire_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&fourwire_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_fourwire, fourwire_module);
|
27
shared-bindings/fourwire/__init__.h
Normal file
27
shared-bindings/fourwire/__init__.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/displayio/I2CDisplay.h"
|
||||
#include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@ -38,7 +38,7 @@
|
||||
#include "shared-bindings/util.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
//| class I2CDisplay:
|
||||
//| class I2CDisplayBus:
|
||||
//| """Manage updating a display over I2C in the background while Python code runs.
|
||||
//| It doesn't handle display initialization."""
|
||||
//|
|
||||
@ -49,7 +49,7 @@
|
||||
//| device_address: int,
|
||||
//| reset: Optional[microcontroller.Pin] = None
|
||||
//| ) -> None:
|
||||
//| """Create a I2CDisplay object associated with the given I2C bus and reset pin.
|
||||
//| """Create a I2CDisplayBus object associated with the given I2C bus and reset pin.
|
||||
//|
|
||||
//| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is
|
||||
//| called even after a reload. (It does this so CircuitPython can use the display after your code
|
||||
@ -61,7 +61,7 @@
|
||||
//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used
|
||||
//| """
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
STATIC mp_obj_t i2cdisplaybus_i2cdisplaybus_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
enum { ARG_i2c_bus, ARG_device_address, ARG_reset };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_i2c_bus, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
@ -74,10 +74,10 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t
|
||||
const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj, MP_QSTR_reset);
|
||||
|
||||
mp_obj_t i2c = mp_arg_validate_type(args[ARG_i2c_bus].u_obj, &busio_i2c_type, MP_QSTR_i2c_bus);
|
||||
displayio_i2cdisplay_obj_t *self = &allocate_display_bus_or_raise()->i2cdisplay_bus;
|
||||
self->base.type = &displayio_i2cdisplay_type;
|
||||
i2cdisplaybus_i2cdisplaybus_obj_t *self = &allocate_display_bus_or_raise()->i2cdisplay_bus;
|
||||
self->base.type = &i2cdisplaybus_i2cdisplaybus_type;
|
||||
|
||||
common_hal_displayio_i2cdisplay_construct(self,
|
||||
common_hal_i2cdisplaybus_i2cdisplaybus_construct(self,
|
||||
MP_OBJ_TO_PTR(i2c), args[ARG_device_address].u_int, reset);
|
||||
return self;
|
||||
}
|
||||
@ -86,22 +86,22 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t
|
||||
//| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin
|
||||
//| is available."""
|
||||
//| ...
|
||||
STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) {
|
||||
displayio_i2cdisplay_obj_t *self = self_in;
|
||||
STATIC mp_obj_t i2cdisplaybus_i2cdisplaybus_obj_reset(mp_obj_t self_in) {
|
||||
i2cdisplaybus_i2cdisplaybus_obj_t *self = self_in;
|
||||
|
||||
if (!common_hal_displayio_i2cdisplay_reset(self)) {
|
||||
if (!common_hal_i2cdisplaybus_i2cdisplaybus_reset(self)) {
|
||||
mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset);
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_obj_reset);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(i2cdisplaybus_i2cdisplaybus_reset_obj, i2cdisplaybus_i2cdisplaybus_obj_reset);
|
||||
|
||||
//| def send(self, command: int, data: ReadableBuffer) -> None:
|
||||
//| """Sends the given command value followed by the full set of data. Display state, such as
|
||||
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
|
||||
STATIC mp_obj_t i2cdisplaybus_i2cdisplaybus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
|
||||
mp_int_t command_int = mp_obj_get_int(command_obj);
|
||||
mp_arg_validate_int_range(command_int, 0, 255, MP_QSTR_command);
|
||||
|
||||
@ -110,29 +110,29 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_ob
|
||||
mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ);
|
||||
|
||||
// Wait for display bus to be available.
|
||||
while (!common_hal_displayio_i2cdisplay_begin_transaction(self)) {
|
||||
while (!common_hal_i2cdisplaybus_i2cdisplaybus_begin_transaction(self)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
uint8_t full_command[bufinfo.len + 1];
|
||||
full_command[0] = command;
|
||||
memcpy(full_command + 1, ((uint8_t *)bufinfo.buf), bufinfo.len);
|
||||
common_hal_displayio_i2cdisplay_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, full_command, bufinfo.len + 1);
|
||||
common_hal_displayio_i2cdisplay_end_transaction(self);
|
||||
common_hal_i2cdisplaybus_i2cdisplaybus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, full_command, bufinfo.len + 1);
|
||||
common_hal_i2cdisplaybus_i2cdisplaybus_end_transaction(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_3(displayio_i2cdisplay_send_obj, displayio_i2cdisplay_obj_send);
|
||||
MP_DEFINE_CONST_FUN_OBJ_3(i2cdisplaybus_i2cdisplaybus_send_obj, i2cdisplaybus_i2cdisplaybus_obj_send);
|
||||
|
||||
STATIC const mp_rom_map_elem_t displayio_i2cdisplay_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&displayio_i2cdisplay_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_i2cdisplay_send_obj) },
|
||||
STATIC const mp_rom_map_elem_t i2cdisplaybus_i2cdisplaybus_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&i2cdisplaybus_i2cdisplaybus_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&i2cdisplaybus_i2cdisplaybus_send_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_i2cdisplay_locals_dict, displayio_i2cdisplay_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(i2cdisplaybus_i2cdisplaybus_locals_dict, i2cdisplaybus_i2cdisplaybus_locals_dict_table);
|
||||
|
||||
MP_DEFINE_CONST_OBJ_TYPE(
|
||||
displayio_i2cdisplay_type,
|
||||
MP_QSTR_I2CDisplay,
|
||||
i2cdisplaybus_i2cdisplaybus_type,
|
||||
MP_QSTR_I2CDisplayBus,
|
||||
MP_TYPE_FLAG_NONE,
|
||||
make_new, displayio_i2cdisplay_make_new,
|
||||
locals_dict, &displayio_i2cdisplay_locals_dict
|
||||
make_new, i2cdisplaybus_i2cdisplaybus_make_new,
|
||||
locals_dict, &i2cdisplaybus_i2cdisplaybus_locals_dict
|
||||
);
|
@ -24,29 +24,26 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_I2CDISPLAY_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_I2CDISPLAY_H
|
||||
#pragma once
|
||||
|
||||
#include "shared-module/displayio/I2CDisplay.h"
|
||||
#include "shared-module/i2cdisplaybus/I2CDisplayBus.h"
|
||||
|
||||
#include "shared-bindings/displayio/__init__.h"
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
extern const mp_obj_type_t displayio_i2cdisplay_type;
|
||||
extern const mp_obj_type_t i2cdisplaybus_i2cdisplaybus_type;
|
||||
|
||||
void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t *self,
|
||||
void common_hal_i2cdisplaybus_i2cdisplaybus_construct(i2cdisplaybus_i2cdisplaybus_obj_t *self,
|
||||
busio_i2c_obj_t *i2c, uint16_t device_address, const mcu_pin_obj_t *reset);
|
||||
|
||||
void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t *self);
|
||||
void common_hal_i2cdisplaybus_i2cdisplaybus_deinit(i2cdisplaybus_i2cdisplaybus_obj_t *self);
|
||||
|
||||
bool common_hal_displayio_i2cdisplay_reset(mp_obj_t self);
|
||||
bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t self);
|
||||
bool common_hal_i2cdisplaybus_i2cdisplaybus_reset(mp_obj_t self);
|
||||
bool common_hal_i2cdisplaybus_i2cdisplaybus_bus_free(mp_obj_t self);
|
||||
|
||||
bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t self);
|
||||
bool common_hal_i2cdisplaybus_i2cdisplaybus_begin_transaction(mp_obj_t self);
|
||||
|
||||
void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
void common_hal_i2cdisplaybus_i2cdisplaybus_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
|
||||
|
||||
void common_hal_displayio_i2cdisplay_end_transaction(mp_obj_t self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_I2CDISPLAY_H
|
||||
void common_hal_i2cdisplaybus_i2cdisplaybus_end_transaction(mp_obj_t self);
|
52
shared-bindings/i2cdisplaybus/__init__.c
Normal file
52
shared-bindings/i2cdisplaybus/__init__.c
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2023 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/enum.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/i2cdisplaybus/__init__.h"
|
||||
#include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h"
|
||||
|
||||
//| """Communicates to a display IC over I2C
|
||||
//|
|
||||
//| """
|
||||
|
||||
STATIC const mp_rom_map_elem_t i2cdisplaybus_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2cdisplaybus) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2CDisplayBus), MP_ROM_PTR(&i2cdisplaybus_i2cdisplaybus_type) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(i2cdisplaybus_module_globals, i2cdisplaybus_module_globals_table);
|
||||
|
||||
const mp_obj_module_t i2cdisplaybus_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)&i2cdisplaybus_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_i2cdisplaybus, i2cdisplaybus_module);
|
27
shared-bindings/i2cdisplaybus/__init__.h
Normal file
27
shared-bindings/i2cdisplaybus/__init__.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
@ -24,7 +24,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplaybus/ParallelBus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
//| :param microcontroller.Pin reset: Reset pin, optional
|
||||
//| :param int frequency: The communication frequency in Hz for the display on the bus"""
|
||||
//| ...
|
||||
STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
STATIC mp_obj_t paralleldisplaybus_parallelbus_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
enum { ARG_data0, ARG_data_pins, ARG_command, ARG_chip_select, ARG_write, ARG_read, ARG_reset, ARG_frequency };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_data0, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } },
|
||||
@ -90,8 +90,8 @@ STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type,
|
||||
const mcu_pin_obj_t *read = validate_obj_is_free_pin_or_none(args[ARG_read].u_obj, MP_QSTR_read);
|
||||
const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj, MP_QSTR_reset);
|
||||
|
||||
paralleldisplay_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus;
|
||||
self->base.type = ¶lleldisplay_parallelbus_type;
|
||||
paralleldisplaybus_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus;
|
||||
self->base.type = ¶lleldisplaybus_parallelbus_type;
|
||||
|
||||
bool specified_data0 = args[ARG_data0].u_obj != mp_const_none;
|
||||
bool specified_data_pins = args[ARG_data_pins].u_obj != mp_const_none;
|
||||
@ -102,12 +102,12 @@ STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type,
|
||||
|
||||
if (specified_data0) {
|
||||
const mcu_pin_obj_t *data0 = validate_obj_is_free_pin(args[ARG_data0].u_obj, MP_QSTR_data0);
|
||||
common_hal_paralleldisplay_parallelbus_construct(self, data0, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
|
||||
common_hal_paralleldisplaybus_parallelbus_construct(self, data0, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
|
||||
} else {
|
||||
uint8_t num_pins;
|
||||
const mcu_pin_obj_t *data_pins[16];
|
||||
validate_list_is_free_pins(MP_QSTR_data_pins, data_pins, (mp_int_t)MP_ARRAY_SIZE(data_pins), args[ARG_data_pins].u_obj, &num_pins);
|
||||
common_hal_paralleldisplay_parallelbus_construct_nonsequential(self, num_pins, data_pins, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
|
||||
common_hal_paralleldisplaybus_parallelbus_construct_nonsequential(self, num_pins, data_pins, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -117,22 +117,22 @@ STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type,
|
||||
//| is available."""
|
||||
//| ...
|
||||
|
||||
STATIC mp_obj_t paralleldisplay_parallelbus_obj_reset(mp_obj_t self_in) {
|
||||
paralleldisplay_parallelbus_obj_t *self = self_in;
|
||||
STATIC mp_obj_t paralleldisplaybus_parallelbus_obj_reset(mp_obj_t self_in) {
|
||||
paralleldisplaybus_parallelbus_obj_t *self = self_in;
|
||||
|
||||
if (!common_hal_paralleldisplay_parallelbus_reset(self)) {
|
||||
if (!common_hal_paralleldisplaybus_parallelbus_reset(self)) {
|
||||
mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset);
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(paralleldisplay_parallelbus_reset_obj, paralleldisplay_parallelbus_obj_reset);
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(paralleldisplaybus_parallelbus_reset_obj, paralleldisplaybus_parallelbus_obj_reset);
|
||||
|
||||
//| def send(self, command: int, data: ReadableBuffer) -> None:
|
||||
//| """Sends the given command value followed by the full set of data. Display state, such as
|
||||
//| vertical scroll, set via ``send`` may or may not be reset once the code is done."""
|
||||
//| ...
|
||||
//|
|
||||
STATIC mp_obj_t paralleldisplay_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
|
||||
STATIC mp_obj_t paralleldisplaybus_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
|
||||
mp_int_t command_int = mp_arg_validate_int_range(mp_obj_get_int(command_obj), 0, 255, MP_QSTR_command);
|
||||
|
||||
uint8_t command = command_int;
|
||||
@ -140,27 +140,27 @@ STATIC mp_obj_t paralleldisplay_parallelbus_obj_send(mp_obj_t self, mp_obj_t com
|
||||
mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ);
|
||||
|
||||
// Wait for display bus to be available.
|
||||
while (!common_hal_paralleldisplay_parallelbus_begin_transaction(self)) {
|
||||
while (!common_hal_paralleldisplaybus_parallelbus_begin_transaction(self)) {
|
||||
RUN_BACKGROUND_TASKS;
|
||||
}
|
||||
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, &command, 1);
|
||||
common_hal_paralleldisplay_parallelbus_send(self, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t *)bufinfo.buf), bufinfo.len);
|
||||
common_hal_paralleldisplay_parallelbus_end_transaction(self);
|
||||
common_hal_paralleldisplaybus_parallelbus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, &command, 1);
|
||||
common_hal_paralleldisplaybus_parallelbus_send(self, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t *)bufinfo.buf), bufinfo.len);
|
||||
common_hal_paralleldisplaybus_parallelbus_end_transaction(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_3(paralleldisplay_parallelbus_send_obj, paralleldisplay_parallelbus_obj_send);
|
||||
MP_DEFINE_CONST_FUN_OBJ_3(paralleldisplaybus_parallelbus_send_obj, paralleldisplaybus_parallelbus_obj_send);
|
||||
|
||||
STATIC const mp_rom_map_elem_t paralleldisplay_parallelbus_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(¶lleldisplay_parallelbus_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(¶lleldisplay_parallelbus_send_obj) },
|
||||
STATIC const mp_rom_map_elem_t paralleldisplaybus_parallelbus_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(¶lleldisplaybus_parallelbus_reset_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(¶lleldisplaybus_parallelbus_send_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(paralleldisplay_parallelbus_locals_dict, paralleldisplay_parallelbus_locals_dict_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(paralleldisplaybus_parallelbus_locals_dict, paralleldisplaybus_parallelbus_locals_dict_table);
|
||||
|
||||
MP_DEFINE_CONST_OBJ_TYPE(
|
||||
paralleldisplay_parallelbus_type,
|
||||
paralleldisplaybus_parallelbus_type,
|
||||
MP_QSTR_ParallelBus,
|
||||
MP_TYPE_FLAG_NONE,
|
||||
make_new, paralleldisplay_parallelbus_make_new,
|
||||
locals_dict, ¶lleldisplay_parallelbus_locals_dict
|
||||
make_new, paralleldisplaybus_parallelbus_make_new,
|
||||
locals_dict, ¶lleldisplaybus_parallelbus_locals_dict
|
||||
);
|
@ -26,30 +26,30 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common-hal/paralleldisplay/ParallelBus.h"
|
||||
#include "common-hal/paralleldisplaybus/ParallelBus.h"
|
||||
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
#include "shared-bindings/displayio/__init__.h"
|
||||
#include "shared-module/displayio/Group.h"
|
||||
|
||||
extern const mp_obj_type_t paralleldisplay_parallelbus_type;
|
||||
extern const mp_obj_type_t paralleldisplaybus_parallelbus_type;
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplaybus_parallelbus_construct(paralleldisplaybus_parallelbus_obj_t *self,
|
||||
const mcu_pin_obj_t *data0, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency);
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_construct_nonsequential(paralleldisplay_parallelbus_obj_t *self,
|
||||
void common_hal_paralleldisplaybus_parallelbus_construct_nonsequential(paralleldisplaybus_parallelbus_obj_t *self,
|
||||
uint8_t n_pins, const mcu_pin_obj_t **data_pins, const mcu_pin_obj_t *command, const mcu_pin_obj_t *chip_select,
|
||||
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency);
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self);
|
||||
void common_hal_paralleldisplaybus_parallelbus_deinit(paralleldisplaybus_parallelbus_obj_t *self);
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t self);
|
||||
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t self);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_reset(mp_obj_t self);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_bus_free(mp_obj_t self);
|
||||
|
||||
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t self);
|
||||
bool common_hal_paralleldisplaybus_parallelbus_begin_transaction(mp_obj_t self);
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
void common_hal_paralleldisplaybus_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type,
|
||||
display_chip_select_behavior_t chip_select, const uint8_t *data, uint32_t data_length);
|
||||
|
||||
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t self);
|
||||
void common_hal_paralleldisplaybus_parallelbus_end_transaction(mp_obj_t self);
|
@ -30,22 +30,25 @@
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/paralleldisplay/__init__.h"
|
||||
#include "shared-bindings/paralleldisplay/ParallelBus.h"
|
||||
#include "shared-bindings/paralleldisplaybus/__init__.h"
|
||||
#include "shared-bindings/paralleldisplaybus/ParallelBus.h"
|
||||
|
||||
//| """Native helpers for driving parallel displays"""
|
||||
|
||||
|
||||
STATIC const mp_rom_map_elem_t paralleldisplay_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_paralleldisplay) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(¶lleldisplay_parallelbus_type) },
|
||||
STATIC const mp_rom_map_elem_t paralleldisplaybus_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_paralleldisplaybus) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(¶lleldisplaybus_parallelbus_type) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(paralleldisplay_module_globals, paralleldisplay_module_globals_table);
|
||||
STATIC MP_DEFINE_CONST_DICT(paralleldisplaybus_module_globals, paralleldisplaybus_module_globals_table);
|
||||
|
||||
const mp_obj_module_t paralleldisplay_module = {
|
||||
const mp_obj_module_t paralleldisplaybus_module = {
|
||||
.base = { &mp_type_module },
|
||||
.globals = (mp_obj_dict_t *)¶lleldisplay_module_globals,
|
||||
.globals = (mp_obj_dict_t *)¶lleldisplaybus_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_paralleldisplay, paralleldisplay_module);
|
||||
MP_REGISTER_MODULE(MP_QSTR_paralleldisplaybus, paralleldisplaybus_module);
|
||||
|
||||
// Remove in CircuitPython 10
|
||||
MP_REGISTER_MODULE(MP_QSTR_paralleldisplay, paralleldisplaybus_module);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user