Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for esp32 board "Heltec wifikit 32 v2" #8713

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
111 changes: 111 additions & 0 deletions ports/espressif/boards/heltec_esp32_wifikit_32_v2/board.c
@@ -0,0 +1,111 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 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
* 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 "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/board/__init__.h"
#include "shared-bindings/i2cdisplaybus/I2CDisplayBus.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"
#include "shared-bindings/busio/I2C.h"
#include "supervisor/shared/board.h"
#include "shared-bindings/board/__init__.h"

uint8_t display_init_sequence[] = { // SSD1306
0xAE, 0, // DISPLAY_OFF
0x20, 1, 0x00, // Set memory addressing to horizontal mode.
0x81, 1, 0xcf, // set contrast control
0xA1, 0, // Column 127 is segment 0
0xA6, 0, // Normal display
0xc8, 0, // Normal display
0xA8, 1, 0x3F, // Mux ratio is height-1
0xd5, 1, 0x80, // Set divide ratio
0xd9, 1, 0xf1, // Set pre-charge period
0xda, 1, 0x12, // 0x12 cause 64 height, but 0x02 if it's 32 height
0xdb, 1, 0x40, // Set vcom configuration
0x8d, 1, 0x14, // Enable charge pump
0xAF, 0, // DISPLAY_ON
};

digitalio_digitalinout_obj_t display_on;

static void display_init(void) {
// Need to bring GPIO16 high or the screen doesn't get power
// & the board can't see the i2c bus at all.
common_hal_digitalio_digitalinout_construct(&display_on, &pin_GPIO16);
common_hal_digitalio_digitalinout_switch_to_output(&display_on, true, DRIVE_MODE_PUSH_PULL);
common_hal_digitalio_digitalinout_never_reset(&display_on);
busio_i2c_obj_t *i2c = common_hal_board_create_i2c(0);
i2cdisplaybus_i2cdisplaybus_obj_t *bus = &allocate_display_bus()->i2cdisplay_bus;
bus->base.type = &i2cdisplaybus_i2cdisplaybus_type;

common_hal_i2cdisplaybus_i2cdisplaybus_construct(
bus,
i2c,
0x3c,
NULL
);

busdisplay_busdisplay_obj_t *display = &allocate_display()->display;
display->base.type = &busdisplay_busdisplay_type;
common_hal_busdisplay_busdisplay_construct(display,
bus,
128, // Width
64, // Height
0, // column start
0, // row start
0, // rotation
1, // Color depth
true, // grayscale
false, // pixels in byte share row. Only used with depth < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
true, // reverse_pixels_in_word
0x21, // Set column command
0x22, // Set row command
44, // Write ram command
display_init_sequence,
sizeof(display_init_sequence),
NULL, // no backlight pin
0x81, // brightness command
1.0f, // brightness
true, // single_byte_bounds
true, // data as commands
true, // auto_refresh
60, // native_frames_per_second
true, // backlight_on_high
false, // SH1107_addressing
0); // backlight pwm frequency


}

void board_init(void) {
display_init();
}

// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
44 changes: 44 additions & 0 deletions ports/espressif/boards/heltec_esp32_wifikit_32_v2/mpconfigboard.h
@@ -0,0 +1,44 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 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
* 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.
*/

// Micropython setup

#define MICROPY_HW_BOARD_NAME "Heltec esp32-wifikit-32-v2"
#define MICROPY_HW_MCU_NAME "ESP32"

#define MICROPY_HW_LED_STATUS (&pin_GPIO25) // Pulled from schematic

// I2C
#define CIRCUITPY_BOARD_I2C (1)
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO15, .sda = &pin_GPIO4}}

// UART definition for UART connected to the CP210x
#define DEFAULT_UART_BUS_RX (&pin_GPIO3)
#define DEFAULT_UART_BUS_TX (&pin_GPIO1)

