Merge pull request #5260 from jepler/paralleldisplay

Split out paralleldisplay to its own module
This commit is contained in:
Scott Shawcroft 2021-08-30 18:35:15 -07:00 committed by GitHub
commit 5fb4fa6f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 189 additions and 309 deletions

View File

@ -71,7 +71,7 @@ shared-bindings/displayio/Group.rst shared-bindings/displayio/#displayio.Group
shared-bindings/displayio/I2CDisplay.rst shared-bindings/displayio/#displayio.I2CDisplay
shared-bindings/displayio/OnDiskBitmap.rst shared-bindings/displayio/#displayio.OnDiskBitmap
shared-bindings/displayio/Palette.rst shared-bindings/displayio/#displayio.Palette
shared-bindings/displayio/ParallelBus.rst shared-bindings/displayio/#displayio.ParallelBus
shared-bindings/paralleldisplay/ParallelBus.rst shared-bindings/paralleldisplay/#paralleldisplay.ParallelBus
shared-bindings/displayio/Shape.rst shared-bindings/displayio/#displayio.Shape
shared-bindings/displayio/TileGrid.rst shared-bindings/displayio/#displayio.TileGrid
shared-bindings/displayio/__init__.rst shared-bindings/displayio/

View File

@ -20,6 +20,7 @@ CIRCUITPY_USB_MIDI = 0
# So not all of displayio, sorry!
CIRCUITPY_VECTORIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_PARALLELDISPLAY = 0
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground

View File

@ -20,6 +20,7 @@ CIRCUITPY_BITBANG_APA102 = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_PIXELBUF = 0
CIRCUITPY_PS2IO = 0
CIRCUITPY_PULSEIO = 0

View File

@ -61,9 +61,9 @@ uint8_t display_init_sequence[] = {
};
void board_init(void) {
displayio_parallelbus_obj_t *bus = &displays[0].parallel_bus;
bus->base.type = &displayio_parallelbus_type;
common_hal_displayio_parallelbus_construct(bus,
paralleldisplay_parallelbus_obj_t *bus = &displays[0].parallel_bus;
bus->base.type = &paralleldisplay_parallelbus_type;
common_hal_paralleldisplay_parallelbus_construct(bus,
&pin_PA16, // Data0
&pin_PB05, // Command or data
&pin_PB06, // Chip select

View File

@ -78,9 +78,9 @@ uint8_t display_init_sequence[] = {
};
void board_init(void) {
displayio_parallelbus_obj_t *bus = &displays[0].parallel_bus;
bus->base.type = &displayio_parallelbus_type;
common_hal_displayio_parallelbus_construct(bus,
paralleldisplay_parallelbus_obj_t *bus = &displays[0].parallel_bus;
bus->base.type = &paralleldisplay_parallelbus_type;
common_hal_paralleldisplay_parallelbus_construct(bus,
&pin_PA16, // Data0
&pin_PB05, // Command or data
&pin_PB06, // Chip select

View File

@ -24,6 +24,7 @@ CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_PIXELBUF = 0
CIRCUITPY_RTC = 0
CIRCUITPY_TOUCHIO = 0

View File

@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
#include "shared-bindings/displayio/ParallelBus.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#include <stdint.h>
@ -33,7 +33,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/microcontroller/__init__.h"
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_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) {
@ -83,7 +83,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
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_displayio_parallelbus_reset(self);
common_hal_paralleldisplay_parallelbus_reset(self);
}
never_reset_pin_number(command->number);
@ -95,7 +95,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
}
}
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
for (uint8_t i = 0; i < 8; i++) {
reset_pin_number(self->data0_pin + i);
}
@ -107,8 +107,8 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
reset_pin_number(self->reset.pin->number);
}
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
if (self->reset.base.type == &mp_type_NoneType) {
return false;
}
@ -119,19 +119,19 @@ bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
return true;
}
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
return true;
}
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
return true;
}
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
void common_hal_paralleldisplay_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) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
paralleldisplay_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;
@ -143,7 +143,7 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt
}
}
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
}

View File

@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#include "common-hal/digitalio/DigitalInOut.h"
@ -40,6 +40,6 @@ typedef struct {
uint8_t data0_pin;
PortGroup *write_group;
uint32_t write_mask;
} displayio_parallelbus_obj_t;
} paralleldisplay_parallelbus_obj_t;
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H

