Skip to content

Commit dc0ff3c

Browse files
committed
adding support for elecrow crowpanel 4.2 epaper device
1 parent 22e5a09 commit dc0ff3c

File tree

5 files changed

+142
-0
lines changed

5 files changed

+142
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "supervisor/board.h"
8+
9+
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
10+
11+
// TODO:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
// Micropython setup
10+
11+
#define MICROPY_HW_BOARD_NAME "CrowPanel 4.2 EPaper"
12+
#define MICROPY_HW_MCU_NAME "ESP32S3"
13+
#define MICROPY_HW_LED_STATUS (&pin_GPIO17)
14+
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
15+
16+
#define CIRCUITPY_BOARD_SPI (2)
17+
#define CIRCUITPY_BOARD_SPI_PIN { \
18+
{.clock = &pin_GPIO39, .mosi = &pin_GPIO40, .miso = &pin_GPIO13}, /*SD*/ \
19+
{.clock = &pin_GPIO12, .mosi = &pin_GPIO11}, /*EPD*/ \
20+
}
21+
22+
// UART pins attached to the USB-serial converter chip
23+
#define DEFAULT_UART_BUS_RX (&pin_GPIO43)
24+
#define DEFAULT_UART_BUS_TX (&pin_GPIO44)
25+
26+
#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX
27+
#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
CIRCUITPY_CREATOR_ID = 0x1C350000
2+
CIRCUITPY_CREATION_ID = 0x00000001
3+
4+
# This board doesn't have USB by default, it
5+
# instead uses a CH340C USB-to-Serial chip
6+
CIRCUITPY_USB_DEVICE = 0
7+
CIRCUITPY_ESP_USB_SERIAL_JTAG = 0
8+
9+
IDF_TARGET = esp32s3
10+
11+
CIRCUITPY_ESP_FLASH_SIZE = 8MB
12+
CIRCUITPY_ESP_FLASH_MODE = qio
13+
CIRCUITPY_ESP_FLASH_FREQ = 80m
14+
15+
CIRCUITPY_ESP_PSRAM_SIZE = 8MB
16+
CIRCUITPY_ESP_PSRAM_MODE = opi
17+
CIRCUITPY_ESP_PSRAM_FREQ = 80m
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "shared-bindings/board/__init__.h"
8+
#include "shared-module/displayio/__init__.h"
9+
10+
CIRCUITPY_BOARD_BUS_SINGLETON(tf_spi, spi, 0)
11+
CIRCUITPY_BOARD_BUS_SINGLETON(epd_spi, spi, 1)
12+
13+
14+
static const mp_rom_map_elem_t board_module_globals_table[] = {
15+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
16+
17+
// Buttons
18+
{ MP_ROM_QSTR(MP_QSTR_BUTTON_BOOT), MP_ROM_PTR(&pin_GPIO0) },
19+
{ MP_ROM_QSTR(MP_QSTR_BUTTON_EXIT), MP_ROM_PTR(&pin_GPIO1) },
20+
{ MP_ROM_QSTR(MP_QSTR_BUTTON_MENU), MP_ROM_PTR(&pin_GPIO2) },
21+
22+
// Rocker Switch
23+
{ MP_ROM_QSTR(MP_QSTR_ROCKER_DOWN), MP_ROM_PTR(&pin_GPIO4) },
24+
{ MP_ROM_QSTR(MP_QSTR_ROCKER_CLICK), MP_ROM_PTR(&pin_GPIO5) },
25+
{ MP_ROM_QSTR(MP_QSTR_ROCKER_UP), MP_ROM_PTR(&pin_GPIO6) },
26+
27+
// LED
28+
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO41) },
29+
30+
// Device Control (Pins that, when activated, enable devices)
31+
{ MP_ROM_QSTR(MP_QSTR_EPD_ENABLE), MP_ROM_PTR(&pin_GPIO7) },
32+
{ MP_ROM_QSTR(MP_QSTR_TF_ENABLE), MP_ROM_PTR(&pin_GPIO42) },
33+
34+
// EPD
35+
{ MP_ROM_QSTR(MP_QSTR_EPD_BUSY), MP_ROM_PTR(&pin_GPIO48) },
36+
{ MP_ROM_QSTR(MP_QSTR_EPD_RES), MP_ROM_PTR(&pin_GPIO47) },
37+
{ MP_ROM_QSTR(MP_QSTR_EPD_DC), MP_ROM_PTR(&pin_GPIO46) },
38+
{ MP_ROM_QSTR(MP_QSTR_EPD_CS), MP_ROM_PTR(&pin_GPIO45) },
39+
{ MP_ROM_QSTR(MP_QSTR_EPD_CLK), MP_ROM_PTR(&pin_GPIO12) },
40+
{ MP_ROM_QSTR(MP_QSTR_EPD_MOSI), MP_ROM_PTR(&pin_GPIO10) },
41+
42+
// TF Slot
43+
{ MP_ROM_QSTR(MP_QSTR_TF_CS), MP_ROM_PTR(&pin_GPIO10) },
44+
{ MP_ROM_QSTR(MP_QSTR_TF_MOSI), MP_ROM_PTR(&pin_GPIO40) },
45+
{ MP_ROM_QSTR(MP_QSTR_TF_CLK), MP_ROM_PTR(&pin_GPIO39) },
46+
{ MP_ROM_QSTR(MP_QSTR_TF_MISO), MP_ROM_PTR(&pin_GPIO13) },
47+
48+
// User accessible GPIO
49+
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
50+
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
51+
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
52+
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
53+
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
54+
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
55+
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
56+
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
57+
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
58+
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
59+
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
60+
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
61+
62+
// TODO: Are the UART pins really this, or are they reversed?
63+
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO44) },
64+
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO43) },
65+
66+
// Objects
67+
{ MP_ROM_QSTR(MP_QSTR_TF_SPI), MP_ROM_PTR(&board_tf_spi_obj) },
68+
{ MP_ROM_QSTR(MP_QSTR_EPD_SPI), MP_ROM_PTR(&board_epd_spi_obj) },
69+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
70+
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)},
71+
72+
};
73+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# Espressif IoT Development Framework Configuration
3+
#
4+
#
5+
# Component config
6+
#
7+
#
8+
# LWIP
9+
#
10+
# end of LWIP
11+
12+
# end of Component config
13+
14+
# end of Espressif IoT Development Framework Configuration

0 commit comments

Comments
 (0)