// Serial over UART
#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX
#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX
36 changes: 36 additions & 0 deletions ports/espressif/boards/heltec_esp32_wifikit_32_v2/mpconfigboard.mk
@@ -0,0 +1,36 @@
# Product URL: disappeared/discontinued
# Datasheet: https://resource.heltec.cn/download/WiFi_Kit_32/WiFi%20Kit32.pdf
# There is apparently a typo with TX/RX (and other) GPIO descriptions
# in the Pin Description table: It should be GPIO1 / GPIO3 and all above 39 seem not to be available on esp32
#
# Schematic: https://resource.heltec.cn/download/WiFi_Kit_32/WIFI_Kit_32_Schematic_diagram_V2.pdf
# https://resource.heltec.cn/download/WiFi_Kit_32/WIFI_Kit_32_Schematic_diagram_V2.1.PDF
# (same as V2, but V2.1 is better readable)
# Pinout: https://resource.heltec.cn/download/WiFi_Kit_32/WIFI_Kit_32_pinoutDiagram_V2.pdf
# https://resource.heltec.cn/download/WiFi_Kit_32/WIFI_Kit_32_pinoutDiagram_V2.1.pdf
# (exactly same as V2 [md5sum of pdf is 9ee18bb5abe0a41fe98825cc756e8e3e])

CIRCUITPY_CREATOR_ID = 0x148E173C
CIRCUITPY_CREATION_ID = 0x00320001

USB_PRODUCT = "esp32-wifikit-32-v2"
USB_MANUFACTURER = "Heltec"

IDF_TARGET = esp32

DEBUG = 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this affects the global CP build settings, but if it does, it should absolutely not be done.

ESPTOOL_FLAGS = --before=default_reset --after=hard_reset --baud 921600

CIRCUITPY_ESP_FLASH_MODE = dio
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to tell this from the module or the schematic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has no influence to flashing process nor what debug output at startup reports: It's always mentioned "dio".

I set it to dio for now. Done.

# esp-idf-config/sdkconfig-flash-26m.defaults does not exist in main branch
CIRCUITPY_ESP_FLASH_FREQ = 26m
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually the flash frequency, or just the crystal frequency? You can choose the flash frequency.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I have no clue. This is what the flashing tool reports and I don't know where else to get the info from:

esptool.py v4.7.dev3
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 26MHz
MAC: 24:0a:c4:5c:11:d8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00155fff...
Compressed 1399360 bytes to 952771...
Wrote 1399360 bytes (952771 compressed) at 0x00000000 in 19.5 seconds (effective 575.6 kbit/s)...
Hash of data verified.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most espressif boards that I know of run their flash chips at 40m or 80m.
You can try different settings and see what works.
Unless it's using a unique or absolutely ancient chip, it will probably work at 40m.


# This has something to do with XTAL Config support?:
# However, without his setting cp refuses to build
CIRCUITPY_CANIO = 0

CIRCUITPY_ESP_FLASH_SIZE = 8MB

CIRCUITPY_ESPCAMERA = 0

CIRCUITPY_DISPLAYIO = 1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be added.
Displayio is enabled by default.

The compile should fail if the user tries to disable displayio, not ignore the settings and succeed.

152 changes: 152 additions & 0 deletions ports/espressif/boards/heltec_esp32_wifikit_32_v2/pins.c
@@ -0,0 +1,152 @@
#include "shared-bindings/board/__init__.h"

#include "shared-module/displayio/__init__.h"

/**
Info/Warning: There are copy/paste typos in the Datasheet:
https://resource.heltec.cn/download/WiFi_Kit_32/WiFi%20Kit32.pdf
There is apparently a typo with TX/RX (and other) GPIO descriptions
in the Pin Description table: It should be GPIO1 / GPIO3 and all above 39 seem not to be available on esp32

It seems that the author took an ESP32-S3FN8 based WiFi_LoRa_32_V3/HTIT-WB32LA_V3(Rev1.1)
or other board as reference and did not doublecheck the Pin description table.
See also: https://resource.heltec.cn/download/WiFi_LoRa_32_V3/HTIT-WB32LA_V3(Rev1.1).pdf

esp pin definitions: ports/espressif/peripherals/esp32/pins.c
*/

STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS

{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },

{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },

{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_IO22), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_IO23), MP_ROM_PTR(&pin_GPIO23) },

{ MP_ROM_QSTR(MP_QSTR_IO25), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_IO27), MP_ROM_PTR(&pin_GPIO27) },

/* According to https://resource.heltec.cn/download/WiFi_Kit_32/WIFI_Kit_32_pinoutDiagram_V2.pdf
GPIO input only
*/
{ MP_ROM_QSTR(MP_QSTR_IN32), MP_ROM_PTR(&pin_GPIO32) },
{ MP_ROM_QSTR(MP_QSTR_IN33), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_IN34), MP_ROM_PTR(&pin_GPIO34) },
{ MP_ROM_QSTR(MP_QSTR_IN35), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_IN36), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_IN37), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_IN38), MP_ROM_PTR(&pin_GPIO38) },
{ MP_ROM_QSTR(MP_QSTR_IN39), MP_ROM_PTR(&pin_GPIO39) },

{ MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_GPIO1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO5) },

{ MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO19) },

{ MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO23) },

{ MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO27) },

/* According to https://resource.heltec.cn/download/WiFi_Kit_32/WIFI_Kit_32_pinoutDiagram_V2.pdf
GPIO input only
*/
{ MP_ROM_QSTR(MP_QSTR_GPIO32), MP_ROM_PTR(&pin_GPIO32) },
{ MP_ROM_QSTR(MP_QSTR_GPIO33), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_GPIO34), MP_ROM_PTR(&pin_GPIO34) },
{ MP_ROM_QSTR(MP_QSTR_GPIO35), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_GPIO36), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_GPIO37), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_GPIO38), MP_ROM_PTR(&pin_GPIO38) },
{ MP_ROM_QSTR(MP_QSTR_GPIO39), MP_ROM_PTR(&pin_GPIO39) },

/* WiP
See this discussion: https://hackaday.io/project/27791-esp32-lora-oled-module/log/69600-battery-voltage-measurement
and http://community.heltec.cn/t/wifi-kit-32-detect-switch-to-battery-power/5206/4

Reading the schematics right, there's probably no ADC_IN for battery measurement
*/
{ MP_ROM_QSTR(MP_QSTR_BAT_ADC), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_PWR), MP_ROM_PTR(&pin_GPIO13) },

{ MP_ROM_QSTR(MP_QSTR_BTN_PRG), MP_ROM_PTR(&pin_GPIO0) },

{ MP_ROM_QSTR(MP_QSTR_TOUCH0), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH1), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH3), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH4), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH5), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH6), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH7), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH8), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_TOUCH9), MP_ROM_PTR(&pin_GPIO2) },

{ MP_ROM_QSTR(MP_QSTR_ADC1_CH0), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_ADC1_CH1), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_ADC1_CH2), MP_ROM_PTR(&pin_GPIO38) },
{ MP_ROM_QSTR(MP_QSTR_ADC1_CH3), MP_ROM_PTR(&pin_GPIO39) },
{ MP_ROM_QSTR(MP_QSTR_ADC1_CH4), MP_ROM_PTR(&pin_GPIO32) },
{ MP_ROM_QSTR(MP_QSTR_ADC1_CH5), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_ADC1_CH6), MP_ROM_PTR(&pin_GPIO34) },
{ MP_ROM_QSTR(MP_QSTR_ADC1_CH7), MP_ROM_PTR(&pin_GPIO35) },

{ MP_ROM_QSTR(MP_QSTR_ADC2_CH0), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH1), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH3), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH4), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH5), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH6), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH7), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH8), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_ADC2_CH9), MP_ROM_PTR(&pin_GPIO26) },

{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) },

// UART that's connected to CP210x over USB
{ MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_TX), MP_ROM_PTR(&pin_GPIO1) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_RX), MP_ROM_PTR(&pin_GPIO3) },

{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

// OLED I2C & Reset
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },

{ MP_ROM_QSTR(MP_QSTR_OLED_RST), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_OLED_SDA), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_OLED_SCL), MP_ROM_PTR(&pin_GPIO15) },

{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
27 changes: 27 additions & 0 deletions ports/espressif/boards/heltec_esp32_wifikit_32_v2/sdkconfig
@@ -0,0 +1,27 @@
#
# Espressif IoT Development Framework Configuration
#
#
# Component config
#
#
# LWIP
#
CONFIG_ESP_PHY_ENABLE_USB=n
CONFIG_LWIP_LOCAL_HOSTNAME="HELTEC-ESP32-V2"
# end of LWIP

CONFIG_XTAL_FREQ_26=y
CONFIG_XTAL_FREQ=26

CONFIG_ESP_CONSOLE_UART_CUSTOM=y
CONFIG_ESP_CONSOLE_UART=y
CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1=y
CONFIG_ESP_CONSOLE_UART_NUM=1
CONFIG_ESP_CONSOLE_UART_TX_GPIO=1
CONFIG_ESP_CONSOLE_UART_RX_GPIO=3
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200

# end of Component config

# end of Espressif IoT Development Framework Configuration
14 changes: 14 additions & 0 deletions ports/espressif/esp-idf-config/sdkconfig-flash-26m.defaults
@@ -0,0 +1,14 @@
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_26M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT is not set