forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add board support for HEIA-FR Picomo V3 with configuration files
- Loading branch information
Showing
7 changed files
with
254 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// This file is part of the CircuitPython project: https://circuitpython.org | ||
// | ||
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include "supervisor/board.h" | ||
#include "mpconfigboard.h" | ||
#include "shared-bindings/busio/SPI.h" | ||
#include "shared-bindings/fourwire/FourWire.h" | ||
#include "shared-module/displayio/__init__.h" | ||
#include "shared-module/displayio/mipi_constants.h" | ||
#include "supervisor/shared/board.h" | ||
|
||
|
||
#define DELAY 0x80 | ||
|
||
uint8_t display_init_sequence[] = { | ||
0x01, 0 | DELAY, 150, // SWRESET | ||
|
||
0x36, 1, 0x04, // MADCTL | ||
0x35, 1, 0x00, // TEON | ||
0xB2, 5, 0x0c, 0x0c, 0x00, 0x33, 0x33, // FRMCTR2 | ||
0x3A, 1, 0x05, // COLMOD | ||
0xB7, 1, 0x14, // GCTRL | ||
0xBB, 1, 0x37, // VCOMS | ||
0xC0, 1, 0x2c, // LCMCTRL | ||
0xC2, 1, 0x01, // VDVVRHEN | ||
0xC3, 1, 0x12, // VRHS | ||
0xC4, 1, 0x20, // VDVS | ||
0xD0, 2, 0xa4, 0xa1, // PWRCTRL1 | ||
0xC6, 1, 0x0f, // FRCTRL2 | ||
0xE0, 14, 0xd0, 0x04, 0x0d, 0x11, 0x13, 0x2b, 0x3f, 0x54, 0x4c, 0x18, 0x0d, 0x0b, 0x1f, 0x23, // GMCTRP1 | ||
0xE1, 14, 0xd0, 0x04, 0x0c, 0x11, 0x13, 0x2c, 0x3f, 0x44, 0x51, 0x2f, 0x1f, 0x1f, 0x20, 0x23, // GMCTRN1 | ||
0x21, 0, // INVON | ||
|
||
0x11, 0 | DELAY, 255, // SLPOUT | ||
0x29, 0 | DELAY, 100, // DISPON | ||
|
||
0x2a, 4, 0x00, 0, 0x00, 0xfe, // CASET | ||
0x2b, 4, 0x00, 0, 0x00, 0xfe, // RASET | ||
0x2c, 0, // RAMWR | ||
}; | ||
|
||
void board_init(void) { | ||
fourwire_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; | ||
busio_spi_obj_t *spi = &bus->inline_bus; | ||
common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, NULL, false); | ||
common_hal_busio_spi_never_reset(spi); | ||
|
||
bus->base.type = &fourwire_fourwire_type; | ||
common_hal_fourwire_fourwire_construct(bus, | ||
spi, | ||
&pin_GPIO16, // TFT_DC Command or data | ||
&pin_GPIO17, // TFT_CS Chip select | ||
NULL, // TFT_RST Reset | ||
62500000, // Baudrate | ||
0, // Polarity | ||
0); // Phase | ||
|
||
busdisplay_busdisplay_obj_t *display = &allocate_display()->display; | ||
display->base.type = &busdisplay_busdisplay_type; | ||
common_hal_busdisplay_busdisplay_construct(display, | ||
bus, | ||
240, // Width | ||
280, // Height | ||
0, // column start | ||
20, // row start | ||
0, // rotation | ||
16, // Color depth | ||
false, // Grayscale | ||
false, // pixels in a byte share a row. Only valid for depths < 8 | ||
1, // bytes per cell. Only valid for depths < 8 | ||
false, // reverse_pixels_in_byte. Only valid for depths < 8 | ||
true, // reverse_bytes_in_word | ||
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command | ||
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command | ||
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command | ||
display_init_sequence, | ||
sizeof(display_init_sequence), | ||
NULL, // no backlight pin | ||
NO_BRIGHTNESS_COMMAND, | ||
1.0f, // brightness | ||
false, // single_byte_bounds | ||
false, // data_as_commands | ||
true, // auto_refresh | ||
60, // native_frames_per_second | ||
true, // backlight_on_high | ||
false, // SH1107_addressing | ||
0); // backlight pwm frequency | ||
} | ||
|
||
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// This file is part of the CircuitPython project: https://circuitpython.org | ||
// | ||
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#pragma once | ||
|
||
#define MICROPY_HW_BOARD_NAME "HEIA-FR Picomo V3" | ||
#define MICROPY_HW_MCU_NAME "rp2040" | ||
|
||
#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO10) | ||
#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO9) | ||
#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO8) | ||
|
||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO21) | ||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO20) | ||
|
||
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) | ||
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) |
18 changes: 18 additions & 0 deletions
18
ports/raspberrypi/boards/heiafr_picomo_v3/mpconfigboard.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
USB_VID = 0x2E8A | ||
USB_PID = 0x10C4 | ||
|
||
USB_PRODUCT = "Picomo V3" | ||
USB_MANUFACTURER = "HEIA-FR" | ||
|
||
CHIP_VARIANT = RP2040 | ||
CHIP_FAMILY = rp2 | ||
|
||
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" | ||
|
||
CIRCUITPY__EVE = 1 | ||
|
||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register | ||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ST7789 | ||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Shapes | ||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text | ||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ProgressBar |
9 changes: 9 additions & 0 deletions
9
ports/raspberrypi/boards/heiafr_picomo_v3/pico-sdk-configboard.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// This file is part of the CircuitPython project: https://circuitpython.org | ||
// | ||
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#pragma once | ||
|
||
// Put board-specific pico-sdk definitions here. This file must exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// This file is part of the CircuitPython project: https://circuitpython.org | ||
// | ||
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include "shared-bindings/board/__init__.h" | ||
#include "shared-module/displayio/__init__.h" | ||
|
||
static const mp_rom_map_elem_t board_module_globals_table[] = { | ||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_SW_UP), MP_ROM_PTR(&pin_GPIO3)}, | ||
{MP_ROM_QSTR(MP_QSTR_S1), MP_ROM_PTR(&pin_GPIO3)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_SW_MID), MP_ROM_PTR(&pin_GPIO4)}, | ||
{MP_ROM_QSTR(MP_QSTR_S5), MP_ROM_PTR(&pin_GPIO4)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_SW_DOWN), MP_ROM_PTR(&pin_GPIO5)}, | ||
{MP_ROM_QSTR(MP_QSTR_S2), MP_ROM_PTR(&pin_GPIO5)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_SW_TOPR), MP_ROM_PTR(&pin_GPIO6)}, | ||
{MP_ROM_QSTR(MP_QSTR_BOOTSEL), MP_ROM_PTR(&pin_GPIO6)}, | ||
{MP_ROM_QSTR(MP_QSTR_S7), MP_ROM_PTR(&pin_GPIO6)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_SW_RIGHT), MP_ROM_PTR(&pin_GPIO7)}, | ||
{MP_ROM_QSTR(MP_QSTR_S4), MP_ROM_PTR(&pin_GPIO7)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO8)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO9)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO10)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12)}, | ||
{MP_ROM_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_GPIO12)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13)}, | ||
{MP_ROM_QSTR(MP_QSTR_VER_MSB), MP_ROM_PTR(&pin_GPIO13)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14)}, | ||
{MP_ROM_QSTR(MP_QSTR_VER_LSB), MP_ROM_PTR(&pin_GPIO14)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_DISP_DC), MP_ROM_PTR(&pin_GPIO16)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_DISP_CS), MP_ROM_PTR(&pin_GPIO17)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_DISP_SCL), MP_ROM_PTR(&pin_GPIO18)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_DISP_SDA), MP_ROM_PTR(&pin_GPIO19)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_TEMP_SDA), MP_ROM_PTR(&pin_GPIO20)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_TEMP_SCL), MP_ROM_PTR(&pin_GPIO21)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_SW_LEFT), MP_ROM_PTR(&pin_GPIO22)}, | ||
{MP_ROM_QSTR(MP_QSTR_S3), MP_ROM_PTR(&pin_GPIO22)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_SW_TOPL), MP_ROM_PTR(&pin_GPIO23)}, | ||
{MP_ROM_QSTR(MP_QSTR_S6), MP_ROM_PTR(&pin_GPIO23)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_USB_OVCUR), MP_ROM_PTR(&pin_GPIO24)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26)}, | ||
{MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27)}, | ||
{MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28)}, | ||
{MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28)}, | ||
{MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28)}, | ||
|
||
{MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29)}, | ||
{MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29)}, | ||
|
||
{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_DISPLAY), MP_ROM_PTR(&displays[0].display)}, | ||
}; | ||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters