Skip to content

Commit

Permalink
Merge pull request #5260 from jepler/paralleldisplay
Browse files Browse the repository at this point in the history
Split out paralleldisplay to its own module
  • Loading branch information
tannewt authored Aug 31, 2021
2 parents 3ea90db + 838d30b commit 5fb4fa6
Show file tree
Hide file tree
Showing 33 changed files with 189 additions and 309 deletions.
2 changes: 1 addition & 1 deletion docs/redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ports/atmel-samd/boards/pyportal/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ports/atmel-samd/boards/pyportal_titano/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ports/atmel-samd/boards/ugame10/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* THE SOFTWARE.
*/

#include "shared-bindings/displayio/ParallelBus.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"

#include <stdint.h>

Expand All @@ -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) {

Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* THE SOFTWARE.
*/

#include "shared-bindings/displayio/ParallelBus.h"
#include "shared-bindings/paralleldisplay/ParallelBus.h"

#include <stdint.h>

Expand All @@ -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) {

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
67 changes: 0 additions & 67 deletions ports/mimxrt10xx/common-hal/displayio/ParallelBus.c

This file was deleted.

1 change: 1 addition & 0 deletions ports/mimxrt10xx/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 5fb4fa6

Please sign in to comment.