Add DotClockFramebuffer
This commit is contained in:
parent
17015b48ad
commit
ed9cacf41d
@ -1224,6 +1224,7 @@ msgid "Invalid %q"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ports/atmel-samd/common-hal/microcontroller/Pin.c
|
#: ports/atmel-samd/common-hal/microcontroller/Pin.c
|
||||||
|
#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c
|
||||||
#: ports/mimxrt10xx/common-hal/microcontroller/Pin.c
|
#: ports/mimxrt10xx/common-hal/microcontroller/Pin.c
|
||||||
#: shared-bindings/microcontroller/Pin.c
|
#: shared-bindings/microcontroller/Pin.c
|
||||||
msgid "Invalid %q pin"
|
msgid "Invalid %q pin"
|
||||||
@ -1378,6 +1379,10 @@ msgstr ""
|
|||||||
msgid "Must be a %q subclass."
|
msgid "Must be a %q subclass."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c
|
||||||
|
msgid "Must provide 5/6/5 RGB pins"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c
|
#: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c
|
||||||
msgid "Must provide MISO or MOSI pin"
|
msgid "Must provide MISO or MOSI pin"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -2948,7 +2953,7 @@ msgstr ""
|
|||||||
msgid "empty file"
|
msgid "empty file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c
|
#: extmod/moduasyncio.c extmod/moduheapq.c
|
||||||
msgid "empty heap"
|
msgid "empty heap"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -3899,10 +3904,6 @@ msgstr ""
|
|||||||
msgid "pull masks conflict with direction masks"
|
msgid "pull masks conflict with direction masks"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: extmod/modutimeq.c
|
|
||||||
msgid "queue overflow"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: py/parse.c
|
#: py/parse.c
|
||||||
msgid "raw f-strings are not supported"
|
msgid "raw f-strings are not supported"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -12,7 +12,11 @@ if("${CIRCUITPY_ESPCAMERA}")
|
|||||||
message("Including esp32-camera")
|
message("Including esp32-camera")
|
||||||
set(EXTRA_COMPONENT_DIRS "esp32-camera")
|
set(EXTRA_COMPONENT_DIRS "esp32-camera")
|
||||||
list(APPEND COMPONENTS "esp32-camera")
|
list(APPEND COMPONENTS "esp32-camera")
|
||||||
message("COMPONENTS = ${COMPONENTS}")
|
endif()
|
||||||
|
|
||||||
|
if("${CIRCUITPY_DOTCLOCKFRAMEBUFFER}")
|
||||||
|
message("Including esp32-camera")
|
||||||
|
list(APPEND COMPONENTS "esp_lcd")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
@ -257,6 +257,11 @@ ifneq ($(CIRCUITPY_BLEIO),0)
|
|||||||
SRC_C += common-hal/_bleio/ble_events.c
|
SRC_C += common-hal/_bleio/ble_events.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),0)
|
||||||
|
CFLAGS += -isystem esp-idf/components/esp_lcd/include
|
||||||
|
CFLAGS += -isystem esp-idf/components/esp_lcd/interface
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(CIRCUITPY_ESPCAMERA),0)
|
ifneq ($(CIRCUITPY_ESPCAMERA),0)
|
||||||
SRC_CAMERA := \
|
SRC_CAMERA := \
|
||||||
$(wildcard common-hal/espcamera/*.c) \
|
$(wildcard common-hal/espcamera/*.c) \
|
||||||
@ -355,7 +360,7 @@ endif
|
|||||||
do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h
|
do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h
|
||||||
QSTR_GLOBAL_REQUIREMENTS += $(BUILD)/esp-idf/config/sdkconfig.h
|
QSTR_GLOBAL_REQUIREMENTS += $(BUILD)/esp-idf/config/sdkconfig.h
|
||||||
$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf
|
$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf
|
||||||
IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA)
|
IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER)
|
||||||
|
|
||||||
# build a lib
|
# build a lib
|
||||||
# Adding -d explain -j 1 -v to the ninja line will output debug info
|
# Adding -d explain -j 1 -v to the ninja line will output debug info
|
||||||
@ -393,6 +398,9 @@ endif
|
|||||||
ifneq ($(CIRCUITPY_ESPULP),0)
|
ifneq ($(CIRCUITPY_ESPULP),0)
|
||||||
ESP_IDF_COMPONENTS_LINK += ulp
|
ESP_IDF_COMPONENTS_LINK += ulp
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),0)
|
||||||
|
ESP_IDF_COMPONENTS_LINK += esp_lcd
|
||||||
|
endif
|
||||||
|
|
||||||
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
|
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
|
||||||
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
USB_VID = 0x303A
|
||||||
|
USB_PID = 0x7003
|
||||||
|
USB_PRODUCT = "ESP32-S3-EV-LCD-Board"
|
||||||
|
USB_MANUFACTURER = "Espressif"
|
||||||
|
|
||||||
|
IDF_TARGET = esp32s3
|
||||||
|
|
||||||
|
CIRCUITPY_ESP_FLASH_MODE = dio
|
||||||
|
CIRCUITPY_ESP_FLASH_FREQ = 80m
|
||||||
|
CIRCUITPY_ESP_FLASH_SIZE = 16MB
|
||||||
|
|
||||||
|
CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1
|
||||||
|
UF2_BOOTLOADER = 0
|
@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Jeff Epler 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 "esp_intr_alloc.h"
|
||||||
|
#include "esp_lcd_panel_interface.h"
|
||||||
|
#include "esp_lcd_panel_rgb.h"
|
||||||
|
#include "esp_pm.h"
|
||||||
|
#include "esp_private/gdma.h"
|
||||||
|
#include "hal/dma_types.h"
|
||||||
|
#include "hal/lcd_hal.h"
|
||||||
|
#include "hal/lcd_ll.h"
|
||||||
|
#include "soc/lcd_periph.h"
|
||||||
|
|
||||||
|
// extract from esp-idf esp_lcd_rgb_panel.c
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
esp_lcd_panel_t base; // Base class of generic lcd panel
|
||||||
|
int panel_id; // LCD panel ID
|
||||||
|
lcd_hal_context_t hal; // Hal layer object
|
||||||
|
size_t data_width; // Number of data lines (e.g. for RGB565, the data width is 16)
|
||||||
|
size_t sram_trans_align; // Alignment for framebuffer that allocated in SRAM
|
||||||
|
size_t psram_trans_align; // Alignment for framebuffer that allocated in PSRAM
|
||||||
|
int disp_gpio_num; // Display control GPIO, which is used to perform action like "disp_off"
|
||||||
|
intr_handle_t intr; // LCD peripheral interrupt handle
|
||||||
|
esp_pm_lock_handle_t pm_lock; // Power management lock
|
||||||
|
size_t num_dma_nodes; // Number of DMA descriptors that used to carry the frame buffer
|
||||||
|
uint8_t *fb; // Frame buffer
|
||||||
|
size_t fb_size; // Size of frame buffer
|
||||||
|
int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; // GPIOs used for data lines, we keep these GPIOs for action like "invert_color"
|
||||||
|
size_t resolution_hz; // Peripheral clock resolution
|
||||||
|
esp_lcd_rgb_timing_t timings; // RGB timing parameters (e.g. pclk, sync pulse, porch width)
|
||||||
|
gdma_channel_handle_t dma_chan; // DMA channel handle
|
||||||
|
esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; // Callback, invoked after frame trans done
|
||||||
|
void *user_ctx; // Reserved user's data of callback functions
|
||||||
|
int x_gap; // Extra gap in x coordinate, it's used when calculate the flush window
|
||||||
|
int y_gap; // Extra gap in y coordinate, it's used when calculate the flush window
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned int disp_en_level : 1; // The level which can turn on the screen by `disp_gpio_num`
|
||||||
|
unsigned int stream_mode : 1; // If set, the LCD transfers data continuously, otherwise, it stops refreshing the LCD when transaction done
|
||||||
|
unsigned int fb_in_psram : 1; // Whether the frame buffer is in PSRAM
|
||||||
|
} flags;
|
||||||
|
dma_descriptor_t dma_nodes[]; // DMA descriptor pool of size `num_dma_nodes`
|
||||||
|
} esp_rgb_panel_t;
|
||||||
|
|
||||||
|
|
||||||
|
#include "esp_log.h"
|
||||||
|
#define TAG "LCD"
|
||||||
|
|
||||||
|
#include "components/esp_rom/include/esp_rom_sys.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "py/objarray.h"
|
||||||
|
#include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h"
|
||||||
|
#include "common-hal/dotclockframebuffer/DotClockFramebuffer.h"
|
||||||
|
#include "bindings/espidf/__init__.h"
|
||||||
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
|
#include "components/driver/include/driver/gpio.h"
|
||||||
|
#include "components/driver/include/driver/periph_ctrl.h"
|
||||||
|
#include "components/driver/include/esp_private/gdma.h"
|
||||||
|
#include "components/esp_rom/include/esp_rom_gpio.h"
|
||||||
|
#include "components/hal/esp32s3/include/hal/lcd_ll.h"
|
||||||
|
#include "components/hal/include/hal/gpio_hal.h"
|
||||||
|
#include "components/soc/esp32s3/include/soc/lcd_cam_struct.h"
|
||||||
|
#include "esp_heap_caps.h"
|
||||||
|
|
||||||
|
// should be from rom/cache.h but it wasn't working
|
||||||
|
int Cache_WriteBack_Addr(uint32_t addr, uint32_t size);
|
||||||
|
|
||||||
|
#define LCD_RGB_ISR_IRAM_SAFE (1)
|
||||||
|
#define LCD_RGB_INTR_ALLOC_FLAGS (ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_INTRDISABLED)
|
||||||
|
|
||||||
|
#define common_hal_mcu_pin_number_maybe(x) ((x) ? common_hal_mcu_pin_number((x)) : -1)
|
||||||
|
|
||||||
|
static void claim_and_record(const mcu_pin_obj_t *pin, uint64_t *used_pins_mask) {
|
||||||
|
if (pin) {
|
||||||
|
int number = common_hal_mcu_pin_number(pin);
|
||||||
|
*used_pins_mask |= (UINT64_C(1) << number);
|
||||||
|
claim_pin_number(number);
|
||||||
|
never_reset_pin_number(number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int valid_pin(const mcu_pin_obj_t *pin, qstr name) {
|
||||||
|
int result = common_hal_mcu_pin_number(pin);
|
||||||
|
if (result == NO_PIN) {
|
||||||
|
mp_raise_ValueError_varg(translate("Invalid %q pin"), name);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_framebuffer_obj_t *self,
|
||||||
|
const mcu_pin_obj_t *de,
|
||||||
|
const mcu_pin_obj_t *vsync,
|
||||||
|
const mcu_pin_obj_t *hsync,
|
||||||
|
const mcu_pin_obj_t *dclk,
|
||||||
|
const mcu_pin_obj_t **red, uint8_t num_red,
|
||||||
|
const mcu_pin_obj_t **green, uint8_t num_green,
|
||||||
|
const mcu_pin_obj_t **blue, uint8_t num_blue,
|
||||||
|
int frequency, int width, int height,
|
||||||
|
int hsync_pulse_width, int hsync_back_porch, int hsync_front_porch, bool hsync_idle_low,
|
||||||
|
int vsync_pulse_width, int vsync_back_porch, int vsync_front_porch, bool vsync_idle_low,
|
||||||
|
bool de_idle_high, bool pclk_active_high, bool pclk_idle_high) {
|
||||||
|
|
||||||
|
if (num_red != 5 || num_green != 6 || num_blue != 5) {
|
||||||
|
mp_raise_ValueError(translate("Must provide 5/6/5 RGB pins"));
|
||||||
|
}
|
||||||
|
|
||||||
|
claim_and_record(de, &self->used_pins_mask);
|
||||||
|
claim_and_record(vsync, &self->used_pins_mask);
|
||||||
|
claim_and_record(hsync, &self->used_pins_mask);
|
||||||
|
claim_and_record(dclk, &self->used_pins_mask);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < num_red; i++) {
|
||||||
|
claim_and_record(red[i], &self->used_pins_mask);
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < num_green; i++) {
|
||||||
|
claim_and_record(green[i], &self->used_pins_mask);
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < num_blue; i++) {
|
||||||
|
claim_and_record(blue[i], &self->used_pins_mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_lcd_rgb_panel_config_t *cfg = &self->panel_config;
|
||||||
|
cfg->timings.pclk_hz = frequency;
|
||||||
|
cfg->timings.h_res = width;
|
||||||
|
cfg->timings.v_res = height;
|
||||||
|
cfg->timings.hsync_pulse_width = hsync_pulse_width;
|
||||||
|
cfg->timings.hsync_back_porch = hsync_back_porch;
|
||||||
|
cfg->timings.hsync_front_porch = hsync_front_porch;
|
||||||
|
cfg->timings.vsync_pulse_width = vsync_pulse_width;
|
||||||
|
cfg->timings.vsync_back_porch = vsync_back_porch;
|
||||||
|
cfg->timings.vsync_front_porch = vsync_front_porch;
|
||||||
|
cfg->timings.flags.hsync_idle_low = hsync_idle_low;
|
||||||
|
cfg->timings.flags.vsync_idle_low = hsync_idle_low;
|
||||||
|
cfg->timings.flags.de_idle_high = de_idle_high;
|
||||||
|
cfg->timings.flags.pclk_active_neg = !pclk_active_high;
|
||||||
|
cfg->timings.flags.pclk_idle_high = pclk_idle_high;
|
||||||
|
|
||||||
|
cfg->data_width = 16;
|
||||||
|
cfg->sram_trans_align = 8;
|
||||||
|
cfg->psram_trans_align = 64;
|
||||||
|
cfg->hsync_gpio_num = valid_pin(hsync, MP_QSTR_hsync);
|
||||||
|
cfg->vsync_gpio_num = valid_pin(vsync, MP_QSTR_vsync);
|
||||||
|
cfg->de_gpio_num = valid_pin(de, MP_QSTR_de);
|
||||||
|
cfg->pclk_gpio_num = valid_pin(dclk, MP_QSTR_dclk);
|
||||||
|
|
||||||
|
cfg->data_gpio_nums[0] = valid_pin(blue[0], MP_QSTR_blue);
|
||||||
|
cfg->data_gpio_nums[1] = valid_pin(blue[1], MP_QSTR_blue);
|
||||||
|
cfg->data_gpio_nums[2] = valid_pin(blue[2], MP_QSTR_blue);
|
||||||
|
cfg->data_gpio_nums[3] = valid_pin(blue[3], MP_QSTR_blue);
|
||||||
|
cfg->data_gpio_nums[4] = valid_pin(blue[4], MP_QSTR_blue);
|
||||||
|
|
||||||
|
cfg->data_gpio_nums[5] = valid_pin(green[0], MP_QSTR_green);
|
||||||
|
cfg->data_gpio_nums[6] = valid_pin(green[1], MP_QSTR_green);
|
||||||
|
cfg->data_gpio_nums[7] = valid_pin(green[2], MP_QSTR_green);
|
||||||
|
cfg->data_gpio_nums[8] = valid_pin(green[3], MP_QSTR_green);
|
||||||
|
cfg->data_gpio_nums[9] = valid_pin(green[4], MP_QSTR_green);
|
||||||
|
cfg->data_gpio_nums[10] = valid_pin(green[5], MP_QSTR_green);
|
||||||
|
|
||||||
|
cfg->data_gpio_nums[11] = valid_pin(red[0], MP_QSTR_red);
|
||||||
|
cfg->data_gpio_nums[12] = valid_pin(red[1], MP_QSTR_red);
|
||||||
|
cfg->data_gpio_nums[13] = valid_pin(red[2], MP_QSTR_red);
|
||||||
|
cfg->data_gpio_nums[14] = valid_pin(red[3], MP_QSTR_red);
|
||||||
|
cfg->data_gpio_nums[15] = valid_pin(red[4], MP_QSTR_red);
|
||||||
|
|
||||||
|
cfg->disp_gpio_num = GPIO_NUM_NC;
|
||||||
|
|
||||||
|
cfg->flags.disp_active_low = 0;
|
||||||
|
cfg->flags.relax_on_idle = 0;
|
||||||
|
cfg->flags.fb_in_psram = 1; // allocate frame buffer in PSRAM
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(esp_lcd_new_rgb_panel(&self->panel_config, &self->panel_handle));
|
||||||
|
ESP_ERROR_CHECK(esp_lcd_panel_reset(self->panel_handle));
|
||||||
|
ESP_ERROR_CHECK(esp_lcd_panel_init(self->panel_handle));
|
||||||
|
|
||||||
|
uint16_t color = 0;
|
||||||
|
ESP_ERROR_CHECK(self->panel_handle->draw_bitmap(self->panel_handle, 0, 0, 1, 1, &color));
|
||||||
|
|
||||||
|
esp_rgb_panel_t *_rgb_panel = __containerof(self->panel_handle, esp_rgb_panel_t, base);
|
||||||
|
|
||||||
|
self->frequency = frequency;
|
||||||
|
self->refresh_rate = frequency / (width + hsync_front_porch + hsync_back_porch) / (height + vsync_front_porch + vsync_back_porch);
|
||||||
|
self->bufinfo.buf = _rgb_panel->fb;
|
||||||
|
self->bufinfo.len = 2 * width * height;
|
||||||
|
self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW;
|
||||||
|
|
||||||
|
memset(self->bufinfo.buf, 0xaa, width * height);
|
||||||
|
memset(self->bufinfo.buf + width * height, 0x55, width * height);
|
||||||
|
|
||||||
|
// LCD_CAM.lcd_ctrl2.lcd_vsync_idle_pol = _vsync_polarity;
|
||||||
|
// LCD_CAM.lcd_ctrl2.lcd_hsync_idle_pol = _hsync_polarity;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void common_hal_dotclockframebuffer_framebuffer_deinit(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
if (common_hal_dotclockframebuffer_framebuffer_deinitialized(self)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_pin_mask(self->used_pins_mask);
|
||||||
|
self->used_pins_mask = 0;
|
||||||
|
esp_lcd_panel_del(self->panel_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool common_hal_dotclockframebuffer_framebuffer_deinitialized(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
return self->used_pins_mask == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_width(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
return self->panel_config.timings.h_res;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_height(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
return self->panel_config.timings.v_res;
|
||||||
|
}
|
||||||
|
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_frequency(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
return self->frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
void common_hal_dotclockframebuffer_framebuffer_refresh(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
Cache_WriteBack_Addr((uint32_t)(self->bufinfo.buf), self->bufinfo.len);
|
||||||
|
}
|
||||||
|
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
return self->refresh_rate;
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the MicroPython project, http://micropython.org/
|
||||||
|
*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 Jeff Epler 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
|
||||||
|
|
||||||
|
#include "py/obj.h"
|
||||||
|
|
||||||
|
#include "esp_lcd_panel_io.h"
|
||||||
|
#include "esp_lcd_panel_rgb.h"
|
||||||
|
#include "esp_lcd_panel_vendor.h"
|
||||||
|
#include "esp_lcd_panel_ops.h"
|
||||||
|
#include "esp_lcd_panel_interface.h"
|
||||||
|
|
||||||
|
typedef struct dotclockframebuffer_framebuffer_obj {
|
||||||
|
mp_obj_base_t base;
|
||||||
|
mp_buffer_info_t bufinfo;
|
||||||
|
uint32_t frequency, refresh_rate;
|
||||||
|
uint64_t used_pins_mask;
|
||||||
|
volatile int32_t frame_count;
|
||||||
|
esp_lcd_rgb_panel_config_t panel_config;
|
||||||
|
esp_lcd_panel_handle_t panel_handle;
|
||||||
|
} dotclockframebuffer_framebuffer_obj_t;
|
@ -218,6 +218,14 @@ void reset_pin_number(gpio_num_t pin_number) {
|
|||||||
_reset_pin(pin_number);
|
_reset_pin(pin_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset_pin_mask(uint64_t mask) {
|
||||||
|
for (int i = 0; i < 64; i++, mask >>= 1) {
|
||||||
|
if (mask & 1) {
|
||||||
|
reset_pin_number(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void common_hal_mcu_pin_reset_number(uint8_t i) {
|
void common_hal_mcu_pin_reset_number(uint8_t i) {
|
||||||
reset_pin_number((gpio_num_t)i);
|
reset_pin_number((gpio_num_t)i);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ extern void reset_all_pins(void);
|
|||||||
// reset_pin_number takes the pin number instead of the pointer so that objects don't
|
// reset_pin_number takes the pin number instead of the pointer so that objects don't
|
||||||
// need to store a full pointer.
|
// need to store a full pointer.
|
||||||
extern void reset_pin_number(gpio_num_t pin_number);
|
extern void reset_pin_number(gpio_num_t pin_number);
|
||||||
|
// reset all pins in `bitmask`
|
||||||
|
extern void reset_pin_mask(uint64_t bitmask);
|
||||||
extern void skip_reset_once_pin_number(gpio_num_t pin_number);
|
extern void skip_reset_once_pin_number(gpio_num_t pin_number);
|
||||||
extern void claim_pin(const mcu_pin_obj_t *pin);
|
extern void claim_pin(const mcu_pin_obj_t *pin);
|
||||||
extern void claim_pin_number(gpio_num_t pin_number);
|
extern void claim_pin_number(gpio_num_t pin_number);
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 630c2724fc8c69eeaaa1bb025de52b99c5cb11aa
|
Subproject commit 69f9a4f566d49afe97fd8b47444bd394af005e23
|
@ -21,6 +21,7 @@ CIRCUITPY_BLEIO ?= 1
|
|||||||
CIRCUITPY_BLEIO_HCI = 0
|
CIRCUITPY_BLEIO_HCI = 0
|
||||||
CIRCUITPY_CANIO ?= 1
|
CIRCUITPY_CANIO ?= 1
|
||||||
CIRCUITPY_COUNTIO ?= 1
|
CIRCUITPY_COUNTIO ?= 1
|
||||||
|
CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION = 0
|
||||||
CIRCUITPY_DUALBANK ?= 1
|
CIRCUITPY_DUALBANK ?= 1
|
||||||
CIRCUITPY_ESPCAMERA ?= 1
|
CIRCUITPY_ESPCAMERA ?= 1
|
||||||
CIRCUITPY_ESPIDF ?= 1
|
CIRCUITPY_ESPIDF ?= 1
|
||||||
|
@ -25,12 +25,15 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "supervisor/board.h"
|
#include "supervisor/board.h"
|
||||||
#include "supervisor/port.h"
|
#include "supervisor/port.h"
|
||||||
#include "supervisor/filesystem.h"
|
#include "supervisor/filesystem.h"
|
||||||
#include "supervisor/shared/reload.h"
|
#include "supervisor/shared/reload.h"
|
||||||
|
#include "supervisor/serial.h"
|
||||||
|
#include "py/mpprint.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
@ -537,6 +540,17 @@ void port_post_boot_py(bool heap_valid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int vprintf_adapter(const char *fmt, va_list ap) {
|
||||||
|
return mp_vprintf(&mp_plat_print, fmt, ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if CIRCUITPY_CONSOLE_UART
|
||||||
|
void port_serial_early_init(void) {
|
||||||
|
esp_log_set_vprintf(vprintf_adapter);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Wrap main in app_main that the IDF expects.
|
// Wrap main in app_main that the IDF expects.
|
||||||
extern void main(void);
|
extern void main(void);
|
||||||
extern void app_main(void);
|
extern void app_main(void);
|
||||||
|
@ -296,6 +296,9 @@ endif
|
|||||||
ifeq ($(CIRCUITPY_RGBMATRIX),1)
|
ifeq ($(CIRCUITPY_RGBMATRIX),1)
|
||||||
SRC_PATTERNS += rgbmatrix/%
|
SRC_PATTERNS += rgbmatrix/%
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),1)
|
||||||
|
SRC_PATTERNS += dotclockframebuffer/%
|
||||||
|
endif
|
||||||
ifeq ($(CIRCUITPY_RP2PIO),1)
|
ifeq ($(CIRCUITPY_RP2PIO),1)
|
||||||
SRC_PATTERNS += rp2pio/%
|
SRC_PATTERNS += rp2pio/%
|
||||||
endif
|
endif
|
||||||
@ -435,6 +438,8 @@ SRC_COMMON_HAL_ALL = \
|
|||||||
countio/__init__.c \
|
countio/__init__.c \
|
||||||
digitalio/DigitalInOut.c \
|
digitalio/DigitalInOut.c \
|
||||||
digitalio/__init__.c \
|
digitalio/__init__.c \
|
||||||
|
dotclockframebuffer/DotClockFramebuffer.c \
|
||||||
|
dotclockframebuffer/__init__.c \
|
||||||
dualbank/__init__.c \
|
dualbank/__init__.c \
|
||||||
frequencyio/FrequencyIn.c \
|
frequencyio/FrequencyIn.c \
|
||||||
frequencyio/__init__.c \
|
frequencyio/__init__.c \
|
||||||
|
@ -206,6 +206,11 @@ CIRCUITPY_PARALLELDISPLAY = 0
|
|||||||
endif
|
endif
|
||||||
CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY)
|
CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY)
|
||||||
|
|
||||||
|
CIRCUITPY_DOTCLOCKFRAMEBUFFER ?= 0
|
||||||
|
CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER)
|
||||||
|
CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION ?= 1
|
||||||
|
CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION)
|
||||||
|
|
||||||
# bitmaptools and framebufferio rely on displayio
|
# bitmaptools and framebufferio rely on displayio
|
||||||
CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
|
CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
|
||||||
CIRCUITPY_FRAMEBUFFERIO ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
|
CIRCUITPY_FRAMEBUFFERIO ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO))
|
||||||
|
338
shared-bindings/dotclockframebuffer/DotClockFramebuffer.c
Normal file
338
shared-bindings/dotclockframebuffer/DotClockFramebuffer.c
Normal file
@ -0,0 +1,338 @@
|
|||||||
|
/*
|
||||||
|
* 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/dotclockframebuffer/DotClockFramebuffer.h"
|
||||||
|
|
||||||
|
#include "py/binary.h"
|
||||||
|
#include "py/objarray.h"
|
||||||
|
#include "py/objproperty.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
|
#include "shared-bindings/util.h"
|
||||||
|
#include "shared-module/displayio/__init__.h"
|
||||||
|
#include "supervisor/shared/translate/translate.h"
|
||||||
|
|
||||||
|
//| class DotClockFramebuffer:
|
||||||
|
//| """Manage updating a 'dot-clock' framebuffer in the background while Python code runs.
|
||||||
|
//| It doesn't handle display initialization."""
|
||||||
|
//|
|
||||||
|
//| def __init__(
|
||||||
|
//| self,
|
||||||
|
//| *,
|
||||||
|
//| de: microcontroller.Pin,
|
||||||
|
//| vsync: microcontroller.Pin,
|
||||||
|
//| hsync: microcontroller.Pin,
|
||||||
|
//| dclk: microcontroller.Pin,
|
||||||
|
//| red: Tuple[microcontroller.Pin],
|
||||||
|
//| green: Tuple[microcontroller.Pin],
|
||||||
|
//| blue: Tuple[microcontroller.Pin],
|
||||||
|
//| frequency: int,
|
||||||
|
//| width: int,
|
||||||
|
//| height: int,
|
||||||
|
//| hsync_pulse_width: int,
|
||||||
|
//| hsync_back_porch: int,
|
||||||
|
//| hsync_front_porch: int,
|
||||||
|
//| hsync_idle_low: bool,
|
||||||
|
//| vsync_back_porch: int,
|
||||||
|
//| vsync_front_porch: int,
|
||||||
|
//| vsync_idle_low: bool,
|
||||||
|
//| de_idle_high: bool,
|
||||||
|
//| pclk_active_high: bool,
|
||||||
|
//| pclk_idle_high: bool,
|
||||||
|
//| ) -> None:
|
||||||
|
//| """Create a DotClockFramebuffer object associated with the given pins.
|
||||||
|
//|
|
||||||
|
//| The 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 is done.) So, the first time you initialize a display bus in code.py you should call
|
||||||
|
//| :py:func:`displayio.release_displays` first, otherwise it will error after the first code.py run.
|
||||||
|
//|
|
||||||
|
//| When a board has dedicated dot clock framebuffer pins and/or timings, they are intended to be used in the constructor with ``**`` dictionary unpacking like so:
|
||||||
|
//| ``DotClockFramebuffer(**board.TFT_PINS, **board.TFT_TIMINGS)``
|
||||||
|
//|
|
||||||
|
//| On Espressif-family microcontrollers, this driver requires that the
|
||||||
|
//| ``CIRCUITPY_RESERVED_PSRAM`` in ``settings.toml`` be large enough to hold the
|
||||||
|
//| framebuffer. Generally, boards with built-in displays or display connectors
|
||||||
|
//| will have a default setting that is large enough for typical use. If the
|
||||||
|
//| constructor raises a MemoryError or an IDFError, this probably indicates the
|
||||||
|
//| setting is too small and should be increased.
|
||||||
|
//|
|
||||||
|
//| TFT connection parameters:
|
||||||
|
//|
|
||||||
|
//| :param microcontroller.Pin de: The "data enable" input to the display
|
||||||
|
//| :param microcontroller.Pin vsync: The "vertical sync" input to the display
|
||||||
|
//| :param microcontroller.Pin hsync: The "horizontal sync" input to the display
|
||||||
|
//| :param microcontroller.Pin dclk: The "data clock" input to the display
|
||||||
|
//| :param ~tuple red: The red data pins, most significant pin first.
|
||||||
|
//| :param ~tuple green: The green data pins, most significant pin first.
|
||||||
|
//| :param ~tuple blue: The blue data pins, most significant pin first.
|
||||||
|
//|
|
||||||
|
//| TFT timing parameters:
|
||||||
|
//|
|
||||||
|
//| :param int frequency: The requested data clock frequency in Hz.
|
||||||
|
//| :param int width: The visible width of the display, in pixels
|
||||||
|
//| :param int height: The visible height of the display, in pixels
|
||||||
|
//| :param int hsync_pulse_width: Horizontal sync width in pixels
|
||||||
|
//| :param int hsync_back_porch: Horizontal back porch, number of pixels between hsync and start of line active data
|
||||||
|
//| :param int hsync_front_porch: Horizontal front porch, number of pixels between the end of active data and the next hsync
|
||||||
|
//| :param int vsync_back_porch: Vertical back porch, number of lines between vsync and start of frame
|
||||||
|
//| :param int vsync_front_porch: Vertical front porch, number of lines between the end of frame and the next vsync
|
||||||
|
//| :param bool hsync_idle_low: True if the hsync signal is low in IDLE state
|
||||||
|
//| :param bool vsync_idle_low: True if the vsync signal is low in IDLE state
|
||||||
|
//| :param bool de_idle_high: True if the de signal is high in IDLE state
|
||||||
|
//| :param bool pclk_active_high: True if the display data is clocked out at the rising edge of dclk
|
||||||
|
//| :param bool pclk_idle_high: True if the dclk stays at high level in IDLE phase
|
||||||
|
//| """
|
||||||
|
//| ...
|
||||||
|
STATIC mp_obj_t dotclockframebuffer_framebuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||||
|
enum { ARG_de, ARG_vsync, ARG_hsync, ARG_dclk, ARG_red, ARG_green, ARG_blue,
|
||||||
|
ARG_frequency, ARG_width, ARG_height,
|
||||||
|
ARG_hsync_pulse_width, ARG_hsync_back_porch, ARG_hsync_front_porch, ARG_hsync_idle_low,
|
||||||
|
ARG_vsync_pulse_width, ARG_vsync_back_porch, ARG_vsync_front_porch, ARG_vsync_idle_low,
|
||||||
|
ARG_de_idle_high, ARG_pclk_active_high, ARG_pclk_idle_high, };
|
||||||
|
|
||||||
|
static const mp_arg_t allowed_args[] = {
|
||||||
|
{ MP_QSTR_de, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } },
|
||||||
|
{ MP_QSTR_vsync, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } },
|
||||||
|
{ MP_QSTR_hsync, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } },
|
||||||
|
{ MP_QSTR_dclk, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } },
|
||||||
|
{ MP_QSTR_red, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } },
|
||||||
|
{ MP_QSTR_green, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } },
|
||||||
|
{ MP_QSTR_blue, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } },
|
||||||
|
|
||||||
|
{ MP_QSTR_frequency, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
|
||||||
|
{ MP_QSTR_hsync_pulse_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_hsync_back_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_hsync_front_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_hsync_idle_low, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } },
|
||||||
|
|
||||||
|
{ MP_QSTR_vsync_pulse_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_vsync_back_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_vsync_front_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } },
|
||||||
|
{ MP_QSTR_vsync_idle_low, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } },
|
||||||
|
|
||||||
|
{ MP_QSTR_de_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } },
|
||||||
|
{ MP_QSTR_pclk_active_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } },
|
||||||
|
{ MP_QSTR_pclk_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.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);
|
||||||
|
|
||||||
|
const mcu_pin_obj_t *de = validate_obj_is_free_pin(args[ARG_de].u_obj, MP_QSTR_de);
|
||||||
|
const mcu_pin_obj_t *vsync = validate_obj_is_free_pin(args[ARG_vsync].u_obj, MP_QSTR_vsync);
|
||||||
|
const mcu_pin_obj_t *hsync = validate_obj_is_free_pin(args[ARG_hsync].u_obj, MP_QSTR_hsync);
|
||||||
|
const mcu_pin_obj_t *dclk = validate_obj_is_free_pin(args[ARG_dclk].u_obj, MP_QSTR_dclk);
|
||||||
|
|
||||||
|
uint8_t num_red, num_green, num_blue;
|
||||||
|
const mcu_pin_obj_t *red_pins[8], *green_pins[8], *blue_pins[8];
|
||||||
|
|
||||||
|
validate_list_is_free_pins(MP_QSTR_red, red_pins, (mp_int_t)MP_ARRAY_SIZE(red_pins), args[ARG_red].u_obj, &num_red);
|
||||||
|
validate_list_is_free_pins(MP_QSTR_green, green_pins, (mp_int_t)MP_ARRAY_SIZE(green_pins), args[ARG_green].u_obj, &num_green);
|
||||||
|
validate_list_is_free_pins(MP_QSTR_blue, blue_pins, (mp_int_t)MP_ARRAY_SIZE(blue_pins), args[ARG_blue].u_obj, &num_blue);
|
||||||
|
|
||||||
|
mp_printf(&mp_plat_print, "#red=%d #green=%d #blue=%d\n", num_red, num_green, num_blue);
|
||||||
|
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = &allocate_display_bus_or_raise()->dotclock;
|
||||||
|
self->base.type = &dotclockframebuffer_framebuffer_type;
|
||||||
|
|
||||||
|
common_hal_dotclockframebuffer_framebuffer_construct(
|
||||||
|
self, de, vsync, hsync, dclk, red_pins, num_red, green_pins, num_green, blue_pins, num_blue,
|
||||||
|
args[ARG_frequency].u_int, args[ARG_width].u_int, args[ARG_height].u_int,
|
||||||
|
args[ARG_hsync_pulse_width].u_int, args[ARG_hsync_back_porch].u_int, args[ARG_hsync_front_porch].u_int, args[ARG_hsync_idle_low].u_bool,
|
||||||
|
args[ARG_vsync_pulse_width].u_int, args[ARG_vsync_back_porch].u_int, args[ARG_vsync_front_porch].u_int, args[ARG_vsync_idle_low].u_bool,
|
||||||
|
args[ARG_de_idle_high].u_bool,
|
||||||
|
args[ARG_pclk_active_high].u_bool,
|
||||||
|
args[ARG_pclk_idle_high].u_bool
|
||||||
|
);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void check_for_deinit(dotclockframebuffer_framebuffer_obj_t *self) {
|
||||||
|
if (common_hal_dotclockframebuffer_framebuffer_deinitialized(self)) {
|
||||||
|
raise_deinited_error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//| def refresh(self) -> None:
|
||||||
|
//| """Transmits the color data in the buffer to the pixels so that
|
||||||
|
//| they are shown.
|
||||||
|
//|
|
||||||
|
//| If this function is not called, the results are unpredictable; updates may be partially shown.
|
||||||
|
//| """
|
||||||
|
//| ...
|
||||||
|
STATIC mp_obj_t dotclockframebuffer_framebuffer_refresh(mp_obj_t self_in) {
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
check_for_deinit(self);
|
||||||
|
common_hal_dotclockframebuffer_framebuffer_refresh(self);
|
||||||
|
return mp_const_none;
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_refresh_obj, dotclockframebuffer_framebuffer_refresh);
|
||||||
|
|
||||||
|
|
||||||
|
//| refresh_rate: float
|
||||||
|
//| """The pixel refresh rate of the display, in Hz"""
|
||||||
|
STATIC mp_obj_t dotclockframebuffer_framebuffer_get_refresh_rate(mp_obj_t self_in) {
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
check_for_deinit(self);
|
||||||
|
return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(self));
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_refresh_rate_obj, dotclockframebuffer_framebuffer_get_refresh_rate);
|
||||||
|
MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_refresh_rate_obj,
|
||||||
|
(mp_obj_t)&dotclockframebuffer_framebuffer_get_refresh_rate_obj);
|
||||||
|
|
||||||
|
//| frequency: int
|
||||||
|
//| """The pixel frequency of the display, in Hz"""
|
||||||
|
STATIC mp_obj_t dotclockframebuffer_framebuffer_get_frequency(mp_obj_t self_in) {
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
check_for_deinit(self);
|
||||||
|
return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_frequency(self));
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_frequency_obj, dotclockframebuffer_framebuffer_get_frequency);
|
||||||
|
MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_frequency_obj,
|
||||||
|
(mp_obj_t)&dotclockframebuffer_framebuffer_get_frequency_obj);
|
||||||
|
|
||||||
|
//| width: int
|
||||||
|
//| """The width of the display, in pixels"""
|
||||||
|
STATIC mp_obj_t dotclockframebuffer_framebuffer_get_width(mp_obj_t self_in) {
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
check_for_deinit(self);
|
||||||
|
return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_width(self));
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_width_obj, dotclockframebuffer_framebuffer_get_width);
|
||||||
|
MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_width_obj,
|
||||||
|
(mp_obj_t)&dotclockframebuffer_framebuffer_get_width_obj);
|
||||||
|
|
||||||
|
//| height: int
|
||||||
|
//| """The height of the display, in pixels"""
|
||||||
|
//|
|
||||||
|
STATIC mp_obj_t dotclockframebuffer_framebuffer_get_height(mp_obj_t self_in) {
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
check_for_deinit(self);
|
||||||
|
return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_height(self));
|
||||||
|
}
|
||||||
|
MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_height_obj, dotclockframebuffer_framebuffer_get_height);
|
||||||
|
|
||||||
|
MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_height_obj,
|
||||||
|
(mp_obj_t)&dotclockframebuffer_framebuffer_get_height_obj);
|
||||||
|
|
||||||
|
STATIC mp_int_t dotclockframebuffer_framebuffer_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
// a readonly framebuffer would be unusual but not impossible
|
||||||
|
if ((flags & MP_BUFFER_WRITE) && !(self->bufinfo.typecode & MP_OBJ_ARRAY_TYPECODE_FLAG_RW)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
*bufinfo = self->bufinfo;
|
||||||
|
bufinfo->typecode = 'H';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// These version exists so that the prototype matches the protocol,
|
||||||
|
// avoiding a type cast that can hide errors
|
||||||
|
STATIC void dotclockframebuffer_framebuffer_swapbuffers(mp_obj_t self_in, uint8_t *dirty_row_bitmap) {
|
||||||
|
(void)dirty_row_bitmap;
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
common_hal_dotclockframebuffer_framebuffer_refresh(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC void dotclockframebuffer_framebuffer_deinit_proto(mp_obj_t self_in) {
|
||||||
|
common_hal_dotclockframebuffer_framebuffer_deinit(self_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC float dotclockframebuffer_framebuffer_get_brightness_proto(mp_obj_t self_in) {
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC bool dotclockframebuffer_framebuffer_set_brightness_proto(mp_obj_t self_in, mp_float_t value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC int dotclockframebuffer_framebuffer_get_width_proto(mp_obj_t self_in) {
|
||||||
|
return common_hal_dotclockframebuffer_framebuffer_get_width(self_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC int dotclockframebuffer_framebuffer_get_height_proto(mp_obj_t self_in) {
|
||||||
|
return common_hal_dotclockframebuffer_framebuffer_get_height(self_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC int dotclockframebuffer_framebuffer_get_color_depth_proto(mp_obj_t self_in) {
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC int dotclockframebuffer_framebuffer_get_bytes_per_cell_proto(mp_obj_t self_in) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC int dotclockframebuffer_framebuffer_get_native_frames_per_second_proto(mp_obj_t self_in) {
|
||||||
|
return common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(self_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC void dotclockframebuffer_framebuffer_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) {
|
||||||
|
dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in;
|
||||||
|
|
||||||
|
*bufinfo = self->bufinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = {
|
||||||
|
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_framebuffer)
|
||||||
|
.get_bufinfo = dotclockframebuffer_framebuffer_get_bufinfo,
|
||||||
|
.set_brightness = dotclockframebuffer_framebuffer_set_brightness_proto,
|
||||||
|
.get_brightness = dotclockframebuffer_framebuffer_get_brightness_proto,
|
||||||
|
.get_width = dotclockframebuffer_framebuffer_get_width_proto,
|
||||||
|
.get_height = dotclockframebuffer_framebuffer_get_height_proto,
|
||||||
|
.get_color_depth = dotclockframebuffer_framebuffer_get_color_depth_proto,
|
||||||
|
.get_bytes_per_cell = dotclockframebuffer_framebuffer_get_bytes_per_cell_proto,
|
||||||
|
.get_native_frames_per_second = dotclockframebuffer_framebuffer_get_native_frames_per_second_proto,
|
||||||
|
.swapbuffers = dotclockframebuffer_framebuffer_swapbuffers,
|
||||||
|
.deinit = dotclockframebuffer_framebuffer_deinit_proto,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
STATIC const mp_rom_map_elem_t dotclockframebuffer_framebuffer_locals_dict_table[] = {
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&dotclockframebuffer_framebuffer_width_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&dotclockframebuffer_framebuffer_height_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&dotclockframebuffer_framebuffer_frequency_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_refresh_rate), MP_ROM_PTR(&dotclockframebuffer_framebuffer_refresh_rate_obj) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&dotclockframebuffer_framebuffer_refresh_obj) },
|
||||||
|
};
|
||||||
|
STATIC MP_DEFINE_CONST_DICT(dotclockframebuffer_framebuffer_locals_dict, dotclockframebuffer_framebuffer_locals_dict_table);
|
||||||
|
|
||||||
|
const mp_obj_type_t dotclockframebuffer_framebuffer_type = {
|
||||||
|
{ &mp_type_type },
|
||||||
|
.flags = MP_TYPE_FLAG_EXTENDED,
|
||||||
|
.name = MP_QSTR_DotClockFramebuffer,
|
||||||
|
.make_new = dotclockframebuffer_framebuffer_make_new,
|
||||||
|
.locals_dict = (mp_obj_dict_t *)&dotclockframebuffer_framebuffer_locals_dict,
|
||||||
|
MP_TYPE_EXTENDED_FIELDS(
|
||||||
|
.buffer_p = { .get_buffer = dotclockframebuffer_framebuffer_get_buffer, },
|
||||||
|
.protocol = &dotclockframebuffer_framebuffer_proto,
|
||||||
|
),
|
||||||
|
};
|
57
shared-bindings/dotclockframebuffer/DotClockFramebuffer.h
Normal file
57
shared-bindings/dotclockframebuffer/DotClockFramebuffer.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common-hal/microcontroller/Pin.h"
|
||||||
|
#include "shared-bindings/displayio/__init__.h"
|
||||||
|
#include "shared-module/displayio/Group.h"
|
||||||
|
|
||||||
|
typedef struct dotclockframebuffer_framebuffer_obj dotclockframebuffer_framebuffer_obj_t;
|
||||||
|
|
||||||
|
extern const mp_obj_type_t dotclockframebuffer_framebuffer_type;
|
||||||
|
|
||||||
|
void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_framebuffer_obj_t *self,
|
||||||
|
const mcu_pin_obj_t *de,
|
||||||
|
const mcu_pin_obj_t *vsync,
|
||||||
|
const mcu_pin_obj_t *hsync,
|
||||||
|
const mcu_pin_obj_t *dclk,
|
||||||
|
const mcu_pin_obj_t **red, uint8_t num_red,
|
||||||
|
const mcu_pin_obj_t **green, uint8_t num_green,
|
||||||
|
const mcu_pin_obj_t **blue, uint8_t num_blue,
|
||||||
|
int frequency, int width, int height,
|
||||||
|
int hsync_pulse_width, int hsync_back_porch, int hsync_front_porch, bool hsync_idle_low,
|
||||||
|
int vsync_pulse_width, int vsync_back_porch, int vsync_front_porch, bool vsync_idle_low,
|
||||||
|
bool de_idle_high, bool pclk_active_high, bool pclk_idle_high);
|
||||||
|
|
||||||
|
void common_hal_dotclockframebuffer_framebuffer_deinit(dotclockframebuffer_framebuffer_obj_t *self);
|
||||||
|
bool common_hal_dotclockframebuffer_framebuffer_deinitialized(dotclockframebuffer_framebuffer_obj_t *self);
|
||||||
|
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_width(dotclockframebuffer_framebuffer_obj_t *self);
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_height(dotclockframebuffer_framebuffer_obj_t *self);
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_frequency(dotclockframebuffer_framebuffer_obj_t *self);
|
||||||
|
mp_int_t common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(dotclockframebuffer_framebuffer_obj_t *self);
|
||||||
|
void common_hal_dotclockframebuffer_framebuffer_refresh(dotclockframebuffer_framebuffer_obj_t *self);
|
51
shared-bindings/dotclockframebuffer/__init__.c
Normal file
51
shared-bindings/dotclockframebuffer/__init__.c
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "py/enum.h"
|
||||||
|
#include "py/obj.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
|
|
||||||
|
#include "shared-bindings/dotclockframebuffer/__init__.h"
|
||||||
|
#include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h"
|
||||||
|
|
||||||
|
//| """Native helpers for driving parallel displays"""
|
||||||
|
|
||||||
|
|
||||||
|
STATIC const mp_rom_map_elem_t dotclockframebuffer_module_globals_table[] = {
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_dotclockframebuffer) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_DotClockFramebuffer), MP_ROM_PTR(&dotclockframebuffer_framebuffer_type) },
|
||||||
|
};
|
||||||
|
|
||||||
|
STATIC MP_DEFINE_CONST_DICT(dotclockframebuffer_module_globals, dotclockframebuffer_module_globals_table);
|
||||||
|
|
||||||
|
const mp_obj_module_t dotclockframebuffer_module = {
|
||||||
|
.base = { &mp_type_module },
|
||||||
|
.globals = (mp_obj_dict_t *)&dotclockframebuffer_module_globals,
|
||||||
|
};
|
||||||
|
|
||||||
|
MP_REGISTER_MODULE(MP_QSTR_dotclockframebuffer, dotclockframebuffer_module);
|
27
shared-bindings/dotclockframebuffer/__init__.h
Normal file
27
shared-bindings/dotclockframebuffer/__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
|
@ -47,6 +47,9 @@
|
|||||||
#if CIRCUITPY_SHARPDISPLAY
|
#if CIRCUITPY_SHARPDISPLAY
|
||||||
#include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h"
|
#include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if CIRCUITPY_DOTCLOCKFRAMEBUFFER
|
||||||
|
#include "common-hal/dotclockframebuffer/DotClockFramebuffer.h"
|
||||||
|
#endif
|
||||||
// Port unique frame buffers.
|
// Port unique frame buffers.
|
||||||
#if CIRCUITPY_VIDEOCORE
|
#if CIRCUITPY_VIDEOCORE
|
||||||
#include "bindings/videocore/Framebuffer.h"
|
#include "bindings/videocore/Framebuffer.h"
|
||||||
@ -78,6 +81,9 @@ typedef struct {
|
|||||||
#if CIRCUITPY_PICODVI
|
#if CIRCUITPY_PICODVI
|
||||||
picodvi_framebuffer_obj_t picodvi;
|
picodvi_framebuffer_obj_t picodvi;
|
||||||
#endif
|
#endif
|
||||||
|
#if CIRCUITPY_DOTCLOCKFRAMEBUFFER
|
||||||
|
dotclockframebuffer_framebuffer_obj_t dotclock;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
} primary_display_bus_t;
|
} primary_display_bus_t;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user