View File

@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
#include "shared-bindings/displayio/ParallelBus.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#include <stdint.h>
@ -38,7 +38,7 @@
* - data0 pin must be byte aligned
*/
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_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) {
@ -120,7 +120,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
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_displayio_parallelbus_reset(self);
common_hal_paralleldisplay_parallelbus_reset(self);
}
never_reset_pin_number(command->number);
@ -133,7 +133,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
}
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
/* SNIP - same as from SAMD and NRF ports */
for (uint8_t i = 0; i < 8; i++) {
reset_pin_number(self->data0_pin + i);
@ -146,9 +146,9 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
reset_pin_number(self->reset.pin->number);
}
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
/* SNIP - same as from SAMD and NRF ports */
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
if (self->reset.base.type == &mp_type_NoneType) {
return false;
}
@ -160,21 +160,21 @@ bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
}
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
/* SNIP - same as from SAMD and NRF ports */
return true;
}
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
/* SNIP - same as from SAMD and NRF ports */
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
return true;
}
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
void common_hal_paralleldisplay_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) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
paralleldisplay_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 = self->write_clear_register;
@ -220,8 +220,8 @@ void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt
}
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
/* SNIP - same as from SAMD and NRF ports */
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
}

View File

@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#ifndef MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#define MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#include "common-hal/digitalio/DigitalInOut.h"
@ -42,6 +42,6 @@ typedef struct {
uint32_t *write_set_register; // pointer to the write group for setting the write bit to latch the data on the LCD
uint32_t *write_clear_register; // pointer to the write group for clearing the write bit to latch the data on the LCD
uint32_t write_mask; // bit mask for the single bit for the write pin register
} displayio_parallelbus_obj_t;
} paralleldisplay_parallelbus_obj_t;
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#endif // MICROPY_INCLUDED_ESP32S2_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H

View File

@ -1,67 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Artur Pacholec
*
* 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/ParallelBus.h"
#include <stdint.h>
#include "common-hal/microcontroller/Pin.h"
#include "py/runtime.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/microcontroller/__init__.h"
void common_hal_displayio_parallelbus_construct(displayio_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) {
mp_raise_NotImplementedError(translate("ParallelBus not yet supported"));
}
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
}
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
return false;
}
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
return false;
}
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
return false;
}
void common_hal_displayio_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) {
}
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
}

View File

@ -28,6 +28,7 @@ CIRCUITPY_COUNTIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_NVM = 0
CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_USB_MIDI = 1

View File

@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
#include "shared-bindings/displayio/ParallelBus.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#include <stdint.h>
@ -33,7 +33,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/microcontroller/__init__.h"
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_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_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
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_displayio_parallelbus_reset(self);
common_hal_paralleldisplay_parallelbus_reset(self);
}
never_reset_pin_number(command->number);
@ -106,7 +106,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
}
}
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_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_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
reset_pin_number(self->reset.pin->number);
}
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
paralleldisplay_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_displayio_parallelbus_reset(mp_obj_t obj) {
return true;
}
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
return true;
}
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
paralleldisplay_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_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
void common_hal_paralleldisplay_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) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
paralleldisplay_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_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byt
}
}
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
}

View File

@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#include "common-hal/digitalio/DigitalInOut.h"
@ -40,6 +40,6 @@ typedef struct {
uint8_t data0_pin;
NRF_GPIO_Type *write_group;
uint32_t write_mask;
} displayio_parallelbus_obj_t;
} paralleldisplay_parallelbus_obj_t;
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H

View File

@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
#include "shared-bindings/displayio/ParallelBus.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#include <stdint.h>
@ -43,7 +43,7 @@ static const uint16_t parallel_program[] = {
// .wrap
};
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_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) {
@ -80,7 +80,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
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_displayio_parallelbus_reset(self);
common_hal_paralleldisplay_parallelbus_reset(self);
}
never_reset_pin_number(command->number);
@ -110,7 +110,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *sel
common_hal_rp2pio_statemachine_never_reset(&self->state_machine);
}
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self) {
common_hal_rp2pio_statemachine_deinit(&self->state_machine);
for (uint8_t i = 0; i < 8; i++) {
@ -124,8 +124,8 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self)
reset_pin_number(self->reset.pin->number);
}
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
bool common_hal_paralleldisplay_parallelbus_reset(mp_obj_t obj) {
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
if (self->reset.base.type == &mp_type_NoneType) {
return false;
}
@ -136,26 +136,26 @@ bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
return true;
}
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) {
return true;
}
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) {
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
return true;
}
void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type,
void common_hal_paralleldisplay_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) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
paralleldisplay_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);
}
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
displayio_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t obj) {
paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj);
common_hal_digitalio_digitalinout_set_value(&self->chip_select, true);
}

