From 465e455fff33350ae1414e3e4585f87ada1064e5 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 21 Oct 2018 20:16:02 +0200 Subject: [PATCH 01/10] Create pins_arduino.h --- variants/lopy/pins_arduino.h | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 variants/lopy/pins_arduino.h diff --git a/variants/lopy/pins_arduino.h b/variants/lopy/pins_arduino.h new file mode 100644 index 00000000000..83b9b1ce949 --- /dev/null +++ b/variants/lopy/pins_arduino.h @@ -0,0 +1,71 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 24 +#define NUM_ANALOG_INPUTS 18 + +#define analogInputToDigitalPin(p) (((p)<40)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +// SPI LoRa Radio +#define LORA_SCK 5 // GPIO5 - SX1276 SCK +#define LORA_MISO 19 // GPIO19 - SX1276 MISO +#define LORA_MOSI 27 // GPIO27 - SX1276 MOSI +#define LORA_CS 17 // GPIO17 - SX1276 CS +#define LORA_RST 18 // GPIO18 - SX1276 RST +#define LORA_IO0 23 // GPIO23 - SX1276 IO0 +#define LORA_IO1 23 // GPIO23 - SX1276 IO1 tied by diode to IO0 +#define LORA_IO2 23 // GPIO23 - SX1276 IO2 tied by diode to IO0 + +// Antenna select +#define ANT_SELECT 16 // GPIO16 - External Antenna Switch + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 12; +static const uint8_t SCL = 13; + +static const uint8_t SS = 17; +static const uint8_t MOSI = 22; +static const uint8_t MISO = 37; +static const uint8_t SCK = 5; + +static const uint8_t A0 = 36; +static const uint8_t A1 = 37; +static const uint8_t A2 = 38; +static const uint8_t A3 = 39; +static const uint8_t A4 = 32; +static const uint8_t A5 = 33; +static const uint8_t A6 = 34; +static const uint8_t A7 = 35; +static const uint8_t A10 = 4; +static const uint8_t A11 = 0; +static const uint8_t A12 = 2; +static const uint8_t A13 = 15; +static const uint8_t A14 = 13; +static const uint8_t A14 = 12; +static const uint8_t A16 = 14; +static const uint8_t A17 = 27; +static const uint8_t A18 = 25; +static const uint8_t A19 = 26; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +#endif /* Pins_Arduino_h */ From e4d648b35ce98aeaf7e11648e9d81d5d15c92cd7 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 21 Oct 2018 20:24:39 +0200 Subject: [PATCH 02/10] Update boards.txt Pycom LoPy + LoPy4 boards added --- boards.txt | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/boards.txt b/boards.txt index 7a86797c95a..9984547b69a 100644 --- a/boards.txt +++ b/boards.txt @@ -2439,3 +2439,121 @@ t-beam.menu.DebugLevel.debug.build.code_debug=4 t-beam.menu.DebugLevel.verbose=Verbose t-beam.menu.DebugLevel.verbose.build.code_debug=5 +############################################################## + +lopy.name=LoPy + +lopy.upload.tool=esptool +lopy.upload.maximum_size=1310720 +lopy.upload.maximum_data_size=327680 +lopy.upload.wait_for_upload_port=true + +lopy.serial.disableDTR=true +lopy.serial.disableRTS=true + +lopy.build.mcu=esp32 +lopy.build.core=esp32 +lopy.build.variant=lopy +lopy.build.board=LoPy + +lopy.build.f_cpu=240000000L +lopy.build.flash_mode=dio +lopy.build.flash_size=4MB +lopy.build.boot=dio +lopy.build.partitions=default + +lopy.menu.FlashFreq.80=80MHz +lopy.menu.FlashFreq.80.build.flash_freq=80m +lopy.menu.FlashFreq.40=40MHz +lopy.menu.FlashFreq.40.build.flash_freq=40m + +lopy.menu.UploadSpeed.921600=921600 +lopy.menu.UploadSpeed.921600.upload.speed=921600 +lopy.menu.UploadSpeed.115200=115200 +lopy.menu.UploadSpeed.115200.upload.speed=115200 +lopy.menu.UploadSpeed.256000.windows=256000 +lopy.menu.UploadSpeed.256000.upload.speed=256000 +lopy.menu.UploadSpeed.230400.windows.upload.speed=256000 +lopy.menu.UploadSpeed.230400=230400 +lopy.menu.UploadSpeed.230400.upload.speed=230400 +lopy.menu.UploadSpeed.460800.linux=460800 +lopy.menu.UploadSpeed.460800.macosx=460800 +lopy.menu.UploadSpeed.460800.upload.speed=460800 +lopy.menu.UploadSpeed.512000.windows=512000 +lopy.menu.UploadSpeed.512000.upload.speed=512000 + +lopy.menu.DebugLevel.none=None +lopy.menu.DebugLevel.none.build.code_debug=0 +lopy.menu.DebugLevel.error=Error +lopy.menu.DebugLevel.error.build.code_debug=1 +lopy.menu.DebugLevel.warn=Warn +lopy.menu.DebugLevel.warn.build.code_debug=2 +lopy.menu.DebugLevel.info=Info +lopy.menu.DebugLevel.info.build.code_debug=3 +lopy.menu.DebugLevel.debug=Debug +lopy.menu.DebugLevel.debug.build.code_debug=4 +lopy.menu.DebugLevel.verbose=Verbose +lopy.menu.DebugLevel.verbose.build.code_debug=5 + +############################################################## + +lopy4.name=LoPy4 + +lopy4.upload.tool=esptool +lopy4.upload.maximum_size=1310720 +lopy4.upload.maximum_data_size=327680 +lopy4.upload.wait_for_upload_port=true + +lopy4.serial.disableDTR=true +lopy4.serial.disableRTS=true + +lopy4.build.mcu=esp32 +lopy4.build.core=esp32 +lopy4.build.variant=lopy +lopy4.build.board=LoPy + +lopy4.build.f_cpu=240000000L +lopy4.build.flash_mode=dio +lopy4.build.flash_size=4MB +lopy4.build.boot=dio +lopy4.build.partitions=default + +lopy4.menu.PSRAM.disabled=Disabled +lopy4.menu.PSRAM.disabled.build.defines= +lopy4.menu.PSRAM.enabled=Enabled +lopy4.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue + +lopy4.menu.FlashFreq.80=80MHz +lopy4.menu.FlashFreq.80.build.flash_freq=80m +lopy4.menu.FlashFreq.40=40MHz +lopy4.menu.FlashFreq.40.build.flash_freq=40m + +lopy4.menu.UploadSpeed.921600=921600 +lopy4.menu.UploadSpeed.921600.upload.speed=921600 +lopy4.menu.UploadSpeed.115200=115200 +lopy4.menu.UploadSpeed.115200.upload.speed=115200 +lopy4.menu.UploadSpeed.256000.windows=256000 +lopy4.menu.UploadSpeed.256000.upload.speed=256000 +lopy4.menu.UploadSpeed.230400.windows.upload.speed=256000 +lopy4.menu.UploadSpeed.230400=230400 +lopy4.menu.UploadSpeed.230400.upload.speed=230400 +lopy4.menu.UploadSpeed.460800.linux=460800 +lopy4.menu.UploadSpeed.460800.macosx=460800 +lopy4.menu.UploadSpeed.460800.upload.speed=460800 +lopy4.menu.UploadSpeed.512000.windows=512000 +lopy4.menu.UploadSpeed.512000.upload.speed=512000 + +lopy4.menu.DebugLevel.none=None +lopy4.menu.DebugLevel.none.build.code_debug=0 +lopy4.menu.DebugLevel.error=Error +lopy4.menu.DebugLevel.error.build.code_debug=1 +lopy4.menu.DebugLevel.warn=Warn +lopy4.menu.DebugLevel.warn.build.code_debug=2 +lopy4.menu.DebugLevel.info=Info +lopy4.menu.DebugLevel.info.build.code_debug=3 +lopy4.menu.DebugLevel.debug=Debug +lopy4.menu.DebugLevel.debug.build.code_debug=4 +lopy4.menu.DebugLevel.verbose=Verbose +lopy4.menu.DebugLevel.verbose.build.code_debug=5 + + From db53a21c2b4f287c7aedf36ce3fcd9485c852ec4 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 21 Oct 2018 20:33:36 +0200 Subject: [PATCH 03/10] Create pins_arduino.h --- variants/lopy4/pins_arduino.h | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 variants/lopy4/pins_arduino.h diff --git a/variants/lopy4/pins_arduino.h b/variants/lopy4/pins_arduino.h new file mode 100644 index 00000000000..7a70664e1f9 --- /dev/null +++ b/variants/lopy4/pins_arduino.h @@ -0,0 +1,69 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define EXTERNAL_NUM_INTERRUPTS 16 +#define NUM_DIGITAL_PINS 24 +#define NUM_ANALOG_INPUTS 18 + +#define analogInputToDigitalPin(p) (((p)<40)?(esp32_adc2gpio[(p)]):-1) +#define digitalPinToInterrupt(p) (((p)<40)?(p):-1) +#define digitalPinHasPWM(p) (p < 34) + +// SPI LoRa Radio +#define LORA_SCK 5 // GPIO5 - SX1276 SCK +#define LORA_MISO 19 // GPIO19 - SX1276 MISO +#define LORA_MOSI 27 // GPIO27 - SX1276 MOSI +#define LORA_CS 18 // GPIO18 - SX1276 CS +#define LORA_IO0 23 // GPIO23 - SX1276 IO0 +#define LORA_IO1 23 // GPIO23 - SX1276 IO1 tied by diode to IO0 +#define LORA_IO2 23 // GPIO23 - SX1276 IO2 tied by diode to IO0 + +// Antenna select +#define ANT_SELECT 16 // GPIO16 - External Antenna Switch + +static const uint8_t TX = 1; +static const uint8_t RX = 3; + +static const uint8_t SDA = 12; +static const uint8_t SCL = 13; + +static const uint8_t MOSI = 22; +static const uint8_t MISO = 37; +static const uint8_t SCK = 5; + +static const uint8_t A0 = 36; +static const uint8_t A1 = 37; +static const uint8_t A2 = 38; +static const uint8_t A3 = 39; +static const uint8_t A4 = 32; +static const uint8_t A5 = 33; +static const uint8_t A6 = 34; +static const uint8_t A7 = 35; +static const uint8_t A10 = 4; +static const uint8_t A11 = 0; +static const uint8_t A12 = 2; +static const uint8_t A13 = 15; +static const uint8_t A14 = 13; +static const uint8_t A14 = 12; +static const uint8_t A16 = 14; +static const uint8_t A17 = 27; +static const uint8_t A18 = 25; +static const uint8_t A19 = 26; + +static const uint8_t T0 = 4; +static const uint8_t T1 = 0; +static const uint8_t T2 = 2; +static const uint8_t T3 = 15; +static const uint8_t T4 = 13; +static const uint8_t T5 = 12; +static const uint8_t T6 = 14; +static const uint8_t T7 = 27; +static const uint8_t T8 = 33; +static const uint8_t T9 = 32; + +static const uint8_t DAC1 = 25; +static const uint8_t DAC2 = 26; + +#endif /* Pins_Arduino_h */ From cf71a179a00324461a858a2559f6788cfb6d2155 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sun, 21 Oct 2018 23:24:23 +0200 Subject: [PATCH 04/10] Update pins_arduino.h bugfix antenna switch GPIO port 16 -> 21 --- variants/lopy4/pins_arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/lopy4/pins_arduino.h b/variants/lopy4/pins_arduino.h index 7a70664e1f9..32e85ccb12d 100644 --- a/variants/lopy4/pins_arduino.h +++ b/variants/lopy4/pins_arduino.h @@ -21,7 +21,7 @@ #define LORA_IO2 23 // GPIO23 - SX1276 IO2 tied by diode to IO0 // Antenna select -#define ANT_SELECT 16 // GPIO16 - External Antenna Switch +#define ANT_SELECT 21 // GPIO16 - External Antenna Switch static const uint8_t TX = 1; static const uint8_t RX = 3; From 53ebc8fcf0f1e0b9b01c7654b7decb880f62d339 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Thu, 25 Oct 2018 07:34:35 +0200 Subject: [PATCH 05/10] Update pins_arduino.h --- variants/wipy3/pins_arduino.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/wipy3/pins_arduino.h b/variants/wipy3/pins_arduino.h index 818963c7ccf..cfee21dc83f 100644 --- a/variants/wipy3/pins_arduino.h +++ b/variants/wipy3/pins_arduino.h @@ -14,6 +14,8 @@ static const uint8_t LED_BUILTIN = 0; // ->2812 RGB !!! #define BUILTIN_LED LED_BUILTIN // backward compatibility +#define ANT_SELECT 21 // GPIO21 - External Antenna Switch + static const uint8_t TX = 1; static const uint8_t RX = 3; From 857c3e1cf8ac4072a439517b273675880f0f14a3 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Thu, 25 Oct 2018 07:38:30 +0200 Subject: [PATCH 06/10] Update pins_arduino.h --- variants/lopy4/pins_arduino.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/variants/lopy4/pins_arduino.h b/variants/lopy4/pins_arduino.h index 32e85ccb12d..7b64a2d9bb1 100644 --- a/variants/lopy4/pins_arduino.h +++ b/variants/lopy4/pins_arduino.h @@ -20,8 +20,10 @@ #define LORA_IO1 23 // GPIO23 - SX1276 IO1 tied by diode to IO0 #define LORA_IO2 23 // GPIO23 - SX1276 IO2 tied by diode to IO0 -// Antenna select -#define ANT_SELECT 21 // GPIO16 - External Antenna Switch +static const uint8_t LED_BUILTIN = 0; // ->2812 RGB !!! +#define BUILTIN_LED LED_BUILTIN // backward compatibility + +#define ANT_SELECT 21 // GPIO21 - External Antenna Switch static const uint8_t TX = 1; static const uint8_t RX = 3; @@ -31,7 +33,7 @@ static const uint8_t SCL = 13; static const uint8_t MOSI = 22; static const uint8_t MISO = 37; -static const uint8_t SCK = 5; +static const uint8_t SCK = 13; static const uint8_t A0 = 36; static const uint8_t A1 = 37; From 8bcfa31e24d832ce76fba3b3c0e887ccbe240394 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Thu, 25 Oct 2018 07:39:31 +0200 Subject: [PATCH 07/10] Update pins_arduino.h --- variants/lopy/pins_arduino.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/variants/lopy/pins_arduino.h b/variants/lopy/pins_arduino.h index 83b9b1ce949..5feafdd07c2 100644 --- a/variants/lopy/pins_arduino.h +++ b/variants/lopy/pins_arduino.h @@ -21,7 +21,9 @@ #define LORA_IO1 23 // GPIO23 - SX1276 IO1 tied by diode to IO0 #define LORA_IO2 23 // GPIO23 - SX1276 IO2 tied by diode to IO0 -// Antenna select +static const uint8_t LED_BUILTIN = 0; // ->2812 RGB !!! +#define BUILTIN_LED LED_BUILTIN // backward compatibility + #define ANT_SELECT 16 // GPIO16 - External Antenna Switch static const uint8_t TX = 1; @@ -33,7 +35,7 @@ static const uint8_t SCL = 13; static const uint8_t SS = 17; static const uint8_t MOSI = 22; static const uint8_t MISO = 37; -static const uint8_t SCK = 5; +static const uint8_t SCK = 13; static const uint8_t A0 = 36; static const uint8_t A1 = 37; From 8f0f55914e85a67cd9c1aaefb6dd714ecb6363a6 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Thu, 25 Oct 2018 07:53:04 +0200 Subject: [PATCH 08/10] Update pins_arduino.h --- variants/lopy4/pins_arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/lopy4/pins_arduino.h b/variants/lopy4/pins_arduino.h index 7b64a2d9bb1..b1c1919c807 100644 --- a/variants/lopy4/pins_arduino.h +++ b/variants/lopy4/pins_arduino.h @@ -4,7 +4,7 @@ #include #define EXTERNAL_NUM_INTERRUPTS 16 -#define NUM_DIGITAL_PINS 24 +#define NUM_DIGITAL_PINS 40 #define NUM_ANALOG_INPUTS 18 #define analogInputToDigitalPin(p) (((p)<40)?(esp32_adc2gpio[(p)]):-1) From 0d993b541c9c743a2d37dfc6a4e25d870aaf26f4 Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Thu, 25 Oct 2018 07:53:23 +0200 Subject: [PATCH 09/10] Update pins_arduino.h --- variants/lopy/pins_arduino.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/lopy/pins_arduino.h b/variants/lopy/pins_arduino.h index 5feafdd07c2..bfe15efbd30 100644 --- a/variants/lopy/pins_arduino.h +++ b/variants/lopy/pins_arduino.h @@ -4,7 +4,7 @@ #include #define EXTERNAL_NUM_INTERRUPTS 16 -#define NUM_DIGITAL_PINS 24 +#define NUM_DIGITAL_PINS 40 #define NUM_ANALOG_INPUTS 18 #define analogInputToDigitalPin(p) (((p)<40)?(esp32_adc2gpio[(p)]):-1) From 489048d84fd57d42ff463254fcb24715a916c8df Mon Sep 17 00:00:00 2001 From: Verkehrsrot Date: Sat, 27 Oct 2018 13:05:21 +0200 Subject: [PATCH 10/10] Update boards.txt --- boards.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards.txt b/boards.txt index 9984547b69a..c70ccb0cd66 100644 --- a/boards.txt +++ b/boards.txt @@ -2509,8 +2509,8 @@ lopy4.serial.disableRTS=true lopy4.build.mcu=esp32 lopy4.build.core=esp32 -lopy4.build.variant=lopy -lopy4.build.board=LoPy +lopy4.build.variant=lopy4 +lopy4.build.board=LoPy4 lopy4.build.f_cpu=240000000L lopy4.build.flash_mode=dio