From 1b3e8fa2cf53c87646025132553c5dabdce585f1 Mon Sep 17 00:00:00 2001 From: M5Stack Date: Thu, 17 Aug 2017 21:16:57 +0800 Subject: [PATCH] Add "M5Stack-Core-ESP32" boards support --- boards.txt | 66 ++++++++++++++++++++++ variants/m5stack-core-esp32/pins_arduino.h | 55 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 variants/m5stack-core-esp32/pins_arduino.h diff --git a/boards.txt b/boards.txt index 286d9288..8009add7 100644 --- a/boards.txt +++ b/boards.txt @@ -909,3 +909,69 @@ espino32.menu.UploadSpeed.460800.macosx=460800 espino32.menu.UploadSpeed.460800.upload.speed=460800 espino32.menu.UploadSpeed.512000.windows=512000 espino32.menu.UploadSpeed.512000.upload.speed=512000 + +############################################################## + +m5stack-core-esp32.name=M5Stack-Core-ESP32 + +m5stack-core-esp32.upload.tool=esptool +m5stack-core-esp32.upload.maximum_size=1310720 +m5stack-core-esp32.upload.maximum_data_size=294912 +m5stack-core-esp32.upload.wait_for_upload_port=true + +m5stack-core-esp32.serial.disableDTR=true +m5stack-core-esp32.serial.disableRTS=true + +m5stack-core-esp32.build.mcu=esp32 +m5stack-core-esp32.build.core=esp32 +m5stack-core-esp32.build.variant=esp32 +m5stack-core-esp32.build.board=M5Stack-Core-ESP32 + +m5stack-core-esp32.build.f_cpu=240000000L +m5stack-core-esp32.build.flash_size=4MB +m5stack-core-esp32.build.flash_mode=dio +m5stack-core-esp32.build.boot=bootloader + +m5stack-core-esp32.menu.FlashMode.qio=QIO +m5stack-core-esp32.menu.FlashMode.qio.build.flash_mode=dio +m5stack-core-esp32.menu.FlashMode.qio.build.boot=bootloader_qio +m5stack-core-esp32.menu.FlashMode.dio=DIO +m5stack-core-esp32.menu.FlashMode.dio.build.flash_mode=dio +m5stack-core-esp32.menu.FlashMode.qout=QOUT +m5stack-core-esp32.menu.FlashMode.qout.build.flash_mode=dout +m5stack-core-esp32.menu.FlashMode.qout.build.boot=bootloader_qio +m5stack-core-esp32.menu.FlashMode.dout=DOUT +m5stack-core-esp32.menu.FlashMode.dout.build.flash_mode=dout + +m5stack-core-esp32.menu.FlashFreq.80=80MHz +m5stack-core-esp32.menu.FlashFreq.80.build.flash_freq=80m +m5stack-core-esp32.menu.FlashFreq.40=40MHz +m5stack-core-esp32.menu.FlashFreq.40.build.flash_freq=40m + +m5stack-core-esp32.menu.UploadSpeed.921600=921600 +m5stack-core-esp32.menu.UploadSpeed.921600.upload.speed=921600 +m5stack-core-esp32.menu.UploadSpeed.115200=115200 +m5stack-core-esp32.menu.UploadSpeed.115200.upload.speed=115200 +m5stack-core-esp32.menu.UploadSpeed.256000.windows=256000 +m5stack-core-esp32.menu.UploadSpeed.256000.upload.speed=256000 +m5stack-core-esp32.menu.UploadSpeed.230400.windows.upload.speed=256000 +m5stack-core-esp32.menu.UploadSpeed.230400=230400 +m5stack-core-esp32.menu.UploadSpeed.230400.upload.speed=230400 +m5stack-core-esp32.menu.UploadSpeed.460800.linux=460800 +m5stack-core-esp32.menu.UploadSpeed.460800.macosx=460800 +m5stack-core-esp32.menu.UploadSpeed.460800.upload.speed=460800 +m5stack-core-esp32.menu.UploadSpeed.512000.windows=512000 +m5stack-core-esp32.menu.UploadSpeed.512000.upload.speed=512000 + +m5stack-core-esp32.menu.DebugLevel.none=None +m5stack-core-esp32.menu.DebugLevel.none.build.code_debug=0 +m5stack-core-esp32.menu.DebugLevel.error=Error +m5stack-core-esp32.menu.DebugLevel.error.build.code_debug=1 +m5stack-core-esp32.menu.DebugLevel.warn=Warn +m5stack-core-esp32.menu.DebugLevel.warn.build.code_debug=2 +m5stack-core-esp32.menu.DebugLevel.info=Info +m5stack-core-esp32.menu.DebugLevel.info.build.code_debug=3 +m5stack-core-esp32.menu.DebugLevel.debug=Debug +m5stack-core-esp32.menu.DebugLevel.debug.build.code_debug=4 +m5stack-core-esp32.menu.DebugLevel.verbose=Verbose +m5stack-core-esp32.menu.DebugLevel.verbose.build.code_debug=5 diff --git a/variants/m5stack-core-esp32/pins_arduino.h b/variants/m5stack-core-esp32/pins_arduino.h new file mode 100644 index 00000000..d2d87d4f --- /dev/null +++ b/variants/m5stack-core-esp32/pins_arduino.h @@ -0,0 +1,55 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 20 +#define NUM_ANALOG_INPUTS 16 + +#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t TXD2 = 17; +static const uint8_t RXD2 = 16; + +static const uint8_t SDA = 21; +static const uint8_t SCL = 22; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 23; +static const uint8_t MISO = 19; +static const uint8_t SCK = 18; + +static const uint8_t G23 = 23; +static const uint8_t G19 = 19; +static const uint8_t G18 = 18; +static const uint8_t G3 = 3; +static const uint8_t G16 = 16; +static const uint8_t G21 = 21; +static const uint8_t G2 = 2; +static const uint8_t G12 = 12; +static const uint8_t G15 = 15; +static const uint8_t G35 = 35; +static const uint8_t G36 = 36; +static const uint8_t G25 = 25; +static const uint8_t G26 = 26; +static const uint8_t G1 = 1; +static const uint8_t G17 = 17; +static const uint8_t G22 = 22; +static const uint8_t G5 = 5; +static const uint8_t G13 = 13; +static const uint8_t G0 = 0; +static const uint8_t G34 = 34; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +static const uint8_t ADC1 = 35; +static const uint8_t ADC2 = 36; + +#endif /* Pins_Arduino_h */