View File

@ -24,8 +24,8 @@
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#ifndef MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H
#include "common-hal/digitalio/DigitalInOut.h"
#include "bindings/rp2pio/StateMachine.h"
@ -40,6 +40,6 @@ typedef struct {
uint8_t write;
uint8_t data0_pin;
rp2pio_statemachine_obj_t state_machine;
} displayio_parallelbus_obj_t;
} paralleldisplay_parallelbus_obj_t;
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_PARALLELDISPLAY_PARALLELBUS_H

View File

@ -1,67 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Lucian Copeland 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/ParallelBus.h"
#include <stdint.h>
#include "common-hal/microcontroller/Pin.h"
#include "py/runtime.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/microcontroller/__init__.h"
void common_hal_displayio_parallelbus_construct(displayio_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) {
mp_raise_NotImplementedError(translate("ParallelBus not yet supported"));
}
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self) {
}
bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) {
return false;
}
bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) {
return false;
}
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
return false;
}
void common_hal_displayio_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) {
}
void common_hal_displayio_parallelbus_end_transaction(mp_obj_t obj) {
}

View File

@ -1,36 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Lucian Copeland 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_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#define MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#include "common-hal/digitalio/DigitalInOut.h"
typedef struct {
mp_obj_base_t base;
} displayio_parallelbus_obj_t;
#endif // MICROPY_INCLUDED_STM32F4_COMMON_HAL_DISPLAYIO_PARALLELBUS_H

View File

@ -61,3 +61,5 @@ ifeq ($(MCU_SERIES),F7)
USB_NUM_ENDPOINT_PAIRS = 6
endif
CIRCUITPY_PARALLELDISPLAY := 0

View File

@ -175,6 +175,9 @@ endif
ifeq ($(CIRCUITPY_DISPLAYIO),1)
SRC_PATTERNS += displayio/%
endif
ifeq ($(CIRCUITPY_PARALLELDISPLAY),1)
SRC_PATTERNS += paralleldisplay/%
endif
ifeq ($(CIRCUITPY_VECTORIO),1)
SRC_PATTERNS += vectorio/%
endif
@ -385,7 +388,6 @@ SRC_COMMON_HAL_ALL = \
countio/__init__.c \
digitalio/DigitalInOut.c \
digitalio/__init__.c \
displayio/ParallelBus.c \
dualbank/__init__.c \
frequencyio/FrequencyIn.c \
frequencyio/__init__.c \
@ -404,6 +406,7 @@ SRC_COMMON_HAL_ALL = \
nvm/ByteArray.c \
nvm/__init__.c \
os/__init__.c \
paralleldisplay/ParallelBus.c \
ps2io/Ps2.c \
ps2io/__init__.c \
pulseio/PulseIn.c \

View File

@ -330,6 +330,7 @@ extern const struct _mp_obj_module_t canio_module;
// CIRCUITPY_COUNTIO uses MP_REGISTER_MODULE
// CIRCUITPY_DIGITALIO uses MP_REGISTER_MODULE
// CIRCUITPY_DISPLAYIO uses MP_REGISTER_MODULE
// CIRCUITPY_PARALLELDISPLAY uses MP_REGISTER_MODULE
// CIRCUITPY_TERMINALIO uses MP_REGISTER_MODULE
// CIRCUITPY_FONTIO uses MP_REGISTER_MODULE

View File

@ -154,6 +154,13 @@ CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO)
CIRCUITPY_DISPLAYIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_DISPLAYIO=$(CIRCUITPY_DISPLAYIO)
ifeq ($(CIRCUITPY_DISPLAYIO),1)
CIRCUITPY_PARALLELDISPLAY ?= $(CIRCUITPY_FULL_BUILD)
else
CIRCUITPY_PARALLELDISPLAY = 0
endif
CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY)
# bitmaptools and framebufferio rely on displayio
ifeq ($(CIRCUITPY_DISPLAYIO),1)
CIRCUITPY_BITMAPTOOLS ?= $(CIRCUITPY_FULL_BUILD)

