Fix other builds and hallowing
This commit is contained in:
parent
5277138c99
commit
2d136d58bf
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB23) },
|
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB23) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB23) },
|
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB23) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB22) },
|
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB22) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB22) },
|
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB22) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_PA13) },
|
{ MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_PA13) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_PA12) },
|
{ MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_PA12) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_PA15) },
|
{ MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_PA15) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA30) },
|
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA30) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
// This mapping only includes functional names because pins broken
|
// This mapping only includes functional names because pins broken
|
||||||
// out on connectors are labeled with their MCU name available from
|
// out on connectors are labeled with their MCU name available from
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
// This mapping only includes functional names because pins broken
|
// This mapping only includes functional names because pins broken
|
||||||
// out on connectors are labeled with their MCU name available from
|
// out on connectors are labeled with their MCU name available from
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PB02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, // pad 1
|
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, // pad 1
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "boards/board.h"
|
#include "boards/board.h"
|
||||||
|
|
||||||
#include "shared-bindings/displayio/FourWire.h"
|
#include "shared-bindings/displayio/FourWire.h"
|
||||||
|
#include "shared-module/displayio/__init__.h"
|
||||||
#include "shared-module/displayio/mipi_constants.h"
|
#include "shared-module/displayio/mipi_constants.h"
|
||||||
|
|
||||||
#include "tick.h"
|
#include "tick.h"
|
||||||
@ -68,13 +69,18 @@ uint8_t display_init_sequence[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void board_init(void) {
|
void board_init(void) {
|
||||||
board_display_obj.base.type = &displayio_fourwire_type;
|
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
|
||||||
common_hal_displayio_fourwire_construct(&board_display_obj,
|
bus->base.type = &displayio_fourwire_type;
|
||||||
&pin_PB23, // Clock
|
common_hal_displayio_fourwire_construct(bus,
|
||||||
&pin_PB22, // Data
|
board_spi(),
|
||||||
&pin_PA28, // Command or data
|
&pin_PA28, // Command or data
|
||||||
&pin_PA01, // Chip select
|
&pin_PA01, // Chip select
|
||||||
&pin_PA27, // Reset
|
&pin_PA27); // Reset
|
||||||
|
|
||||||
|
displayio_display_obj_t* display = &displays[0].display;
|
||||||
|
display->base.type = &displayio_display_type;
|
||||||
|
common_hal_displayio_display_construct(display,
|
||||||
|
bus,
|
||||||
128, // Width
|
128, // Width
|
||||||
128, // Height
|
128, // Height
|
||||||
2, // column start
|
2, // column start
|
||||||
@ -82,33 +88,9 @@ void board_init(void) {
|
|||||||
16, // Color depth
|
16, // Color depth
|
||||||
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
|
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command
|
||||||
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
|
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command
|
||||||
MIPI_COMMAND_WRITE_MEMORY_START); // Write memory command
|
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command
|
||||||
|
display_init_sequence,
|
||||||
uint32_t i = 0;
|
sizeof(display_init_sequence));
|
||||||
common_hal_displayio_fourwire_begin_transaction(&board_display_obj);
|
|
||||||
while (i < sizeof(display_init_sequence)) {
|
|
||||||
uint8_t *cmd = display_init_sequence + i;
|
|
||||||
uint8_t data_size = *(cmd + 1);
|
|
||||||
bool delay = (data_size & DELAY) != 0;
|
|
||||||
data_size &= ~DELAY;
|
|
||||||
uint8_t *data = cmd + 2;
|
|
||||||
common_hal_displayio_fourwire_send(&board_display_obj, true, cmd, 1);
|
|
||||||
common_hal_displayio_fourwire_send(&board_display_obj, false, data, data_size);
|
|
||||||
if (delay) {
|
|
||||||
data_size++;
|
|
||||||
uint16_t delay_length_ms = *(cmd + 1 + data_size);
|
|
||||||
if (delay_length_ms == 255) {
|
|
||||||
delay_length_ms = 500;
|
|
||||||
}
|
|
||||||
uint64_t start = ticks_ms;
|
|
||||||
while (ticks_ms - start < delay_length_ms) {}
|
|
||||||
} else {
|
|
||||||
uint64_t start = ticks_ms;
|
|
||||||
while (ticks_ms - start < 10) {}
|
|
||||||
}
|
|
||||||
i += 2 + data_size;
|
|
||||||
}
|
|
||||||
common_hal_displayio_fourwire_end_transaction(&board_display_obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool board_requests_safe_mode(void) {
|
bool board_requests_safe_mode(void) {
|
||||||
@ -116,5 +98,4 @@ bool board_requests_safe_mode(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void reset_board(void) {
|
void reset_board(void) {
|
||||||
common_hal_displayio_fourwire_show(&board_display_obj, NULL);
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "boards/board.h"
|
#include "boards/board.h"
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
#include "shared-module/displayio/__init__.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
@ -62,6 +63,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&board_display_obj)}
|
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}
|
||||||
};
|
};
|
||||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
// This mapping only includes functional names because pins broken
|
// This mapping only includes functional names because pins broken
|
||||||
// out on connectors are labeled with their MCU name available from
|
// out on connectors are labeled with their MCU name available from
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
// This mapping only includes functional names because pins broken
|
// This mapping only includes functional names because pins broken
|
||||||
// out on connectors are labeled with their MCU name available from
|
// out on connectors are labeled with their MCU name available from
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
// This mapping only includes functional names because pins broken
|
// This mapping only includes functional names because pins broken
|
||||||
// out on connectors are labeled with their MCU name available from
|
// out on connectors are labeled with their MCU name available from
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_REMOTEIN), MP_ROM_PTR(&pin_PA28) },
|
{ MP_ROM_QSTR(MP_QSTR_REMOTEIN), MP_ROM_PTR(&pin_PA28) },
|
||||||
|
@ -64,12 +64,14 @@ uint8_t display_init_sequence[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void board_init(void) {
|
void board_init(void) {
|
||||||
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
|
displayio_parallelbus_obj_t* bus = &displays[0].parallel_bus;
|
||||||
bus->base.type = &displayio_fourwire_type;
|
bus->base.type = &displayio_parallelbus_type;
|
||||||
common_hal_displayio_fourwire_construct(bus,
|
common_hal_displayio_parallelbus_construct(bus,
|
||||||
board_spi(),
|
&pin_PA16, // Data0
|
||||||
&pin_PB09, // Command or data
|
&pin_PB05, // Command or data
|
||||||
&pin_PB06, // Chip select
|
&pin_PB06, // Chip select
|
||||||
|
&pin_PB09, // Write
|
||||||
|
&pin_PB04, // Read
|
||||||
&pin_PA00); // Reset
|
&pin_PA00); // Reset
|
||||||
|
|
||||||
displayio_display_obj_t* display = &displays[0].display;
|
displayio_display_obj_t* display = &displays[0].display;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "boards/board.h"
|
#include "boards/board.h"
|
||||||
|
#include "shared-module/displayio/__init__.h"
|
||||||
#include "supervisor/shared/board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
// This mapping only includes functional names because pins broken
|
// This mapping only includes functional names because pins broken
|
||||||
@ -72,5 +73,7 @@ STATIC const mp_map_elem_t board_global_dict_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||||
|
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
|
||||||
};
|
};
|
||||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
|
|
||||||
// Analog pins
|
// Analog pins
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) },
|
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
|
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
|
||||||
|
|
||||||
// Digital pins
|
// Digital pins
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
|
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
|
||||||
@ -25,16 +25,16 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
|
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
|
||||||
|
|
||||||
// UART pins
|
// UART pins
|
||||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
|
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
|
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
|
||||||
|
|
||||||
// SPI pins
|
// SPI pins
|
||||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA16) },
|
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA16) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
|
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA17) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA19) },
|
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA19) },
|
||||||
|
|
||||||
// I2C pins
|
// I2C pins
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
|
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
|
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
|
||||||
@ -44,7 +44,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_PA17) },
|
{ MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_PA17) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_PA27) },
|
{ MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_PA27) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_YELLOW_LED), MP_ROM_PTR(&pin_PB03) },
|
{ MP_ROM_QSTR(MP_QSTR_YELLOW_LED), MP_ROM_PTR(&pin_PB03) },
|
||||||
|
|
||||||
// Comm objects
|
// Comm objects
|
||||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
// This mapping only includes functional names because pins broken
|
// This mapping only includes functional names because pins broken
|
||||||
// out on connectors are labeled with their MCU name available from
|
// out on connectors are labeled with their MCU name available from
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
|
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
|
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "shared-bindings/board/__init__.h"
|
#include "shared-bindings/board/__init__.h"
|
||||||
|
|
||||||
#include "board_busses.h"
|
#include "supervisor/shared/board_busses.h"
|
||||||
|
|
||||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||||
{ MP_ROM_QSTR(MP_QSTR_X), MP_ROM_PTR(&pin_PA00) },
|
{ MP_ROM_QSTR(MP_QSTR_X), MP_ROM_PTR(&pin_PA00) },
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
#include "tick.h"
|
#include "tick.h"
|
||||||
|
|
||||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self,
|
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* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select,
|
||||||
const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* reset, const mcu_pin_obj_t* write) {
|
const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset) {
|
||||||
|
|
||||||
uint8_t data_pin = data0->number;
|
uint8_t data_pin = data0->number;
|
||||||
if (data_pin % 8 != 0 || data_pin % 32 >= 24) {
|
if (data_pin % 8 != 0 || data_pin % 32 >= 24) {
|
||||||
@ -47,8 +47,8 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel
|
|||||||
mp_raise_ValueError_varg(translate("Bus pin %d is already in use"), i);
|
mp_raise_ValueError_varg(translate("Bus pin %d is already in use"), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PortGroup *const g = &PORT->Group[data0->number % 32];
|
PortGroup *const g = &PORT->Group[data0->number / 32];
|
||||||
g->DIRSET.reg = 0xff << data_pin;
|
g->DIRSET.reg = 0xff << (data_pin % 32);
|
||||||
self->bus = ((uint8_t*) &g->OUT.reg) + (data0->number % 32 / 8);
|
self->bus = ((uint8_t*) &g->OUT.reg) + (data0->number % 32 / 8);
|
||||||
|
|
||||||
self->command.base.type = &digitalio_digitalinout_type;
|
self->command.base.type = &digitalio_digitalinout_type;
|
||||||
@ -67,15 +67,36 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel
|
|||||||
common_hal_digitalio_digitalinout_construct(&self->write, write);
|
common_hal_digitalio_digitalinout_construct(&self->write, write);
|
||||||
common_hal_digitalio_digitalinout_switch_to_output(&self->write, true, DRIVE_MODE_PUSH_PULL);
|
common_hal_digitalio_digitalinout_switch_to_output(&self->write, true, DRIVE_MODE_PUSH_PULL);
|
||||||
|
|
||||||
|
self->read.base.type = &digitalio_digitalinout_type;
|
||||||
|
common_hal_digitalio_digitalinout_construct(&self->read, read);
|
||||||
|
common_hal_digitalio_digitalinout_switch_to_output(&self->read, true, DRIVE_MODE_PUSH_PULL);
|
||||||
|
|
||||||
|
self->data0_pin = data_pin;
|
||||||
|
self->write_group = &PORT->Group[write->number / 32];
|
||||||
|
self->write_mask = 1 << (write->number % 32);
|
||||||
|
|
||||||
never_reset_pin_number(command->number);
|
never_reset_pin_number(command->number);
|
||||||
never_reset_pin_number(chip_select->number);
|
never_reset_pin_number(chip_select->number);
|
||||||
never_reset_pin_number(reset->number);
|
|
||||||
never_reset_pin_number(write->number);
|
never_reset_pin_number(write->number);
|
||||||
|
never_reset_pin_number(read->number);
|
||||||
|
never_reset_pin_number(reset->number);
|
||||||
for (uint8_t i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
never_reset_pin_number(data_pin + i);
|
never_reset_pin_number(data_pin + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) {
|
||||||
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
|
reset_pin_number(self->data0_pin + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
reset_pin_number(self->command.pin->number);
|
||||||
|
reset_pin_number(self->chip_select.pin->number);
|
||||||
|
reset_pin_number(self->write.pin->number);
|
||||||
|
reset_pin_number(self->read.pin->number);
|
||||||
|
reset_pin_number(self->reset.pin->number);
|
||||||
|
}
|
||||||
|
|
||||||
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
||||||
displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj);
|
displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj);
|
||||||
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
common_hal_digitalio_digitalinout_set_value(&self->chip_select, false);
|
||||||
@ -85,10 +106,13 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) {
|
|||||||
void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) {
|
void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) {
|
||||||
displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj);
|
displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj);
|
||||||
common_hal_digitalio_digitalinout_set_value(&self->command, !command);
|
common_hal_digitalio_digitalinout_set_value(&self->command, !command);
|
||||||
|
uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR.reg;
|
||||||
|
uint32_t* set_write = (uint32_t*) &self->write_group->OUTSET.reg;
|
||||||
|
uint32_t mask = self->write_mask;
|
||||||
for (uint32_t i = 0; i < data_length; i++) {
|
for (uint32_t i = 0; i < data_length; i++) {
|
||||||
common_hal_digitalio_digitalinout_set_value(&self->write, false);
|
*clear_write = mask;
|
||||||
*self->bus = data[i];
|
*self->bus = data[i];
|
||||||
common_hal_digitalio_digitalinout_set_value(&self->write, true);
|
*set_write = mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,10 @@ typedef struct {
|
|||||||
digitalio_digitalinout_obj_t chip_select;
|
digitalio_digitalinout_obj_t chip_select;
|
||||||
digitalio_digitalinout_obj_t reset;
|
digitalio_digitalinout_obj_t reset;
|
||||||
digitalio_digitalinout_obj_t write;
|
digitalio_digitalinout_obj_t write;
|
||||||
|
digitalio_digitalinout_obj_t read;
|
||||||
|
uint8_t data0_pin;
|
||||||
|
PortGroup* write_group;
|
||||||
|
uint32_t write_mask;
|
||||||
} displayio_parallelbus_obj_t;
|
} displayio_parallelbus_obj_t;
|
||||||
|
|
||||||
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_DISPLAYIO_PARALLELBUS_H
|
||||||
|
@ -282,6 +282,7 @@ extern const struct _mp_obj_module_t wiznet_module;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CIRCUITPY_DISPLAYIO
|
#ifdef CIRCUITPY_DISPLAYIO
|
||||||
|
#define CIRCUITPY_DISPLAY_LIMIT (3)
|
||||||
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module },
|
#define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module },
|
||||||
#else
|
#else
|
||||||
#define DISPLAYIO_MODULE
|
#define DISPLAYIO_MODULE
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "shared-bindings/microcontroller/Pin.h"
|
#include "shared-bindings/microcontroller/Pin.h"
|
||||||
#include "shared-bindings/util.h"
|
#include "shared-bindings/util.h"
|
||||||
|
#include "shared-module/displayio/__init__.h"
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate.h"
|
||||||
|
|
||||||
//| .. currentmodule:: displayio
|
//| .. currentmodule:: displayio
|
||||||
@ -46,13 +47,54 @@
|
|||||||
//|
|
//|
|
||||||
//| .. warning:: This will be changed before 4.0.0. Consider it very experimental.
|
//| .. warning:: This will be changed before 4.0.0. Consider it very experimental.
|
||||||
//|
|
//|
|
||||||
//| .. class:: ParallelBus(*, data0, command, chip_select, reset, write, bus_width=8)
|
//| .. class:: ParallelBus(*, data0, command, chip_select, write, read, reset)
|
||||||
//|
|
//|
|
||||||
//| Create a ParallelBus object associated with the given pins.
|
//| Create a ParallelBus object associated with the given pins. The bus is inferred from data0
|
||||||
|
//| by implying the next 7 additional pins on a given GPIO port.
|
||||||
//|
|
//|
|
||||||
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 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) {
|
||||||
mp_raise_NotImplementedError(translate("displayio is a work in progress"));
|
enum { ARG_data0, ARG_command, ARG_chip_select, ARG_write, ARG_read, ARG_reset };
|
||||||
return mp_const_none;
|
static const mp_arg_t allowed_args[] = {
|
||||||
|
{ MP_QSTR_data0, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||||
|
{ MP_QSTR_command, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||||
|
{ MP_QSTR_chip_select, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||||
|
{ MP_QSTR_write, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||||
|
{ MP_QSTR_read, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||||
|
{ MP_QSTR_reset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||||
|
};
|
||||||
|
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||||
|
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||||
|
|
||||||
|
mp_obj_t data0 = args[ARG_data0].u_obj;
|
||||||
|
mp_obj_t command = args[ARG_command].u_obj;
|
||||||
|
mp_obj_t chip_select = args[ARG_chip_select].u_obj;
|
||||||
|
mp_obj_t write = args[ARG_write].u_obj;
|
||||||
|
mp_obj_t read = args[ARG_read].u_obj;
|
||||||
|
mp_obj_t reset = args[ARG_reset].u_obj;
|
||||||
|
if (data0 == mp_const_none || command == mp_const_none || chip_select == mp_const_none || write == mp_const_none || read == mp_const_none) {
|
||||||
|
mp_raise_ValueError(translate("Data0, command, chip_select, write and read required"));
|
||||||
|
}
|
||||||
|
assert_pin_free(data0);
|
||||||
|
assert_pin_free(command);
|
||||||
|
assert_pin_free(chip_select);
|
||||||
|
assert_pin_free(write);
|
||||||
|
assert_pin_free(read);
|
||||||
|
assert_pin_free(reset);
|
||||||
|
|
||||||
|
displayio_parallelbus_obj_t* self = NULL;
|
||||||
|
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
|
||||||
|
if (displays[i].parallel_bus.base.type== NULL) {
|
||||||
|
self = &displays[i].parallel_bus;
|
||||||
|
self->base.type = &displayio_parallelbus_type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (self == NULL) {
|
||||||
|
mp_raise_RuntimeError(translate("Display bus limit reached"));
|
||||||
|
}
|
||||||
|
|
||||||
|
common_hal_displayio_parallelbus_construct(self, data0, command, chip_select, write, read, reset);
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
extern const mp_obj_type_t displayio_parallelbus_type;
|
extern const mp_obj_type_t displayio_parallelbus_type;
|
||||||
|
|
||||||
void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* self,
|
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* data0, const mcu_pin_obj_t* command, const mcu_pin_obj_t* chip_select,
|
||||||
const mcu_pin_obj_t* chip_select, const mcu_pin_obj_t* reset, const mcu_pin_obj_t* write);
|
const mcu_pin_obj_t* write, const mcu_pin_obj_t* read, const mcu_pin_obj_t* reset);
|
||||||
|
|
||||||
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self);
|
void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self);
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "shared-bindings/displayio/Group.h"
|
#include "shared-bindings/displayio/Group.h"
|
||||||
#include "shared-bindings/displayio/OnDiskBitmap.h"
|
#include "shared-bindings/displayio/OnDiskBitmap.h"
|
||||||
#include "shared-bindings/displayio/Palette.h"
|
#include "shared-bindings/displayio/Palette.h"
|
||||||
|
#include "shared-bindings/displayio/ParallelBus.h"
|
||||||
#include "shared-bindings/displayio/Shape.h"
|
#include "shared-bindings/displayio/Shape.h"
|
||||||
#include "shared-bindings/displayio/Sprite.h"
|
#include "shared-bindings/displayio/Sprite.h"
|
||||||
|
|
||||||
@ -67,6 +68,7 @@
|
|||||||
//| Group
|
//| Group
|
||||||
//| OnDiskBitmap
|
//| OnDiskBitmap
|
||||||
//| Palette
|
//| Palette
|
||||||
|
//| ParallelBus
|
||||||
//| Shape
|
//| Shape
|
||||||
//| Sprite
|
//| Sprite
|
||||||
//|
|
//|
|
||||||
@ -96,6 +98,7 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
|
|||||||
{ MP_ROM_QSTR(MP_QSTR_Sprite), MP_ROM_PTR(&displayio_sprite_type) },
|
{ MP_ROM_QSTR(MP_QSTR_Sprite), MP_ROM_PTR(&displayio_sprite_type) },
|
||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&displayio_fourwire_type) },
|
{ MP_ROM_QSTR(MP_QSTR_FourWire), MP_ROM_PTR(&displayio_fourwire_type) },
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_ParallelBus), MP_ROM_PTR(&displayio_parallelbus_type) },
|
||||||
|
|
||||||
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
|
{ MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) },
|
||||||
};
|
};
|
||||||
|
@ -113,10 +113,10 @@ void displayio_display_start_region_update(displayio_display_obj_t* self, uint16
|
|||||||
uint16_t data[2];
|
uint16_t data[2];
|
||||||
self->send(self->bus, true, &self->set_column_command, 1);
|
self->send(self->bus, true, &self->set_column_command, 1);
|
||||||
data[0] = __builtin_bswap16(x0 + self->colstart);
|
data[0] = __builtin_bswap16(x0 + self->colstart);
|
||||||
data[1] = __builtin_bswap16(x1 + self->colstart);
|
data[1] = __builtin_bswap16(x1 - 1 + self->colstart);
|
||||||
self->send(self->bus, false, (uint8_t*) data, 4);
|
self->send(self->bus, false, (uint8_t*) data, 4);
|
||||||
self->send(self->bus, true, &self->set_row_command, 1);
|
self->send(self->bus, true, &self->set_row_command, 1);
|
||||||
data[0] = __builtin_bswap16(y0 + self->rowstart);
|
data[0] = __builtin_bswap16(y0 + 1 + self->rowstart);
|
||||||
data[1] = __builtin_bswap16(y1 + self->rowstart);
|
data[1] = __builtin_bswap16(y1 + self->rowstart);
|
||||||
self->send(self->bus, false, (uint8_t*) data, 4);
|
self->send(self->bus, false, (uint8_t*) data, 4);
|
||||||
self->send(self->bus, true, &self->write_ram_command, 1);
|
self->send(self->bus, true, &self->write_ram_command, 1);
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "shared-bindings/displayio/Group.h"
|
#include "shared-bindings/displayio/Group.h"
|
||||||
#include "shared-bindings/displayio/Palette.h"
|
#include "shared-bindings/displayio/Palette.h"
|
||||||
#include "shared-bindings/displayio/Sprite.h"
|
#include "shared-bindings/displayio/Sprite.h"
|
||||||
|
#include "supervisor/usb.h"
|
||||||
|
|
||||||
primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT];
|
primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT];
|
||||||
|
|
||||||
@ -21,8 +22,6 @@ void displayio_refresh_displays(void) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (displayio_display_refresh_queued(display)) {
|
if (displayio_display_refresh_queued(display)) {
|
||||||
PORT->Group[1].DIRSET.reg = 1 << 22;
|
|
||||||
|
|
||||||
// We compute the pixels
|
// We compute the pixels
|
||||||
uint16_t x0 = 0;
|
uint16_t x0 = 0;
|
||||||
uint16_t y0 = 0;
|
uint16_t y0 = 0;
|
||||||
@ -38,8 +37,6 @@ void displayio_refresh_displays(void) {
|
|||||||
uint16_t* pixel = &(((uint16_t*)buffer)[index]);
|
uint16_t* pixel = &(((uint16_t*)buffer)[index]);
|
||||||
*pixel = 0;
|
*pixel = 0;
|
||||||
|
|
||||||
PORT->Group[1].OUTTGL.reg = 1 << 22;
|
|
||||||
|
|
||||||
//if (index == 0) {
|
//if (index == 0) {
|
||||||
if (display->current_group != NULL) {
|
if (display->current_group != NULL) {
|
||||||
displayio_group_get_pixel(display->current_group, x, y, pixel);
|
displayio_group_get_pixel(display->current_group, x, y, pixel);
|
||||||
@ -48,9 +45,6 @@ void displayio_refresh_displays(void) {
|
|||||||
// *pixel = (((uint16_t*)buffer)[0]);
|
// *pixel = (((uint16_t*)buffer)[0]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
PORT->Group[1].OUTTGL.reg = 1 << 22;
|
|
||||||
|
|
||||||
index += 1;
|
index += 1;
|
||||||
// The buffer is full, send it.
|
// The buffer is full, send it.
|
||||||
if (index >= buffer_size) {
|
if (index >= buffer_size) {
|
||||||
@ -58,6 +52,9 @@ void displayio_refresh_displays(void) {
|
|||||||
displayio_display_finish_region_update(display);
|
displayio_display_finish_region_update(display);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO(tannewt): Make refresh displays faster so we don't starve other
|
||||||
|
// background tasks.
|
||||||
|
usb_background();
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,12 +179,12 @@ void common_hal_displayio_release_displays(void) {
|
|||||||
} else if (bus_type == &displayio_fourwire_type) {
|
} else if (bus_type == &displayio_fourwire_type) {
|
||||||
common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus);
|
common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus);
|
||||||
} else if (bus_type == &displayio_parallelbus_type) {
|
} else if (bus_type == &displayio_parallelbus_type) {
|
||||||
//common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus);
|
common_hal_displayio_parallelbus_deinit(&displays[i].parallel_bus);
|
||||||
}
|
}
|
||||||
displays[i].fourwire_bus.base.type = NULL;
|
displays[i].fourwire_bus.base.type = &mp_type_NoneType;
|
||||||
}
|
}
|
||||||
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
|
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
|
||||||
displays[i].display.base.type = NULL;
|
displays[i].display.base.type = &mp_type_NoneType;
|
||||||
}
|
}
|
||||||
// TODO(tannewt): Clear the display datastructures and release everything used.
|
// TODO(tannewt): Clear the display datastructures and release everything used.
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user