View File

@ -39,8 +39,8 @@
#include "shared-module/displayio/__init__.h"
#include "supervisor/shared/translate.h"
//| _DisplayBus = Union['FourWire', 'ParallelBus', 'I2CDisplay']
//| """:py:class:`FourWire`, :py:class:`ParallelBus` or :py:class:`I2CDisplay`"""
//| _DisplayBus = Union['FourWire', 'paralleldisplay.ParallelBus', 'I2CDisplay']
//| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`"""
//|
//|

View File

@ -64,7 +64,7 @@
//| busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True,
//| seconds_per_frame: float = 180, always_toggle_chip_select: bool = False,
//| grayscale: bool = False) -> None:
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `paralleldisplay.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
@ -75,7 +75,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 displayio.ParallelBus
//| :type _DisplayBus: displayio.FourWire or paralleldisplay.ParallelBus
//| :param ~_typing.ReadableBuffer start_sequence: Byte-packed initialization sequence.
//| :param ~_typing.ReadableBuffer stop_sequence: Byte-packed initialization sequence.
//| :param int width: Width in pixels

View File

@ -40,7 +40,9 @@
#include "shared-bindings/displayio/I2CDisplay.h"
#include "shared-bindings/displayio/OnDiskBitmap.h"
#include "shared-bindings/displayio/Palette.h"
#include "shared-bindings/displayio/ParallelBus.h"
#if CIRCUITPY_PARALLELDISPLAY
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#endif
#include "shared-bindings/displayio/Shape.h"
#include "shared-bindings/displayio/TileGrid.h"
@ -50,6 +52,8 @@
//| including synchronizing with refresh rates and partial updating."""
//|
//| import paralleldisplay
//| def release_displays() -> None:
//| """Releases any actively used displays so their busses and pins can be used again. This will also
//| release the builtin display on boards that have one. You will need to reinitialize it yourself
@ -125,7 +129,9 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&displayio_fourwire_type) },
{ MP_ROM_QSTR(MP_QSTR_I2CDisplay), MP_ROM_PTR(&displayio_i2cdisplay_type) },
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(&displayio_parallelbus_type) },
#if CIRCUITPY_PARALLELDISPLAY
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(&paralleldisplay_parallelbus_type) },
#endif
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
};

View File

@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
#include "shared-bindings/displayio/ParallelBus.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#include <stdint.h>
@ -59,7 +59,7 @@
//| :param microcontroller.Pin reset: Reset pin"""
//| ...
//|
STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_data0, 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 | MP_ARG_REQUIRED },
@ -80,10 +80,10 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t
mcu_pin_obj_t *read = validate_obj_is_free_pin(args[ARG_read].u_obj);
mcu_pin_obj_t *reset = validate_obj_is_free_pin(args[ARG_reset].u_obj);
displayio_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus;
self->base.type = &displayio_parallelbus_type;
paralleldisplay_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus;
self->base.type = &paralleldisplay_parallelbus_type;
common_hal_displayio_parallelbus_construct(self, data0, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
common_hal_paralleldisplay_parallelbus_construct(self, data0, command, chip_select, write, read, reset, args[ARG_frequency].u_int);
return self;
}
@ -93,22 +93,22 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t
//| ...
//|
STATIC mp_obj_t displayio_parallelbus_obj_reset(mp_obj_t self_in) {
displayio_parallelbus_obj_t *self = self_in;
STATIC mp_obj_t paralleldisplay_parallelbus_obj_reset(mp_obj_t self_in) {
paralleldisplay_parallelbus_obj_t *self = self_in;
if (!common_hal_displayio_parallelbus_reset(self)) {
if (!common_hal_paralleldisplay_parallelbus_reset(self)) {
mp_raise_RuntimeError(translate("no reset pin available"));
}
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_parallelbus_reset_obj, displayio_parallelbus_obj_reset);
MP_DEFINE_CONST_FUN_OBJ_1(paralleldisplay_parallelbus_reset_obj, paralleldisplay_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 displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
STATIC mp_obj_t paralleldisplay_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) {
mp_int_t command_int = MP_OBJ_SMALL_INT_VALUE(command_obj);
if (!mp_obj_is_small_int(command_obj) || command_int > 255 || command_int < 0) {
mp_raise_ValueError(translate("Command must be an int between 0 and 255"));
@ -118,26 +118,26 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o
mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ);
// Wait for display bus to be available.
while (!common_hal_displayio_parallelbus_begin_transaction(self)) {
while (!common_hal_paralleldisplay_parallelbus_begin_transaction(self)) {
RUN_BACKGROUND_TASKS;
}
common_hal_displayio_parallelbus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, &command, 1);
common_hal_displayio_parallelbus_send(self, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t *)bufinfo.buf), bufinfo.len);
common_hal_displayio_parallelbus_end_transaction(self);
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);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_3(displayio_parallelbus_send_obj, displayio_parallelbus_obj_send);
MP_DEFINE_CONST_FUN_OBJ_3(paralleldisplay_parallelbus_send_obj, paralleldisplay_parallelbus_obj_send);
STATIC const mp_rom_map_elem_t displayio_parallelbus_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&displayio_parallelbus_reset_obj) },
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_parallelbus_send_obj) },
STATIC const mp_rom_map_elem_t paralleldisplay_parallelbus_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&paralleldisplay_parallelbus_reset_obj) },
{ MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&paralleldisplay_parallelbus_send_obj) },
};
STATIC MP_DEFINE_CONST_DICT(displayio_parallelbus_locals_dict, displayio_parallelbus_locals_dict_table);
STATIC MP_DEFINE_CONST_DICT(paralleldisplay_parallelbus_locals_dict, paralleldisplay_parallelbus_locals_dict_table);
const mp_obj_type_t displayio_parallelbus_type = {
const mp_obj_type_t paralleldisplay_parallelbus_type = {
{ &mp_type_type },
.name = MP_QSTR_ParallelBus,
.make_new = displayio_parallelbus_make_new,
.locals_dict = (mp_obj_dict_t *)&displayio_parallelbus_locals_dict,
.make_new = paralleldisplay_parallelbus_make_new,
.locals_dict = (mp_obj_dict_t *)&paralleldisplay_parallelbus_locals_dict,
};

View File

@ -24,31 +24,28 @@
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_PARALLELBUS_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_PARALLELBUS_H
#pragma once
#include "common-hal/displayio/ParallelBus.h"
#include "common-hal/paralleldisplay/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 displayio_parallelbus_type;
extern const mp_obj_type_t paralleldisplay_parallelbus_type;
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t *self,
void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_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_displayio_parallelbus_deinit(displayio_parallelbus_obj_t *self);
void common_hal_paralleldisplay_parallelbus_deinit(paralleldisplay_parallelbus_obj_t *self);
bool common_hal_displayio_parallelbus_reset(mp_obj_t self);
bool common_hal_displayio_parallelbus_bus_free(mp_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_displayio_parallelbus_begin_transaction(mp_obj_t self);
bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t self);
void common_hal_displayio_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type,
void common_hal_paralleldisplay_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_displayio_parallelbus_end_transaction(mp_obj_t self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_PARALLELBUS_H
void common_hal_paralleldisplay_parallelbus_end_transaction(mp_obj_t self);

View File

@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Artur Pacholec
* 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
@ -24,13 +24,28 @@
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#define MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
#include <stdint.h>
#include "common-hal/digitalio/DigitalInOut.h"
#include "py/enum.h"
#include "py/obj.h"
#include "py/runtime.h"
typedef struct {
mp_obj_base_t base;
} displayio_parallelbus_obj_t;
#include "shared-bindings/paralleldisplay/__init__.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_DISPLAYIO_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(&paralleldisplay_parallelbus_type) },
};
STATIC MP_DEFINE_CONST_DICT(paralleldisplay_module_globals, paralleldisplay_module_globals_table);
const mp_obj_module_t paralleldisplay_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&paralleldisplay_module_globals,
};
MP_REGISTER_MODULE(MP_QSTR_paralleldisplay, paralleldisplay_module, CIRCUITPY_PARALLELDISPLAY);

View File

@ -29,7 +29,9 @@
#include "py/runtime.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/I2CDisplay.h"
#include "shared-bindings/displayio/ParallelBus.h"
#if CIRCUITPY_PARALLELDISPLAY
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#endif
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/time/__init__.h"
#include "shared-module/displayio/__init__.h"

View File

@ -31,7 +31,9 @@
#include "shared-bindings/displayio/ColorConverter.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/I2CDisplay.h"
#include "shared-bindings/displayio/ParallelBus.h"
#if CIRCUITPY_PARALLELDISPLAY
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#endif
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/time/__init__.h"
#include "shared-module/displayio/__init__.h"

View File

@ -109,8 +109,10 @@ void common_hal_displayio_release_displays(void) {
common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus);
} else if (bus_type == &displayio_i2cdisplay_type) {
common_hal_displayio_i2cdisplay_deinit(&displays[i].i2cdisplay_bus);
} else if (bus_type == &displayio_parallelbus_type) {
common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus);
#if CIRCUITPY_PARALLELDISPLAY
} else if (bus_type == &paralleldisplay_parallelbus_type) {
common_hal_paralleldisplay_parallelbus_deinit(&displays[i].parallel_bus);
#endif
#if CIRCUITPY_RGBMATRIX
} else if (bus_type == &rgbmatrix_RGBMatrix_type) {
common_hal_rgbmatrix_rgbmatrix_deinit(&displays[i].rgbmatrix);

View File

@ -35,7 +35,9 @@
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/Group.h"
#include "shared-bindings/displayio/I2CDisplay.h"
#include "shared-bindings/displayio/ParallelBus.h"
#if CIRCUITPY_PARALLELDISPLAY
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#endif
#if CIRCUITPY_RGBMATRIX
#include "shared-bindings/rgbmatrix/RGBMatrix.h"
#endif
@ -48,7 +50,9 @@ typedef struct {
mp_obj_base_t bus_base;
displayio_fourwire_obj_t fourwire_bus;
displayio_i2cdisplay_obj_t i2cdisplay_bus;
displayio_parallelbus_obj_t parallel_bus;
#if CIRCUITPY_PARALLELDISPLAY
paralleldisplay_parallelbus_obj_t parallel_bus;
#endif
#if CIRCUITPY_RGBMATRIX
rgbmatrix_rgbmatrix_obj_t rgbmatrix;
#endif

View File

@ -30,7 +30,9 @@
#include "py/runtime.h"
#include "shared-bindings/displayio/FourWire.h"
#include "shared-bindings/displayio/I2CDisplay.h"
#include "shared-bindings/displayio/ParallelBus.h"
#if CIRCUITPY_PARALLELDISPLAY
#include "shared-bindings/paralleldisplay/ParallelBus.h"
#endif
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/time/__init__.h"
#include "shared-module/displayio/__init__.h"
@ -61,13 +63,16 @@ void displayio_display_core_construct(displayio_display_core_t *self,
// (framebufferdisplay already validated its 'bus' is a buffer-protocol object)
if (bus) {
if (mp_obj_is_type(bus, &displayio_parallelbus_type)) {
self->bus_reset = common_hal_displayio_parallelbus_reset;
self->bus_free = common_hal_displayio_parallelbus_bus_free;
self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction;
self->send = common_hal_displayio_parallelbus_send;
self->end_transaction = common_hal_displayio_parallelbus_end_transaction;
} else if (mp_obj_is_type(bus, &displayio_fourwire_type)) {
#if CIRCUITPY_PARALLELDISPLAY
if (mp_obj_is_type(bus, &paralleldisplay_parallelbus_type)) {
self->bus_reset = common_hal_paralleldisplay_parallelbus_reset;
self->bus_free = common_hal_paralleldisplay_parallelbus_bus_free;
self->begin_transaction = common_hal_paralleldisplay_parallelbus_begin_transaction;
self->send = common_hal_paralleldisplay_parallelbus_send;
self->end_transaction = common_hal_paralleldisplay_parallelbus_end_transaction;
} else
#endif
if (mp_obj_is_type(bus, &displayio_fourwire_type)) {
self->bus_reset = common_hal_displayio_fourwire_reset;
self->bus_free = common_hal_displayio_fourwire_bus_free;
self->begin_transaction = common_hal_displayio_fourwire_begin_transaction;