From 7966f4ae7966855359db7c4c6178955745cffd2c Mon Sep 17 00:00:00 2001 From: safocl Date: Wed, 31 Jan 2024 14:50:35 +0400 Subject: [PATCH 1/9] Fix ambiguous for TwoWire::requestFrom() methods and align API with Arduino.cc (#8817) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix ambiguous for TwoWire::requestFrom() methods. * Remove TwoWire::begin(int) overload Inside the function, this overload truncated the data type to a shorter one. This could break some users' hopes. * Rewrite TwoWire with using HardwareI2C - implement proposal https://github.com/espressif/arduino-esp32/pull/8818#issuecomment-1792191815 to bring the HARDWARE interface into compliance * Fix TwoWire::end() return type. * Fix TwoWire::setClock() return type. * Fix no return statement in the TwoWire::requestFrom. * fix(libraries/Wire): fix bad return-statement Remove non-void values of the return-statements in function returning 'void'. * style(libraries/Wire): replace tabs with spaces * refactor(libraries/Wire): use slave without support TwoWire::begin(uint8_t address) should be available without slave support by SoC? * refactor(libraries/Wire): remove unused variables Compiler reports "Wire.cpp:393:15: error: variable 'err' set but not used [-Werror=unused-but-set-variable]". * refactor(libraries/Wire): remove unused variables Compiler reports "Wire.cpp:337:15: error: variable 'err' set but not used [-Werror=unused-but-set-variable]". * fix(libraries/Wire): hide slave support elements TwoWire::user_onRequest is used only in conjunction with slave support? * refactor(libraries/Wire): remove temporary comment * fix(libraries/Wire): restore an accidentally deleted implementation TwoWire::endTransmission() was accidentally deleted from a cpp file. * refactor(libraries/Wire): return return types In TwoWire class return return types. * fix(libraries/Wire): fix return type * refactor(libraries/Wire): add return statement if slave isn't supported Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): fix indentation Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): fix indentation Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): fix indentation Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): remove unnecessary empty lines --------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> --- cores/esp32/HardwareI2C.h | 42 ++++++++++++++ libraries/Wire/src/Wire.cpp | 97 +++++++++----------------------- libraries/Wire/src/Wire.h | 107 ++++++++++++++---------------------- 3 files changed, 109 insertions(+), 137 deletions(-) create mode 100644 cores/esp32/HardwareI2C.h diff --git a/cores/esp32/HardwareI2C.h b/cores/esp32/HardwareI2C.h new file mode 100644 index 00000000000..830c24a80d6 --- /dev/null +++ b/cores/esp32/HardwareI2C.h @@ -0,0 +1,42 @@ +/* + Copyright (c) 2016 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include +#include "Stream.h" + +class HardwareI2C : public Stream +{ + public: + virtual bool begin() = 0; + virtual bool begin(uint8_t address) = 0; + virtual bool end() = 0; + + virtual bool setClock(uint32_t freq) = 0; + + virtual void beginTransmission(uint8_t address) = 0; + virtual uint8_t endTransmission(bool stopBit) = 0; + virtual uint8_t endTransmission(void) = 0; + + virtual size_t requestFrom(uint8_t address, size_t len, bool stopBit) = 0; + virtual size_t requestFrom(uint8_t address, size_t len) = 0; + + virtual void onReceive(void(*)(int)) = 0; + virtual void onRequest(void(*)(void)) = 0; +}; diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index 4b81d99f70d..ac8c353575f 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -149,7 +149,7 @@ bool TwoWire::setPins(int sdaPin, int sclPin) return !i2cIsInit(num); } -bool TwoWire::allocateWireBuffer(void) +bool TwoWire::allocateWireBuffer() { // or both buffer can be allocated or none will be if (rxBuffer == NULL) { @@ -171,7 +171,7 @@ bool TwoWire::allocateWireBuffer(void) return true; } -void TwoWire::freeWireBuffer(void) +void TwoWire::freeWireBuffer() { if (rxBuffer != NULL) { free(rxBuffer); @@ -424,7 +424,7 @@ uint16_t TwoWire::getTimeOut() return _timeOutMillis; } -void TwoWire::beginTransmission(uint16_t address) +void TwoWire::beginTransmission(uint8_t address) { #if SOC_I2C_SUPPORT_SLAVE if(is_slave){ @@ -492,7 +492,12 @@ uint8_t TwoWire::endTransmission(bool sendStop) return 4; } -size_t TwoWire::requestFrom(uint16_t address, size_t size, bool sendStop) +uint8_t TwoWire::endTransmission() +{ + return endTransmission(true); +} + +size_t TwoWire::requestFrom(uint8_t address, size_t size, bool sendStop) { #if SOC_I2C_SUPPORT_SLAVE if(is_slave){ @@ -550,6 +555,10 @@ size_t TwoWire::requestFrom(uint16_t address, size_t size, bool sendStop) return rxLength; } +size_t TwoWire::requestFrom(uint8_t address, size_t size){ + return requestFrom(address, size, true); +} + size_t TwoWire::write(uint8_t data) { if (txBuffer == NULL){ @@ -574,13 +583,13 @@ size_t TwoWire::write(const uint8_t *data, size_t quantity) } -int TwoWire::available(void) +int TwoWire::available() { int result = rxLength - rxIndex; return result; } -int TwoWire::read(void) +int TwoWire::read() { int value = -1; if (rxBuffer == NULL){ @@ -593,7 +602,7 @@ int TwoWire::read(void) return value; } -int TwoWire::peek(void) +int TwoWire::peek() { int value = -1; if (rxBuffer == NULL){ @@ -606,7 +615,7 @@ int TwoWire::peek(void) return value; } -void TwoWire::flush(void) +void TwoWire::flush() { rxIndex = 0; rxLength = 0; @@ -614,62 +623,19 @@ void TwoWire::flush(void) //i2cFlush(num); // cleanup } -size_t TwoWire::requestFrom(uint8_t address, size_t len, bool sendStop) -{ - return requestFrom(static_cast(address), static_cast(len), static_cast(sendStop)); -} - -uint8_t TwoWire::requestFrom(uint8_t address, uint8_t len, uint8_t sendStop) -{ - return requestFrom(static_cast(address), static_cast(len), static_cast(sendStop)); -} - -uint8_t TwoWire::requestFrom(uint16_t address, uint8_t len, uint8_t sendStop) -{ - return requestFrom(address, static_cast(len), static_cast(sendStop)); -} - -/* Added to match the Arduino function definition: https://github.com/arduino/ArduinoCore-API/blob/173e8eadced2ad32eeb93bcbd5c49f8d6a055ea6/api/HardwareI2C.h#L39 - * See: https://github.com/arduino-libraries/ArduinoECCX08/issues/25 -*/ -uint8_t TwoWire::requestFrom(uint16_t address, uint8_t len, bool stopBit) -{ - return requestFrom((uint16_t)address, (size_t)len, stopBit); -} - -uint8_t TwoWire::requestFrom(uint8_t address, uint8_t len) -{ - return requestFrom(static_cast(address), static_cast(len), true); -} - -uint8_t TwoWire::requestFrom(uint16_t address, uint8_t len) -{ - return requestFrom(address, static_cast(len), true); -} - -uint8_t TwoWire::requestFrom(int address, int len) -{ - return requestFrom(static_cast(address), static_cast(len), true); -} - -uint8_t TwoWire::requestFrom(int address, int len, int sendStop) -{ - return static_cast(requestFrom(static_cast(address), static_cast(len), static_cast(sendStop))); -} - -void TwoWire::beginTransmission(int address) -{ - beginTransmission(static_cast(address)); -} - -void TwoWire::beginTransmission(uint8_t address) +void TwoWire::onReceive( void (*function)(int) ) { - beginTransmission(static_cast(address)); +#if SOC_I2C_SUPPORT_SLAVE + user_onReceive = function; +#endif } -uint8_t TwoWire::endTransmission(void) +// sets function called on slave read +void TwoWire::onRequest( void (*function)(void) ) { - return endTransmission(true); +#if SOC_I2C_SUPPORT_SLAVE + user_onRequest = function; +#endif } #if SOC_I2C_SUPPORT_SLAVE @@ -714,17 +680,6 @@ void TwoWire::onRequestService(uint8_t num, void * arg) } } -void TwoWire::onReceive( void (*function)(int) ) -{ - user_onReceive = function; -} - -// sets function called on slave read -void TwoWire::onRequest( void (*function)(void) ) -{ - user_onRequest = function; -} - #endif /* SOC_I2C_SUPPORT_SLAVE */ TwoWire Wire = TwoWire(0); diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index 569d3abf1a0..2a5e9b4215d 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -30,11 +30,13 @@ #if SOC_I2C_SUPPORTED #include +#include #if !CONFIG_DISABLE_HAL_LOCKS #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" #endif +#include "HardwareI2C.h" #include "Stream.h" // WIRE_HAS_BUFFER_SIZE means Wire has setBufferSize() @@ -50,7 +52,7 @@ typedef void(*user_onRequest)(void); typedef void(*user_onReceive)(uint8_t*, int); #endif /* SOC_I2C_SUPPORT_SLAVE */ -class TwoWire: public Stream +class TwoWire: public HardwareI2C { protected: uint8_t num; @@ -81,12 +83,41 @@ class TwoWire: public Stream static void onReceiveService(uint8_t, uint8_t*, size_t, bool, void *); #endif /* SOC_I2C_SUPPORT_SLAVE */ bool initPins(int sdaPin, int sclPin); - bool allocateWireBuffer(void); - void freeWireBuffer(void); + bool allocateWireBuffer(); + void freeWireBuffer(); public: TwoWire(uint8_t bus_num); ~TwoWire(); + + bool begin() override final + { + return begin(-1, -1); + } + + bool begin(uint8_t address) override final + { +#if SOC_I2C_SUPPORT_SLAVE + return begin(address, -1, -1, 0); +#else + log_e("I2C slave is not supported on " CONFIG_IDF_TARGET); + return false; +#endif + } + + bool end() override; + + bool setClock(uint32_t freq) override; + + void beginTransmission(uint8_t address) override; + uint8_t endTransmission(bool stopBit) override; + uint8_t endTransmission() override; + + size_t requestFrom(uint8_t address, size_t len, bool stopBit) override; + size_t requestFrom(uint8_t address, size_t len) override; + + void onReceive(void(*)(int)) override; + void onRequest(void(*)(void)) override; //call setPins() first, so that begin() can be called without arguments from libraries bool setPins(int sda, int scl); @@ -95,78 +126,22 @@ class TwoWire: public Stream #if SOC_I2C_SUPPORT_SLAVE bool begin(uint8_t slaveAddr, int sda, int scl, uint32_t frequency); #endif /* SOC_I2C_SUPPORT_SLAVE */ - // Explicit Overload for Arduino MainStream API compatibility - inline bool begin() - { - return begin(-1, -1, static_cast(0)); - } -#if SOC_I2C_SUPPORT_SLAVE - inline bool begin(uint8_t addr) - { - return begin(addr, -1, -1, 0); - } - inline bool begin(int addr) - { - return begin(static_cast(addr), -1, -1, 0); - } -#endif /* SOC_I2C_SUPPORT_SLAVE */ - bool end(); size_t setBufferSize(size_t bSize); void setTimeOut(uint16_t timeOutMillis); // default timeout of i2c transactions is 50ms uint16_t getTimeOut(); - bool setClock(uint32_t); uint32_t getClock(); - void beginTransmission(uint16_t address); - void beginTransmission(uint8_t address); - void beginTransmission(int address); - - uint8_t endTransmission(bool sendStop); - uint8_t endTransmission(void); - - size_t requestFrom(uint16_t address, size_t size, bool sendStop); - uint8_t requestFrom(uint16_t address, uint8_t size, bool sendStop); - uint8_t requestFrom(uint16_t address, uint8_t size, uint8_t sendStop); - size_t requestFrom(uint8_t address, size_t len, bool stopBit); - uint8_t requestFrom(uint16_t address, uint8_t size); - uint8_t requestFrom(uint8_t address, uint8_t size, uint8_t sendStop); - uint8_t requestFrom(uint8_t address, uint8_t size); - uint8_t requestFrom(int address, int size, int sendStop); - uint8_t requestFrom(int address, int size); - - size_t write(uint8_t); - size_t write(const uint8_t *, size_t); - int available(void); - int read(void); - int peek(void); - void flush(void); - - inline size_t write(const char * s) - { - return write((uint8_t*) s, strlen(s)); - } - inline size_t write(unsigned long n) - { - return write((uint8_t)n); - } - inline size_t write(long n) - { - return write((uint8_t)n); - } - inline size_t write(unsigned int n) - { - return write((uint8_t)n); - } - inline size_t write(int n) - { - return write((uint8_t)n); - } + size_t write(uint8_t) override; + size_t write(const uint8_t *, size_t) override; + int available() override; + int read() override; + int peek() override; + void flush() override; + #if SOC_I2C_SUPPORT_SLAVE - void onReceive( void (*)(int) ); - void onRequest( void (*)(void) ); size_t slaveWrite(const uint8_t *, size_t); #endif /* SOC_I2C_SUPPORT_SLAVE */ }; From 5148374c46f8e89c94e4e2e1e517ddaab9efdb15 Mon Sep 17 00:00:00 2001 From: Elias Santistevan Date: Wed, 31 Jan 2024 03:51:36 -0700 Subject: [PATCH 2/9] Adds SparkFun Pro Micro C3 Variant File (#9158) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds SparkFun Pro Micro ESP32-C3 variant file Adds SparkFun Pro Micro ESP32-C3 variant to boards.txt * removes some pin definitions that are defined elsewhere * removes the accidental camel case in variant folder name * Attempts again to fix camel case in the variant file --------- Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> --- boards.txt | 151 +++++++++++++++++- .../sparkfun_pro_micro_esp32c3/pins_arduino.h | 48 ++++++ 2 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 variants/sparkfun_pro_micro_esp32c3/pins_arduino.h diff --git a/boards.txt b/boards.txt index 5cc2bf42d81..baac41030dd 100644 --- a/boards.txt +++ b/boards.txt @@ -6375,6 +6375,155 @@ sparkfun_esp32c6_qwiic_pocket.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +# SparkFun Pro Micro ESP32C3 + +sparkfun_pro_micro_esp32c3.name=SparkFun Pro Micro - ESP32C3 +sparkfun_pro_micro_esp32c3.vid.0=0x1B4F +sparkfun_pro_micro_esp32c3.pid.0=0x0035 + +sparkfun_pro_micro_esp32c3.bootloader.tool=esptool_py +sparkfun_pro_micro_esp32c3.bootloader.tool.default=esptool_py + +sparkfun_pro_micro_esp32c3.upload.tool=esptool_py +sparkfun_pro_micro_esp32c3.upload.tool.default=esptool_py +sparkfun_pro_micro_esp32c3.upload.tool.network=esp_ota + +sparkfun_pro_micro_esp32c3.upload.maximum_size=1310720 +sparkfun_pro_micro_esp32c3.upload.maximum_data_size=327680 +sparkfun_pro_micro_esp32c3.upload.flags= +sparkfun_pro_micro_esp32c3.upload.extra_flags= +sparkfun_pro_micro_esp32c3.upload.use_1200bps_touch=false +sparkfun_pro_micro_esp32c3.upload.wait_for_upload_port=false + +sparkfun_pro_micro_esp32c3.serial.disableDTR=false +sparkfun_pro_micro_esp32c3.serial.disableRTS=false + +sparkfun_pro_micro_esp32c3.build.tarch=riscv32 +sparkfun_pro_micro_esp32c3.build.bootloader_addr=0x0 +sparkfun_pro_micro_esp32c3.build.target=esp +sparkfun_pro_micro_esp32c3.build.mcu=esp32c3 +sparkfun_pro_micro_esp32c3.build.core=esp32 +sparkfun_pro_micro_esp32c3.build.variant=sparkfun_pro_micro_esp32c3 +sparkfun_pro_micro_esp32c3.build.board=SPARKFUN_PRO_MICRO_ESP32C3 + +sparkfun_pro_micro_esp32c3.build.cdc_on_boot=1 +sparkfun_pro_micro_esp32c3.build.f_cpu=160000000L +sparkfun_pro_micro_esp32c3.build.flash_size=4MB +sparkfun_pro_micro_esp32c3.build.flash_freq=80m +sparkfun_pro_micro_esp32c3.build.flash_mode=dio +sparkfun_pro_micro_esp32c3.build.boot=qio +sparkfun_pro_micro_esp32c3.build.partitions=default +sparkfun_pro_micro_esp32c3.build.defines= + +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.default=Disabled +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.builtin=Integrated USB JTAG +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.builtin.build.openocdscript=esp32c3-builtin.cfg +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.external=FTDI Adapter +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.external.build.openocdscript=esp32c3-ftdi.cfg +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.external.build.copy_jtag_files=1 +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.bridge=ESP USB Bridge +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.bridge.build.openocdscript=esp32c3-bridge.cfg +sparkfun_pro_micro_esp32c3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.cdc=Enabled +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.default=Enabled +sparkfun_pro_micro_esp32c3.menu.CDCOnBoot.default.build.cdc_on_boot=0 + +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.default.build.partitions=default +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.minimal.build.partitions=minimal +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.no_ota.build.partitions=no_ota +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.huge_app.build.partitions=huge_app +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +sparkfun_pro_micro_esp32c3.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 + +sparkfun_pro_micro_esp32c3.menu.CPUFreq.160=160MHz (WiFi) +sparkfun_pro_micro_esp32c3.menu.CPUFreq.160.build.f_cpu=160000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.80=80MHz (WiFi) +sparkfun_pro_micro_esp32c3.menu.CPUFreq.80.build.f_cpu=80000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.40=40MHz +sparkfun_pro_micro_esp32c3.menu.CPUFreq.40.build.f_cpu=40000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.20=20MHz +sparkfun_pro_micro_esp32c3.menu.CPUFreq.20.build.f_cpu=20000000L +sparkfun_pro_micro_esp32c3.menu.CPUFreq.10=10MHz +sparkfun_pro_micro_esp32c3.menu.CPUFreq.10.build.f_cpu=10000000L + +sparkfun_pro_micro_esp32c3.menu.FlashMode.qio=QIO +sparkfun_pro_micro_esp32c3.menu.FlashMode.qio.build.flash_mode=dio +sparkfun_pro_micro_esp32c3.menu.FlashMode.qio.build.boot=qio +sparkfun_pro_micro_esp32c3.menu.FlashMode.dio=DIO +sparkfun_pro_micro_esp32c3.menu.FlashMode.dio.build.flash_mode=dio +sparkfun_pro_micro_esp32c3.menu.FlashMode.dio.build.boot=dio +sparkfun_pro_micro_esp32c3.menu.FlashMode.qout=QOUT +sparkfun_pro_micro_esp32c3.menu.FlashMode.qout.build.flash_mode=dout +sparkfun_pro_micro_esp32c3.menu.FlashMode.qout.build.boot=qout +sparkfun_pro_micro_esp32c3.menu.FlashMode.dout=DOUT +sparkfun_pro_micro_esp32c3.menu.FlashMode.dout.build.flash_mode=dout +sparkfun_pro_micro_esp32c3.menu.FlashMode.dout.build.boot=dout + +sparkfun_pro_micro_esp32c3.menu.FlashFreq.80=80MHz +sparkfun_pro_micro_esp32c3.menu.FlashFreq.80.build.flash_freq=80m +sparkfun_pro_micro_esp32c3.menu.FlashFreq.40=40MHz +sparkfun_pro_micro_esp32c3.menu.FlashFreq.40.build.flash_freq=40m + +sparkfun_pro_micro_esp32c3.menu.FlashSize.4M=4MB (32Mb) +sparkfun_pro_micro_esp32c3.menu.FlashSize.4M.build.flash_size=4MB + +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.921600=921600 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.921600.upload.speed=921600 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.115200=115200 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.115200.upload.speed=115200 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.256000.windows=256000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.256000.upload.speed=256000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.230400.windows.upload.speed=256000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.230400=230400 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.230400.upload.speed=230400 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.460800.linux=460800 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.460800.macosx=460800 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.460800.upload.speed=460800 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.512000.windows=512000 +sparkfun_pro_micro_esp32c3.menu.UploadSpeed.512000.upload.speed=512000 + +sparkfun_pro_micro_esp32c3.menu.DebugLevel.none=None +sparkfun_pro_micro_esp32c3.menu.DebugLevel.none.build.code_debug=0 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.error=Error +sparkfun_pro_micro_esp32c3.menu.DebugLevel.error.build.code_debug=1 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.warn=Warn +sparkfun_pro_micro_esp32c3.menu.DebugLevel.warn.build.code_debug=2 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.info=Info +sparkfun_pro_micro_esp32c3.menu.DebugLevel.info.build.code_debug=3 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.debug=Debug +sparkfun_pro_micro_esp32c3.menu.DebugLevel.debug.build.code_debug=4 +sparkfun_pro_micro_esp32c3.menu.DebugLevel.verbose=Verbose +sparkfun_pro_micro_esp32c3.menu.DebugLevel.verbose.build.code_debug=5 + +sparkfun_pro_micro_esp32c3.menu.EraseFlash.none=Disabled +sparkfun_pro_micro_esp32c3.menu.EraseFlash.none.upload.erase_cmd= +sparkfun_pro_micro_esp32c3.menu.EraseFlash.all=Enabled +sparkfun_pro_micro_esp32c3.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + nina_w10.name=u-blox NINA-W10 series (ESP32) nina_w10.bootloader.tool=esptool_py @@ -32898,4 +33047,4 @@ makergo_c3_supermini.menu.EraseFlash.none.upload.erase_cmd= makergo_c3_supermini.menu.EraseFlash.all=Enabled makergo_c3_supermini.menu.EraseFlash.all.upload.erase_cmd=-e -############################################################## \ No newline at end of file +############################################################## diff --git a/variants/sparkfun_pro_micro_esp32c3/pins_arduino.h b/variants/sparkfun_pro_micro_esp32c3/pins_arduino.h new file mode 100644 index 00000000000..8c29399fc63 --- /dev/null +++ b/variants/sparkfun_pro_micro_esp32c3/pins_arduino.h @@ -0,0 +1,48 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x1B4F +#define USB_PID 0x0035 +#define USB_MANUFACTURER "SparkFun" +#define USB_PRODUCT "SparkFun_Pro_Micro-ESP32C3" +#define USB_SERIAL "" // Empty string for MAC adddress + +static const uint8_t LED_BUILTIN = 10; + +static const uint8_t TX = 21; +static const uint8_t RX = 20; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; + +static const uint8_t D0 = 0; +static const uint8_t D1 = 1; +static const uint8_t D2 = 2; +static const uint8_t D3 = 3; +static const uint8_t D4 = 4; +static const uint8_t D5 = 5; +static const uint8_t D6 = 6; +static const uint8_t D7 = 7; +static const uint8_t D8 = 8; +static const uint8_t D9 = 9; +static const uint8_t D10 = 10; + +static const uint8_t SDA = 5; +static const uint8_t SCL = 6; + +static const uint8_t SS = 10; +static const uint8_t MOSI = 3; +static const uint8_t MISO = 1; +static const uint8_t SCK = 0; + +static const uint8_t PIN_I2S_SCK = 6; // Frame clock, no bit clock +static const uint8_t PIN_I2S_SD_DOUT = 7; // data out +static const uint8_t PIN_I2S_SD_IN = 5; // data in +static const uint8_t PIN_I2S_FS = 10; // frame select + +#endif /* Pins_Arduino_h */ From 8eaa893eff5418f27647a070c4e573f84504c680 Mon Sep 17 00:00:00 2001 From: yelo Date: Wed, 31 Jan 2024 18:51:56 +0800 Subject: [PATCH 3/9] feat: Add board support for Nologo ESP32C3 Super Mini (#9174) detail of nologo esp32c3 super mini: https://www.nologo.tech/product/esp32/esp32c3SuperMini/esp32C3SuperMini.html --- boards.txt | 140 ++++++++++++++++++ .../nologo_esp32c3_super_mini/pins_arduino.h | 28 ++++ 2 files changed, 168 insertions(+) create mode 100644 variants/nologo_esp32c3_super_mini/pins_arduino.h diff --git a/boards.txt b/boards.txt index baac41030dd..e9cc0bc7c17 100644 --- a/boards.txt +++ b/boards.txt @@ -13967,6 +13967,146 @@ nodemcu-32s.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +nologo_esp32c3_super_mini.name=Nologo ESP32C3 Super Mini +nologo_esp32c3_super_mini.vid.0=0x303a +nologo_esp32c3_super_mini.pid.0=0x1001 + +nologo_esp32c3_super_mini.upload.tool=esptool_py +nologo_esp32c3_super_mini.upload.tool.default=esptool_py +nologo_esp32c3_super_mini.upload.tool.network=esp_ota +nologo_esp32c3_super_mini.upload.maximum_size=1310720 +nologo_esp32c3_super_mini.upload.maximum_data_size=327680 +nologo_esp32c3_super_mini.upload.flags= +nologo_esp32c3_super_mini.upload.extra_flags= +nologo_esp32c3_super_mini.upload.use_1200bps_touch=false +nologo_esp32c3_super_mini.upload.wait_for_upload_port=false + +nologo_esp32c3_super_mini.serial.disableDTR=false +nologo_esp32c3_super_mini.serial.disableRTS=false + +nologo_esp32c3_super_mini.build.tarch=riscv32 +nologo_esp32c3_super_mini.build.target=esp +nologo_esp32c3_super_mini.build.mcu=esp32c3 +nologo_esp32c3_super_mini.build.core=esp32 +nologo_esp32c3_super_mini.build.variant=nologo_esp32c3_super_mini +nologo_esp32c3_super_mini.build.board=NOLOGO_ESP32C3_SUPER_MINI +nologo_esp32c3_super_mini.build.bootloader_addr=0x0 + +nologo_esp32c3_super_mini.build.usb_mode=1 +nologo_esp32c3_super_mini.build.cdc_on_boot=1 +nologo_esp32c3_super_mini.build.f_cpu=160000000L +nologo_esp32c3_super_mini.build.flash_size=4MB +nologo_esp32c3_super_mini.build.flash_freq=80m +nologo_esp32c3_super_mini.build.flash_mode=qio +nologo_esp32c3_super_mini.build.boot=qio +nologo_esp32c3_super_mini.build.partitions=default +nologo_esp32c3_super_mini.build.defines= + +nologo_esp32c3_super_mini.menu.USBMode.hwcdc=Hardware CDC and JTAG +nologo_esp32c3_super_mini.menu.USBMode.hwcdc.build.usb_mode=1 +nologo_esp32c3_super_mini.menu.USBMode.default=USB-OTG +nologo_esp32c3_super_mini.menu.USBMode.default.build.usb_mode=0 + +nologo_esp32c3_super_mini.menu.JTAGAdapter.default=Disabled +nologo_esp32c3_super_mini.menu.JTAGAdapter.default.build.copy_jtag_files=0 +nologo_esp32c3_super_mini.menu.JTAGAdapter.builtin=Integrated USB JTAG +nologo_esp32c3_super_mini.menu.JTAGAdapter.builtin.build.openocdscript=esp32c3-builtin.cfg +nologo_esp32c3_super_mini.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +nologo_esp32c3_super_mini.menu.JTAGAdapter.external=FTDI Adapter +nologo_esp32c3_super_mini.menu.JTAGAdapter.external.build.openocdscript=esp32c3-ftdi.cfg +nologo_esp32c3_super_mini.menu.JTAGAdapter.external.build.copy_jtag_files=1 +nologo_esp32c3_super_mini.menu.JTAGAdapter.bridge=ESP USB Bridge +nologo_esp32c3_super_mini.menu.JTAGAdapter.bridge.build.openocdscript=esp32c3-bridge.cfg +nologo_esp32c3_super_mini.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +nologo_esp32c3_super_mini.menu.CDCOnBoot.default=Enabled +nologo_esp32c3_super_mini.menu.CDCOnBoot.default.build.cdc_on_boot=1 +nologo_esp32c3_super_mini.menu.CDCOnBoot.cdc=Enabled +nologo_esp32c3_super_mini.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +nologo_esp32c3_super_mini.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.default.build.partitions=default +nologo_esp32c3_super_mini.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +nologo_esp32c3_super_mini.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +nologo_esp32c3_super_mini.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +nologo_esp32c3_super_mini.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.minimal.build.partitions=minimal +nologo_esp32c3_super_mini.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.no_ota.build.partitions=no_ota +nologo_esp32c3_super_mini.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +nologo_esp32c3_super_mini.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +nologo_esp32c3_super_mini.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +nologo_esp32c3_super_mini.menu.PartitionScheme.huge_app.build.partitions=huge_app +nologo_esp32c3_super_mini.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 + +nologo_esp32c3_super_mini.menu.CPUFreq.160=160MHz (WiFi) +nologo_esp32c3_super_mini.menu.CPUFreq.160.build.f_cpu=160000000L +nologo_esp32c3_super_mini.menu.CPUFreq.80=80MHz (WiFi) +nologo_esp32c3_super_mini.menu.CPUFreq.80.build.f_cpu=80000000L +nologo_esp32c3_super_mini.menu.CPUFreq.40=40MHz +nologo_esp32c3_super_mini.menu.CPUFreq.40.build.f_cpu=40000000L +nologo_esp32c3_super_mini.menu.CPUFreq.20=20MHz +nologo_esp32c3_super_mini.menu.CPUFreq.20.build.f_cpu=20000000L +nologo_esp32c3_super_mini.menu.CPUFreq.10=10MHz +nologo_esp32c3_super_mini.menu.CPUFreq.10.build.f_cpu=10000000L + +nologo_esp32c3_super_mini.menu.FlashMode.qio=QIO +nologo_esp32c3_super_mini.menu.FlashMode.qio.build.flash_mode=dio +nologo_esp32c3_super_mini.menu.FlashMode.qio.build.boot=qio +nologo_esp32c3_super_mini.menu.FlashMode.dio=DIO +nologo_esp32c3_super_mini.menu.FlashMode.dio.build.flash_mode=dio +nologo_esp32c3_super_mini.menu.FlashMode.dio.build.boot=dio + +nologo_esp32c3_super_mini.menu.FlashFreq.80=80MHz +nologo_esp32c3_super_mini.menu.FlashFreq.80.build.flash_freq=80m +nologo_esp32c3_super_mini.menu.FlashFreq.40=40MHz +nologo_esp32c3_super_mini.menu.FlashFreq.40.build.flash_freq=40m + +nologo_esp32c3_super_mini.menu.UploadSpeed.921600=921600 +nologo_esp32c3_super_mini.menu.UploadSpeed.921600.upload.speed=921600 +nologo_esp32c3_super_mini.menu.UploadSpeed.115200=115200 +nologo_esp32c3_super_mini.menu.UploadSpeed.115200.upload.speed=115200 +nologo_esp32c3_super_mini.menu.UploadSpeed.256000.windows=256000 +nologo_esp32c3_super_mini.menu.UploadSpeed.256000.upload.speed=256000 +nologo_esp32c3_super_mini.menu.UploadSpeed.230400.windows.upload.speed=256000 +nologo_esp32c3_super_mini.menu.UploadSpeed.230400=230400 +nologo_esp32c3_super_mini.menu.UploadSpeed.230400.upload.speed=230400 +nologo_esp32c3_super_mini.menu.UploadSpeed.460800.linux=460800 +nologo_esp32c3_super_mini.menu.UploadSpeed.460800.macosx=460800 +nologo_esp32c3_super_mini.menu.UploadSpeed.460800.upload.speed=460800 +nologo_esp32c3_super_mini.menu.UploadSpeed.512000.windows=512000 +nologo_esp32c3_super_mini.menu.UploadSpeed.512000.upload.speed=512000 + +nologo_esp32c3_super_mini.menu.DebugLevel.none=None +nologo_esp32c3_super_mini.menu.DebugLevel.none.build.code_debug=0 +nologo_esp32c3_super_mini.menu.DebugLevel.error=Error +nologo_esp32c3_super_mini.menu.DebugLevel.error.build.code_debug=1 +nologo_esp32c3_super_mini.menu.DebugLevel.warn=Warn +nologo_esp32c3_super_mini.menu.DebugLevel.warn.build.code_debug=2 +nologo_esp32c3_super_mini.menu.DebugLevel.info=Info +nologo_esp32c3_super_mini.menu.DebugLevel.info.build.code_debug=3 +nologo_esp32c3_super_mini.menu.DebugLevel.debug=Debug +nologo_esp32c3_super_mini.menu.DebugLevel.debug.build.code_debug=4 +nologo_esp32c3_super_mini.menu.DebugLevel.verbose=Verbose +nologo_esp32c3_super_mini.menu.DebugLevel.verbose.build.code_debug=5 + +nologo_esp32c3_super_mini.menu.EraseFlash.none=Disabled +nologo_esp32c3_super_mini.menu.EraseFlash.none.upload.erase_cmd= +nologo_esp32c3_super_mini.menu.EraseFlash.all=Enabled +nologo_esp32c3_super_mini.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + mhetesp32devkit.name=MH ET LIVE ESP32DevKIT mhetesp32devkit.bootloader.tool=esptool_py diff --git a/variants/nologo_esp32c3_super_mini/pins_arduino.h b/variants/nologo_esp32c3_super_mini/pins_arduino.h new file mode 100644 index 00000000000..3b4c144cca6 --- /dev/null +++ b/variants/nologo_esp32c3_super_mini/pins_arduino.h @@ -0,0 +1,28 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +static const uint8_t LED_BUILTIN = 8; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN + +static const uint8_t TX = 21; +static const uint8_t RX = 20; + +static const uint8_t SDA = 8; +static const uint8_t SCL = 9; + +static const uint8_t SS = 7; +static const uint8_t MOSI = 6; +static const uint8_t MISO = 5; +static const uint8_t SCK = 4; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; +static const uint8_t A5 = 5; + +#endif /* Pins_Arduino_h */ From ead76fd395025c60e1f200363eec33865df38ec4 Mon Sep 17 00:00:00 2001 From: Dryw Wade Date: Wed, 31 Jan 2024 03:52:18 -0700 Subject: [PATCH 4/9] Add SparkFun ESP32-C6 Thing Plus Variant (#9178) * Add SparkFun ESP32-C6 Thing Plus to boards.txt * Add SparkFun ESP32-C6 Thing Plus variant --- boards.txt | 165 ++++++++++++++++++ .../pins_arduino.h | 35 ++++ 2 files changed, 200 insertions(+) create mode 100644 variants/sparkfun_esp32c6_thing_plus/pins_arduino.h diff --git a/boards.txt b/boards.txt index e9cc0bc7c17..203502a8fa7 100644 --- a/boards.txt +++ b/boards.txt @@ -5805,6 +5805,171 @@ sparkfun_esp32s2_thing_plus.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +sparkfun_esp32c6_thing_plus.name=SparkFun ESP32-C6 Thing Plus +sparkfun_esp32c6_thing_plus.vid.0=0x303a +sparkfun_esp32c6_thing_plus.pid.0=0x1001 + +sparkfun_esp32c6_thing_plus.bootloader.tool=esptool_py +sparkfun_esp32c6_thing_plus.bootloader.tool.default=esptool_py + +sparkfun_esp32c6_thing_plus.upload.tool=esptool_py +sparkfun_esp32c6_thing_plus.upload.tool.default=esptool_py +sparkfun_esp32c6_thing_plus.upload.tool.network=esp_ota + +sparkfun_esp32c6_thing_plus.upload.maximum_size=1310720 +sparkfun_esp32c6_thing_plus.upload.maximum_data_size=327680 +sparkfun_esp32c6_thing_plus.upload.flags= +sparkfun_esp32c6_thing_plus.upload.extra_flags= +sparkfun_esp32c6_thing_plus.upload.use_1200bps_touch=false +sparkfun_esp32c6_thing_plus.upload.wait_for_upload_port=false + +sparkfun_esp32c6_thing_plus.serial.disableDTR=false +sparkfun_esp32c6_thing_plus.serial.disableRTS=false + +sparkfun_esp32c6_thing_plus.build.tarch=riscv32 +sparkfun_esp32c6_thing_plus.build.target=esp +sparkfun_esp32c6_thing_plus.build.mcu=esp32c6 +sparkfun_esp32c6_thing_plus.build.core=esp32 +sparkfun_esp32c6_thing_plus.build.variant=sparkfun_esp32c6_thing_plus +sparkfun_esp32c6_thing_plus.build.board=ESP32C6_THING_PLUS +sparkfun_esp32c6_thing_plus.build.bootloader_addr=0x0 + +sparkfun_esp32c6_thing_plus.build.cdc_on_boot=0 +sparkfun_esp32c6_thing_plus.build.f_cpu=160000000L +sparkfun_esp32c6_thing_plus.build.flash_size=4MB +sparkfun_esp32c6_thing_plus.build.flash_freq=80m +sparkfun_esp32c6_thing_plus.build.flash_mode=qio +sparkfun_esp32c6_thing_plus.build.boot=qio +sparkfun_esp32c6_thing_plus.build.partitions=default +sparkfun_esp32c6_thing_plus.build.defines= + +## IDE 2.0 Seems to not update the value +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.default=Disabled +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.default.build.copy_jtag_files=0 +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.builtin=Integrated USB JTAG +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.builtin.build.openocdscript=esp32c6-builtin.cfg +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.external=FTDI Adapter +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.external.build.openocdscript=esp32c6-ftdi.cfg +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.external.build.copy_jtag_files=1 +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.bridge=ESP USB Bridge +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.bridge.build.openocdscript=esp32c6-bridge.cfg +sparkfun_esp32c6_thing_plus.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.default=Enabled +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.default.build.cdc_on_boot=1 +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.cdc=Disabled +sparkfun_esp32c6_thing_plus.menu.CDCOnBoot.cdc.build.cdc_on_boot=0 + +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default.build.partitions=default +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.minimal.build.partitions=minimal +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.no_ota.build.partitions=no_ota +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.huge_app.build.partitions=huge_app +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.fatflash.build.partitions=ffat +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.rainmaker=RainMaker +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.custom=Custom +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.custom.build.partitions= +sparkfun_esp32c6_thing_plus.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +sparkfun_esp32c6_thing_plus.menu.CPUFreq.160=160MHz (WiFi) +sparkfun_esp32c6_thing_plus.menu.CPUFreq.160.build.f_cpu=160000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.80=80MHz (WiFi) +sparkfun_esp32c6_thing_plus.menu.CPUFreq.80.build.f_cpu=80000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.40=40MHz +sparkfun_esp32c6_thing_plus.menu.CPUFreq.40.build.f_cpu=40000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.20=20MHz +sparkfun_esp32c6_thing_plus.menu.CPUFreq.20.build.f_cpu=20000000L +sparkfun_esp32c6_thing_plus.menu.CPUFreq.10=10MHz +sparkfun_esp32c6_thing_plus.menu.CPUFreq.10.build.f_cpu=10000000L + +sparkfun_esp32c6_thing_plus.menu.FlashMode.qio=QIO +sparkfun_esp32c6_thing_plus.menu.FlashMode.qio.build.flash_mode=dio +sparkfun_esp32c6_thing_plus.menu.FlashMode.qio.build.boot=qio +sparkfun_esp32c6_thing_plus.menu.FlashMode.dio=DIO +sparkfun_esp32c6_thing_plus.menu.FlashMode.dio.build.flash_mode=dio +sparkfun_esp32c6_thing_plus.menu.FlashMode.dio.build.boot=dio + +sparkfun_esp32c6_thing_plus.menu.FlashFreq.80=80MHz +sparkfun_esp32c6_thing_plus.menu.FlashFreq.80.build.flash_freq=80m +sparkfun_esp32c6_thing_plus.menu.FlashFreq.40=40MHz +sparkfun_esp32c6_thing_plus.menu.FlashFreq.40.build.flash_freq=40m + +sparkfun_esp32c6_thing_plus.menu.FlashSize.4M=4MB (32Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.4M.build.flash_size=4MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.8M=8MB (64Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.8M.build.flash_size=8MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.8M.build.partitions=default_8MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.2M=2MB (16Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.2M.build.flash_size=2MB +sparkfun_esp32c6_thing_plus.menu.FlashSize.2M.build.partitions=minimal +sparkfun_esp32c6_thing_plus.menu.FlashSize.16M=16MB (128Mb) +sparkfun_esp32c6_thing_plus.menu.FlashSize.16M.build.flash_size=16MB + +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.921600=921600 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.921600.upload.speed=921600 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.115200=115200 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.115200.upload.speed=115200 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.256000.windows=256000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.256000.upload.speed=256000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.230400.windows.upload.speed=256000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.230400=230400 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.230400.upload.speed=230400 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.460800.linux=460800 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.460800.macosx=460800 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.460800.upload.speed=460800 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.512000.windows=512000 +sparkfun_esp32c6_thing_plus.menu.UploadSpeed.512000.upload.speed=512000 + +sparkfun_esp32c6_thing_plus.menu.DebugLevel.none=None +sparkfun_esp32c6_thing_plus.menu.DebugLevel.none.build.code_debug=0 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.error=Error +sparkfun_esp32c6_thing_plus.menu.DebugLevel.error.build.code_debug=1 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.warn=Warn +sparkfun_esp32c6_thing_plus.menu.DebugLevel.warn.build.code_debug=2 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.info=Info +sparkfun_esp32c6_thing_plus.menu.DebugLevel.info.build.code_debug=3 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.debug=Debug +sparkfun_esp32c6_thing_plus.menu.DebugLevel.debug.build.code_debug=4 +sparkfun_esp32c6_thing_plus.menu.DebugLevel.verbose=Verbose +sparkfun_esp32c6_thing_plus.menu.DebugLevel.verbose.build.code_debug=5 + +sparkfun_esp32c6_thing_plus.menu.EraseFlash.none=Disabled +sparkfun_esp32c6_thing_plus.menu.EraseFlash.none.upload.erase_cmd= +sparkfun_esp32c6_thing_plus.menu.EraseFlash.all=Enabled +sparkfun_esp32c6_thing_plus.menu.EraseFlash.all.upload.erase_cmd=-e + +############################################################## + esp32micromod.name=SparkFun ESP32 MicroMod esp32micromod.bootloader.tool=esptool_py diff --git a/variants/sparkfun_esp32c6_thing_plus/pins_arduino.h b/variants/sparkfun_esp32c6_thing_plus/pins_arduino.h new file mode 100644 index 00000000000..60bd42884d1 --- /dev/null +++ b/variants/sparkfun_esp32c6_thing_plus/pins_arduino.h @@ -0,0 +1,35 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define PIN_NEOPIXEL 23 +// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT+PIN_NEOPIXEL; +#define BUILTIN_LED LED_BUILTIN // backward compatibility +#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN +// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite() +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +static const uint8_t TX = 16; +static const uint8_t RX = 17; + +static const uint8_t SDA = 6; +static const uint8_t SCL = 7; + +static const uint8_t SS = 5; +static const uint8_t MOSI = 20; +static const uint8_t MISO = 21; +static const uint8_t SCK = 19; + +static const uint8_t A0 = 0; +static const uint8_t A1 = 1; +static const uint8_t A2 = 2; +static const uint8_t A3 = 3; +static const uint8_t A4 = 4; +static const uint8_t A5 = 5; +static const uint8_t A6 = 6; + +#endif /* Pins_Arduino_h */ From f764af0d1cdfcb264b648228db2fcb7d16b3c8de Mon Sep 17 00:00:00 2001 From: "Dirk O. Kaar" <19971886+dok-net@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:53:56 +0100 Subject: [PATCH 5/9] Ticker updated to match extensions in ESP8266 API (#2849) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update Ticker API to compatibility with ESP8266, prepares for co-op loop Scheduler * Fixing Build server complaints * Fix omitted casts in template member function * Changes after review * Expose µs resolution of OS API in Ticker class * Return Ticker to libraries only for modularity. * Unify Ticker examples. * Default for LED_BUILTIN * In Ticker, the *scheduled functions become available in another development branch. * Astyle from ESP8266 * Fixed Arduino keywords.txt * 64bit integers instead of 32bits, timer functions on ESP32 accept 64bit integers. * Move code from header into compiliation unit. Reformat. * Test case same as ESP8266 * Implementing inline in header saves 204+ bytes program size. * Examples * Fix a compiler warning due to c-style casting. * Revert formatting changes * More format reversions * Revert * Revert * Revert --------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> --- .../Ticker/examples/Arguments/Arguments.ino | 51 ------------ .../examples/TickerBasic/TickerBasic.ino | 49 +++++++++++ .../TickerParameter/TickerParameter.ino | 54 ++++++++++++ libraries/Ticker/keywords.txt | 4 + libraries/Ticker/src/Ticker.cpp | 17 +++- libraries/Ticker/src/Ticker.h | 83 +++++++++++++------ 6 files changed, 177 insertions(+), 81 deletions(-) delete mode 100644 libraries/Ticker/examples/Arguments/Arguments.ino create mode 100644 libraries/Ticker/examples/TickerBasic/TickerBasic.ino create mode 100644 libraries/Ticker/examples/TickerParameter/TickerParameter.ino diff --git a/libraries/Ticker/examples/Arguments/Arguments.ino b/libraries/Ticker/examples/Arguments/Arguments.ino deleted file mode 100644 index 7f5bc5cde21..00000000000 --- a/libraries/Ticker/examples/Arguments/Arguments.ino +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This example demonstrates used of Ticker with arguments. - * You can call the same callback function with different argument on different times. - * Based on the argument the callback can perform different tasks. - */ - -#include -#include - -// Arguments for the function must remain valid (not run out of scope) otherwise the function would read garbage data. -int LED_PIN_1 = 4; -#ifdef LED_BUILTIN - int LED_PIN_2 = LED_BUILTIN; -#else - int LED_PIN_2 = 8; -#endif - -Ticker tickerSetHigh; -Ticker tickerSetLow; - -// Argument to callback must always be passed a reference -void swapState(int *pin) { - static int led_1_state = 1; - static int led_2_state = 1; - if(*pin == LED_PIN_1){ - Serial.printf("[%lu ms] set pin %d to state: %d\n", millis(), *pin, led_1_state); - digitalWrite(*pin, led_1_state); - led_1_state = led_1_state ? 0 : 1; // reverse for next pass - }else if(*pin == LED_PIN_2){ - Serial.printf("[%lu ms] set pin %d to state: %d\n", millis(), *pin, led_2_state); - digitalWrite(*pin, led_2_state); - led_2_state = led_2_state ? 0 : 1; // reverse for next pass - } -} - -void setup() { - Serial.begin(115200); - pinMode(LED_PIN_1, OUTPUT); - pinMode(LED_PIN_2, OUTPUT); - //digitalWrite(1, LOW); - - // Blink LED every 500 ms on LED_PIN_1 - tickerSetLow.attach_ms(500, swapState, &LED_PIN_1); - - // Blink LED every 1000 ms on LED_PIN_2 - tickerSetHigh.attach_ms(1000, swapState, &LED_PIN_2); -} - -void loop() { - -} diff --git a/libraries/Ticker/examples/TickerBasic/TickerBasic.ino b/libraries/Ticker/examples/TickerBasic/TickerBasic.ino new file mode 100644 index 00000000000..8de5a1282ad --- /dev/null +++ b/libraries/Ticker/examples/TickerBasic/TickerBasic.ino @@ -0,0 +1,49 @@ +/* + Basic Ticker usage + + Ticker is an object that will call a given function with a certain period. + Each Ticker calls one function. You can have as many Tickers as you like, + memory being the only limitation. + + A function may be attached to a ticker and detached from the ticker. + There are two variants of the attach function: attach and attach_ms. + The first one takes period in seconds, the second one in milliseconds. + + The built-in LED will be blinking. +*/ + +#include + +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 +#endif + +Ticker flipper; + +int count = 0; + +void flip() { + int state = digitalRead(LED_BUILTIN); // get the current state of GPIO1 pin + digitalWrite(LED_BUILTIN, !state); // set pin to the opposite state + + ++count; + // when the counter reaches a certain value, start blinking like crazy + if (count == 20) { + flipper.attach(0.1, flip); + } + // when the counter reaches yet another value, stop blinking + else if (count == 120) { + flipper.detach(); + } +} + +void setup() { + pinMode(LED_BUILTIN, OUTPUT); + digitalWrite(LED_BUILTIN, LOW); + + // flip the pin every 0.3s + flipper.attach(0.3, flip); +} + +void loop() { +} diff --git a/libraries/Ticker/examples/TickerParameter/TickerParameter.ino b/libraries/Ticker/examples/TickerParameter/TickerParameter.ino new file mode 100644 index 00000000000..ceb79e32f54 --- /dev/null +++ b/libraries/Ticker/examples/TickerParameter/TickerParameter.ino @@ -0,0 +1,54 @@ +/* + Passing paramters to Ticker callbacks + + Apart from void(void) functions, the Ticker library supports + functions taking one argument. This argument's size has to be less or + equal to 4 bytes (so char, short, int, float, void*, char* types will do). + + This sample runs two tickers that both call one callback function, + but with different arguments. + + The built-in LED will be pulsing. +*/ + +#include + +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 +#endif + +Ticker tickerSetLow; +Ticker tickerSetHigh; +Ticker tickerSetChar; + +void setPinLow() { + digitalWrite(LED_BUILTIN, 0); +} + +void setPinHigh() { + digitalWrite(LED_BUILTIN, 1); +} + +void setPin(int state) { + digitalWrite(LED_BUILTIN, state); +} + +void setPinChar(char state) { + digitalWrite(LED_BUILTIN, state); +} + +void setup() { + pinMode(LED_BUILTIN, OUTPUT); + + // every 25 ms, call setPinLow() + tickerSetLow.attach_ms(25, setPinLow); + + // every 26 ms, call setPinHigh() + tickerSetHigh.attach_ms(26, setPinHigh); + + // every 54 ms, call setPinChar(1) + tickerSetChar.attach_ms(26, setPinChar, (char)1); +} + +void loop() { +} diff --git a/libraries/Ticker/keywords.txt b/libraries/Ticker/keywords.txt index 81cce2c8ea5..f5f1266516d 100644 --- a/libraries/Ticker/keywords.txt +++ b/libraries/Ticker/keywords.txt @@ -10,5 +10,9 @@ Ticker KEYWORD1 attach KEYWORD2 attach_ms KEYWORD2 +attach_us KEYWORD2 once KEYWORD2 +once_ms KEYWORD2 +once_us KEYWORD2 detach KEYWORD2 +active KEYWORD2 diff --git a/libraries/Ticker/src/Ticker.cpp b/libraries/Ticker/src/Ticker.cpp index 629361b2dd0..6c996ed56b3 100644 --- a/libraries/Ticker/src/Ticker.cpp +++ b/libraries/Ticker/src/Ticker.cpp @@ -31,7 +31,7 @@ Ticker::~Ticker() { detach(); } -void Ticker::_attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callback, uint32_t arg) { +void Ticker::_attach_us(uint64_t micros, bool repeat, callback_with_arg_t callback, void* arg) { esp_timer_create_args_t _timerConfig; _timerConfig.arg = reinterpret_cast(arg); _timerConfig.callback = callback; @@ -43,9 +43,9 @@ void Ticker::_attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t } esp_timer_create(&_timerConfig, &_timer); if (repeat) { - esp_timer_start_periodic(_timer, milliseconds * 1000ULL); + esp_timer_start_periodic(_timer, micros); } else { - esp_timer_start_once(_timer, milliseconds * 1000ULL); + esp_timer_start_once(_timer, micros); } } @@ -54,10 +54,19 @@ void Ticker::detach() { esp_timer_stop(_timer); esp_timer_delete(_timer); _timer = nullptr; + _callback_function = nullptr; } } -bool Ticker::active() { +bool Ticker::active() const { if (!_timer) return false; return esp_timer_is_active(_timer); } + +void Ticker::_static_callback(void* arg) +{ + Ticker* _this = reinterpret_cast(arg); + if (_this && _this->_callback_function) + _this->_callback_function(); +} + diff --git a/libraries/Ticker/src/Ticker.h b/libraries/Ticker/src/Ticker.h index 82804e0f37d..50ab424c275 100644 --- a/libraries/Ticker/src/Ticker.h +++ b/libraries/Ticker/src/Ticker.h @@ -28,79 +28,110 @@ extern "C" { #include "esp_timer.h" } +#include class Ticker { public: Ticker(); ~Ticker(); - typedef void (*callback_t)(void); + typedef void (*callback_with_arg_t)(void*); + typedef std::function callback_function_t; + + void attach(float seconds, callback_function_t callback) + { + _callback_function = std::move(callback); + _attach_us(1000000ULL * seconds, true, _static_callback, this); + } - void attach(float seconds, callback_t callback) + void attach_ms(uint64_t milliseconds, callback_function_t callback) { - _attach_ms(seconds * 1000, true, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(1000ULL * milliseconds, true, _static_callback, this); } - void attach_ms(uint32_t milliseconds, callback_t callback) + void attach_us(uint64_t micros, callback_function_t callback) { - _attach_ms(milliseconds, true, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(micros, true, _static_callback, this); } template void attach(float seconds, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach() callback argument size must be <= 4 bytes"); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); // C-cast serves two purposes: // static_cast for smaller integer types, // reinterpret_cast + const_cast for pointer types - uint32_t arg32 = (uint32_t)arg; - _attach_ms(seconds * 1000, true, reinterpret_cast(callback), arg32); + _attach_us(1000000ULL * seconds, true, reinterpret_cast(callback), reinterpret_cast(arg)); + } + + template + void attach_ms(uint64_t milliseconds, void (*callback)(TArg), TArg arg) + { + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(1000ULL * milliseconds, true, reinterpret_cast(callback), reinterpret_cast(arg)); } template - void attach_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg) + void attach_us(uint64_t micros, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach_ms() callback argument size must be <= 4 bytes"); - uint32_t arg32 = (uint32_t)arg; - _attach_ms(milliseconds, true, reinterpret_cast(callback), arg32); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(micros, true, reinterpret_cast(callback), reinterpret_cast(arg)); } - void once(float seconds, callback_t callback) + void once(float seconds, callback_function_t callback) { - _attach_ms(seconds * 1000, false, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(1000000ULL * seconds, false, _static_callback, this); } - void once_ms(uint32_t milliseconds, callback_t callback) + void once_ms(uint64_t milliseconds, callback_function_t callback) { - _attach_ms(milliseconds, false, reinterpret_cast(callback), 0); + _callback_function = std::move(callback); + _attach_us(1000ULL * milliseconds, false, _static_callback, this); + } + + void once_us(uint64_t micros, callback_function_t callback) + { + _callback_function = std::move(callback); + _attach_us(micros, false, _static_callback, this); } template void once(float seconds, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach() callback argument size must be <= 4 bytes"); - uint32_t arg32 = (uint32_t)(arg); - _attach_ms(seconds * 1000, false, reinterpret_cast(callback), arg32); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(1000000ULL * seconds, false, reinterpret_cast(callback), reinterpret_cast(arg)); + } + + template + void once_ms(uint64_t milliseconds, void (*callback)(TArg), TArg arg) + { + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(1000ULL * milliseconds, false, reinterpret_cast(callback), reinterpret_cast(arg)); } template - void once_ms(uint32_t milliseconds, void (*callback)(TArg), TArg arg) + void once_us(uint64_t micros, void (*callback)(TArg), TArg arg) { - static_assert(sizeof(TArg) <= sizeof(uint32_t), "attach_ms() callback argument size must be <= 4 bytes"); - uint32_t arg32 = (uint32_t)(arg); - _attach_ms(milliseconds, false, reinterpret_cast(callback), arg32); + static_assert(sizeof(TArg) <= sizeof(void*), "attach() callback argument size must be <= sizeof(void*)"); + _attach_us(micros, false, reinterpret_cast(callback), reinterpret_cast(arg)); } void detach(); - bool active(); + bool active() const; protected: - void _attach_ms(uint32_t milliseconds, bool repeat, callback_with_arg_t callback, uint32_t arg); + static void _static_callback(void* arg); + callback_function_t _callback_function = nullptr; -protected: esp_timer_handle_t _timer; + +private: + void _attach_us(uint64_t micros, bool repeat, callback_with_arg_t callback, void* arg); }; From 77b64506a6edee295ba4738f6e52db3891041e3c Mon Sep 17 00:00:00 2001 From: Leif Date: Wed, 31 Jan 2024 17:54:34 +0700 Subject: [PATCH 6/9] ArduinoOTA upload intermittent failure fixed (#4657) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * OTA upload often fails when client.read() return -1 and we subsequently try to write 4 gigabytes to flash. Fixed by signed comparison and retry. * Delay of 1ms already solves the issue * Update libraries/ArduinoOTA/src/ArduinoOTA.cpp Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> --------- Co-authored-by: Leif Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> --- libraries/ArduinoOTA/src/ArduinoOTA.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/ArduinoOTA/src/ArduinoOTA.cpp b/libraries/ArduinoOTA/src/ArduinoOTA.cpp index f7ad9105813..ee9c3e95301 100644 --- a/libraries/ArduinoOTA/src/ArduinoOTA.cpp +++ b/libraries/ArduinoOTA/src/ArduinoOTA.cpp @@ -315,6 +315,10 @@ void ArduinoOTAClass::_runUpdate() { size_t r = client.read(buf, available); if(r != available){ log_w("didn't read enough! %u != %u", r, available); + if((int32_t) r<0) { + delay(1); + continue; //let's not try to write 4 gigabytes when client.read returns -1 + } } written = Update.write(buf, r); From b62d95bc0507746d64a702c0cb3dc9c11cb157c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Proch=C3=A1zka?= <90197375+P-R-O-C-H-Y@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:56:55 +0100 Subject: [PATCH 7/9] fix(ci): Update actions to use Node.js 20 (#9194) --- .github/workflows/allboards.yml | 6 +++--- .github/workflows/boards.yml | 4 ++-- .github/workflows/build_py_tools.yml | 4 ++-- .github/workflows/docs_build.yml | 4 ++-- .github/workflows/docs_deploy.yml | 4 ++-- .github/workflows/gh-pages.yml | 2 +- .github/workflows/hil.yml | 6 +++--- .github/workflows/lib.yml | 4 ++-- .github/workflows/push.yml | 18 +++++++++--------- .github/workflows/release.yml | 4 ++-- .github/workflows/upload-idf-component.yml | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/allboards.yml b/.github/workflows/allboards.yml index 49370120339..4a2d4349ac3 100644 --- a/.github/workflows/allboards.yml +++ b/.github/workflows/allboards.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.client_payload.branch }} @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.client_payload.branch }} @@ -66,7 +66,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.client_payload.branch }} diff --git a/.github/workflows/boards.yml b/.github/workflows/boards.yml index 3e189231932..a16de38d5a5 100644 --- a/.github/workflows/boards.yml +++ b/.github/workflows/boards.yml @@ -18,7 +18,7 @@ jobs: steps: # This step makes the contents of the repository available to the workflow - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup jq uses: dcarbone/install-jq-action@v1.0.1 @@ -43,7 +43,7 @@ jobs: steps: # This step makes the contents of the repository available to the workflow - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check if build.board is uppercase run: | diff --git a/.github/workflows/build_py_tools.yml b/.github/workflows/build_py_tools.yml index 46ecf6da756..e83f566e170 100644 --- a/.github/workflows/build_py_tools.yml +++ b/.github/workflows/build_py_tools.yml @@ -17,7 +17,7 @@ jobs: all_changed_files: ${{ steps.verify-changed-files.outputs.all_changed_files }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 ref: ${{ github.event.pull_request.head.ref }} @@ -87,7 +87,7 @@ jobs: echo "tool $tool was changed" done - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref }} - name: Set up Python 3.8 diff --git a/.github/workflows/docs_build.yml b/.github/workflows/docs_build.yml index 2009425a33e..d5cd652f3df 100644 --- a/.github/workflows/docs_build.yml +++ b/.github/workflows/docs_build.yml @@ -22,10 +22,10 @@ jobs: run: shell: bash steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' - name: Build diff --git a/.github/workflows/docs_deploy.yml b/.github/workflows/docs_deploy.yml index a8021f67e34..07dc03ba547 100644 --- a/.github/workflows/docs_deploy.yml +++ b/.github/workflows/docs_deploy.yml @@ -20,10 +20,10 @@ jobs: run: shell: bash steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.10' - name: Deploy Documentation diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index cea5e1eac86..5d8e1794a8a 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -16,7 +16,7 @@ jobs: name: Build GitHub Pages runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Copy Files env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/hil.yml b/.github/workflows/hil.yml index 10c937f1bfe..0b29d4aafb9 100644 --- a/.github/workflows/hil.yml +++ b/.github/workflows/hil.yml @@ -25,7 +25,7 @@ jobs: chunks: ${{ steps.gen-chunks.outputs.chunks }} steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Generate Chunks matrix id: gen-chunks @@ -51,7 +51,7 @@ jobs: chunks: ${{fromJson(needs.gen_chunks.outputs.chunks)}} steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build sketches run: | bash .github/scripts/tests_build.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}} @@ -78,7 +78,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download ${{matrix.chip}}-${{matrix.chunks}} artifacts uses: actions/download-artifact@v3 diff --git a/.github/workflows/lib.yml b/.github/workflows/lib.yml index 5e44e705e29..3995aaad4fd 100644 --- a/.github/workflows/lib.yml +++ b/.github/workflows/lib.yml @@ -57,7 +57,7 @@ jobs: steps: # This step makes the contents of the repository available to the workflow - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile sketch uses: P-R-O-C-H-Y/compile-sketches@main @@ -87,7 +87,7 @@ jobs: steps: # Check out repository - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ env.GITHUB_TOKEN }} fetch-depth: '0' diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9a0561c92cd..c7c48225ca4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -18,7 +18,7 @@ jobs: name: Check cmake file runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - run: bash ./.github/scripts/check-cmakelists.sh # Ubuntu @@ -31,13 +31,13 @@ jobs: chunk: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Cache tools id: cache-linux - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ./tools/dist @@ -58,8 +58,8 @@ jobs: os: [windows-latest, macOS-latest] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Build Sketches @@ -75,8 +75,8 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Build Sketches @@ -97,7 +97,7 @@ jobs: container: espressif/idf:${{ matrix.idf_ver }} steps: - name: Check out arduino-esp32 as a component - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive path: components/arduino-esp32 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5555027bf0..3a59d7a7dc4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Build Release diff --git a/.github/workflows/upload-idf-component.yml b/.github/workflows/upload-idf-component.yml index 8fcebf00204..ca21361689f 100644 --- a/.github/workflows/upload-idf-component.yml +++ b/.github/workflows/upload-idf-component.yml @@ -7,7 +7,7 @@ jobs: upload_components: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: "recursive" From bbe09cce0eff5dd2bc2270ca424e95595d187bb9 Mon Sep 17 00:00:00 2001 From: Aron Rubin Date: Wed, 31 Jan 2024 07:47:10 -0500 Subject: [PATCH 8/9] Separated library sources in cmake for selective. (#5136) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Separated library sources in cmake for selective. * Reodered selective process to match CI script * Fixed missing SimpleBLE in library list * fix(cmake): Remove duplicate or non existing sources * fix(cmake): Remove required component --------- Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> --- CMakeLists.txt | 200 +++++++++++++++++++++++++++++++------------------ 1 file changed, 127 insertions(+), 73 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 802a8f87d2a..bba8b88b146 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,29 +74,85 @@ set(CORE_SRCS cores/esp32/WString.cpp ) -set(LIBRARY_SRCS - libraries/ArduinoOTA/src/ArduinoOTA.cpp - libraries/AsyncUDP/src/AsyncUDP.cpp +set(ARDUINO_ALL_LIBRARIES + ArduinoOTA + AsyncUDP + BLE + BluetoothSerial + DNSServer + EEPROM + ESP_I2S + ESP_SR + ESPmDNS + Ethernet + FFat + FS + HTTPClient + HTTPUpdate + Insights + LittleFS + NetBIOS + Preferences + RainMaker + SD_MMC + SD + SimpleBLE + SPIFFS + SPI + Ticker + Update + USB + WebServer + WiFiClientSecure + WiFi + WiFiProv + Wire + ) + +set(ARDUINO_LIBRARY_ArduinoOTA_SRCS libraries/ArduinoOTA/src/ArduinoOTA.cpp) +set(ARDUINO_LIBRARY_ArduinoOTA_REQUIRES esp_https_ota) + +set(ARDUINO_LIBRARY_AsyncUDP_SRCS libraries/AsyncUDP/src/AsyncUDP.cpp) + +set(ARDUINO_LIBRARY_BluetoothSerial_SRCS libraries/BluetoothSerial/src/BluetoothSerial.cpp libraries/BluetoothSerial/src/BTAddress.cpp libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp - libraries/BluetoothSerial/src/BTScanResultsSet.cpp - libraries/DNSServer/src/DNSServer.cpp - libraries/EEPROM/src/EEPROM.cpp - libraries/ESP_I2S/src/ESP_I2S.cpp + libraries/BluetoothSerial/src/BTScanResultsSet.cpp) + +set(ARDUINO_LIBRARY_DNSServer_SRCS libraries/DNSServer/src/DNSServer.cpp) + +set(ARDUINO_LIBRARY_EEPROM_SRCS libraries/EEPROM/src/EEPROM.cpp) + +set(ARDUINO_LIBRARY_ESP_I2S_SRCS libraries/ESP_I2S/src/ESP_I2S.cpp) + +set(ARDUINO_LIBRARY_ESP_SR_SRCS libraries/ESP_SR/src/ESP_SR.cpp - libraries/ESP_SR/src/esp32-hal-sr.c - libraries/ESPmDNS/src/ESPmDNS.cpp - libraries/Ethernet/src/ETH.cpp - libraries/FFat/src/FFat.cpp + libraries/ESP_SR/src/esp32-hal-sr.c) + +set(ARDUINO_LIBRARY_ESPmDNS_SRCS libraries/ESPmDNS/src/ESPmDNS.cpp) + +set(ARDUINO_LIBRARY_Ethernet_SRCS libraries/Ethernet/src/ETH.cpp) + +set(ARDUINO_LIBRARY_FFat_SRCS libraries/FFat/src/FFat.cpp) + +set(ARDUINO_LIBRARY_FS_SRCS libraries/FS/src/FS.cpp - libraries/FS/src/vfs_api.cpp - libraries/HTTPClient/src/HTTPClient.cpp - libraries/HTTPUpdate/src/HTTPUpdate.cpp - libraries/LittleFS/src/LittleFS.cpp - libraries/Insights/src/Insights.cpp - libraries/NetBIOS/src/NetBIOS.cpp - libraries/Preferences/src/Preferences.cpp + libraries/FS/src/vfs_api.cpp) + +set(ARDUINO_LIBRARY_HTTPClient_SRCS libraries/HTTPClient/src/HTTPClient.cpp) + +set(ARDUINO_LIBRARY_HTTPUpdate_SRCS libraries/HTTPUpdate/src/HTTPUpdate.cpp) + +set(ARDUINO_LIBRARY_Insights_SRCS libraries/Insights/src/Insights.cpp) + +set(ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp) + +set(ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp) + +set(ARDUINO_LIBRARY_Preferences_SRCS libraries/Preferences/src/Preferences.cpp) + +set(ARDUINO_LIBRARY_RainMaker_SRCS libraries/RainMaker/src/RMaker.cpp libraries/RainMaker/src/RMakerNode.cpp libraries/RainMaker/src/RMakerParam.cpp @@ -104,17 +160,28 @@ set(LIBRARY_SRCS libraries/RainMaker/src/RMakerType.cpp libraries/RainMaker/src/RMakerQR.cpp libraries/RainMaker/src/RMakerUtils.cpp - libraries/RainMaker/src/AppInsights.cpp - libraries/SD_MMC/src/SD_MMC.cpp + libraries/RainMaker/src/AppInsights.cpp) + +set(ARDUINO_LIBRARY_SD_MMC_SRCS libraries/SD_MMC/src/SD_MMC.cpp) + +set(ARDUINO_LIBRARY_SD_SRCS libraries/SD/src/SD.cpp libraries/SD/src/sd_diskio.cpp - libraries/SD/src/sd_diskio_crc.c - libraries/SimpleBLE/src/SimpleBLE.cpp - libraries/SPIFFS/src/SPIFFS.cpp - libraries/SPI/src/SPI.cpp - libraries/Ticker/src/Ticker.cpp + libraries/SD/src/sd_diskio_crc.c) + +set(ARDUINO_LIBRARY_SimpleBLE_SRCS libraries/SimpleBLE/src/SimpleBLE.cpp) + +set(ARDUINO_LIBRARY_SPIFFS_SRCS libraries/SPIFFS/src/SPIFFS.cpp) + +set(ARDUINO_LIBRARY_SPI_SRCS libraries/SPI/src/SPI.cpp) + +set(ARDUINO_LIBRARY_Ticker_SRCS libraries/Ticker/src/Ticker.cpp) + +set(ARDUINO_LIBRARY_Update_SRCS libraries/Update/src/Updater.cpp - libraries/Update/src/HttpsOTAUpdate.cpp + libraries/Update/src/HttpsOTAUpdate.cpp) + +set(ARDUINO_LIBRARY_USB_SRCS libraries/USB/src/USBHID.cpp libraries/USB/src/USBMIDI.cpp libraries/USB/src/USBHIDMouse.cpp @@ -123,12 +190,18 @@ set(LIBRARY_SRCS libraries/USB/src/USBHIDConsumerControl.cpp libraries/USB/src/USBHIDSystemControl.cpp libraries/USB/src/USBHIDVendor.cpp - libraries/USB/src/USBVendor.cpp + libraries/USB/src/USBVendor.cpp) + +set(ARDUINO_LIBRARY_WebServer_SRCS libraries/WebServer/src/WebServer.cpp libraries/WebServer/src/Parsing.cpp - libraries/WebServer/src/detail/mimetable.cpp + libraries/WebServer/src/detail/mimetable.cpp) + +set(ARDUINO_LIBRARY_WiFiClientSecure_SRCS libraries/WiFiClientSecure/src/ssl_client.cpp - libraries/WiFiClientSecure/src/WiFiClientSecure.cpp + libraries/WiFiClientSecure/src/WiFiClientSecure.cpp) + +set(ARDUINO_LIBRARY_WiFi_SRCS libraries/WiFi/src/WiFiAP.cpp libraries/WiFi/src/WiFiClient.cpp libraries/WiFi/src/WiFi.cpp @@ -137,12 +210,13 @@ set(LIBRARY_SRCS libraries/WiFi/src/WiFiScan.cpp libraries/WiFi/src/WiFiServer.cpp libraries/WiFi/src/WiFiSTA.cpp - libraries/WiFi/src/WiFiUdp.cpp - libraries/WiFiProv/src/WiFiProv.cpp - libraries/Wire/src/Wire.cpp - ) + libraries/WiFi/src/WiFiUdp.cpp) + +set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp) -set(BLE_SRCS +set(ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp) + +set(ARDUINO_LIBRARY_BLE_SRCS libraries/BLE/src/BLE2902.cpp libraries/BLE/src/BLE2904.cpp libraries/BLE/src/BLEAddress.cpp @@ -174,48 +248,28 @@ set(BLE_SRCS libraries/BLE/src/GeneralUtils.cpp ) -set(includedirs - variants/${CONFIG_ARDUINO_VARIANT}/ - cores/esp32/ - libraries/ArduinoOTA/src - libraries/AsyncUDP/src - libraries/BLE/src - libraries/BluetoothSerial/src - libraries/DNSServer/src - libraries/EEPROM/src - libraries/ESP_I2S/src - libraries/ESP_SR/src - libraries/ESP32/src - libraries/ESPmDNS/src - libraries/Ethernet/src - libraries/FFat/src - libraries/FS/src - libraries/HTTPClient/src - libraries/HTTPUpdate/src - libraries/LittleFS/src - libraries/Insights/src - libraries/NetBIOS/src - libraries/Preferences/src - libraries/RainMaker/src - libraries/SD_MMC/src - libraries/SD/src - libraries/SimpleBLE/src - libraries/SPIFFS/src - libraries/SPI/src - libraries/Ticker/src - libraries/Update/src - libraries/USB/src - libraries/WebServer/src - libraries/WiFiClientSecure/src - libraries/WiFi/src - libraries/WiFiProv/src - libraries/Wire/src - ) +set(ARDUINO_LIBRARIES_SRCS) +set(ARDUINO_LIBRARIES_REQUIRES) +set(ARDUINO_LIBRARIES_INCLUDEDIRS) +foreach(libname IN LISTS ARDUINO_ALL_LIBRARIES) + if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_${libname}) + if(ARDUINO_LIBRARY_${libname}_SRCS) + list(APPEND ARDUINO_LIBRARIES_SRCS ${ARDUINO_LIBRARY_${libname}_SRCS}) + endif() + if(ARDUINO_LIBRARY_${libname}_REQUIRES) + list(APPEND ARDUINO_LIBRARIES_REQUIRES ${ARDUINO_LIBRARY_${libname}_REQUIRES}) + endif() + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libraries/${libname}/src) + list(APPEND ARDUINO_LIBRARIES_INCLUDEDIRS libraries/${libname}/src) + endif() + endif() +endforeach() -set(srcs ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS}) +set(includedirs variants/${CONFIG_ARDUINO_VARIANT}/ cores/esp32/ ${ARDUINO_LIBRARIES_INCLUDEDIRS}) +set(srcs ${CORE_SRCS} ${ARDUINO_LIBRARIES_SRCS}) set(priv_includes cores/esp32/libb64) set(requires spi_flash esp_partition mbedtls wifi_provisioning wpa_supplicant esp_adc esp_eth http_parser) -set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid) +set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support bt esp_hid ${ARDUINO_LIBRARIES_REQUIRES}) idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) From 83e2612f8c308056609ef772a0dc422f7c5b4c11 Mon Sep 17 00:00:00 2001 From: yelo Date: Wed, 31 Jan 2024 22:07:06 +0800 Subject: [PATCH 9/9] feat: Add board support for Nologo ESP32S3 Pico (#9181) detail of nologo esp32s3 pico: https://www.nologo.tech/product/esp32/esp32s3Pico/esp32S3Pico.html --- boards.txt | 241 ++++++++++++++++++++ variants/nologo_esp32s3_pico/pins_arduino.h | 37 +++ 2 files changed, 278 insertions(+) create mode 100644 variants/nologo_esp32s3_pico/pins_arduino.h diff --git a/boards.txt b/boards.txt index 203502a8fa7..3261b181bf7 100644 --- a/boards.txt +++ b/boards.txt @@ -14272,6 +14272,247 @@ nologo_esp32c3_super_mini.menu.EraseFlash.all.upload.erase_cmd=-e ############################################################## +nologo_esp32s3_pico.name=Nologo ESP32S3 Pico +nologo_esp32s3_pico.vid.0=0x303a +nologo_esp32s3_pico.pid.0=0x1001 + +nologo_esp32s3_pico.bootloader.tool=esptool_py +nologo_esp32s3_pico.bootloader.tool.default=esptool_py + +nologo_esp32s3_pico.upload.tool=esptool_py +nologo_esp32s3_pico.upload.tool.default=esptool_py +nologo_esp32s3_pico.upload.tool.network=esp_ota + +nologo_esp32s3_pico.upload.maximum_size=1310720 +nologo_esp32s3_pico.upload.maximum_data_size=327680 +nologo_esp32s3_pico.upload.flags= +nologo_esp32s3_pico.upload.extra_flags= +nologo_esp32s3_pico.upload.use_1200bps_touch=false +nologo_esp32s3_pico.upload.wait_for_upload_port=false + +nologo_esp32s3_pico.serial.disableDTR=false +nologo_esp32s3_pico.serial.disableRTS=false + +nologo_esp32s3_pico.build.tarch=xtensa +nologo_esp32s3_pico.build.bootloader_addr=0x0 +nologo_esp32s3_pico.build.target=esp32s3 +nologo_esp32s3_pico.build.mcu=esp32s3 +nologo_esp32s3_pico.build.core=esp32 +nologo_esp32s3_pico.build.variant=nologo_esp32s3_pico +nologo_esp32s3_pico.build.board=NOLOGO_ESP32S3_PICO + +nologo_esp32s3_pico.build.usb_mode=1 +nologo_esp32s3_pico.build.cdc_on_boot=1 +nologo_esp32s3_pico.build.msc_on_boot=0 +nologo_esp32s3_pico.build.dfu_on_boot=0 +nologo_esp32s3_pico.build.f_cpu=240000000L +nologo_esp32s3_pico.build.flash_size=8MB +nologo_esp32s3_pico.build.flash_freq=80m +nologo_esp32s3_pico.build.flash_mode=dio +nologo_esp32s3_pico.build.boot=qio +nologo_esp32s3_pico.build.boot_freq=80m +nologo_esp32s3_pico.build.partitions=default +nologo_esp32s3_pico.build.defines= +nologo_esp32s3_pico.build.loop_core= +nologo_esp32s3_pico.build.event_core= +nologo_esp32s3_pico.build.psram_type=qspi +nologo_esp32s3_pico.build.memory_type={build.boot}_{build.psram_type} + +## IDE 2.0 Seems to not update the value +nologo_esp32s3_pico.menu.JTAGAdapter.default=Disabled +nologo_esp32s3_pico.menu.JTAGAdapter.default.build.copy_jtag_files=0 +nologo_esp32s3_pico.menu.JTAGAdapter.builtin=Integrated USB JTAG +nologo_esp32s3_pico.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +nologo_esp32s3_pico.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 +nologo_esp32s3_pico.menu.JTAGAdapter.external=FTDI Adapter +nologo_esp32s3_pico.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +nologo_esp32s3_pico.menu.JTAGAdapter.external.build.copy_jtag_files=1 +nologo_esp32s3_pico.menu.JTAGAdapter.bridge=ESP USB Bridge +nologo_esp32s3_pico.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +nologo_esp32s3_pico.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 + +nologo_esp32s3_pico.menu.PSRAM.disabled=Disabled +nologo_esp32s3_pico.menu.PSRAM.disabled.build.defines= +nologo_esp32s3_pico.menu.PSRAM.disabled.build.psram_type=qspi +nologo_esp32s3_pico.menu.PSRAM.enabled=QSPI PSRAM +nologo_esp32s3_pico.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM +nologo_esp32s3_pico.menu.PSRAM.enabled.build.psram_type=qspi +nologo_esp32s3_pico.menu.PSRAM.opi=OPI PSRAM +nologo_esp32s3_pico.menu.PSRAM.opi.build.defines=-DBOARD_HAS_PSRAM +nologo_esp32s3_pico.menu.PSRAM.opi.build.psram_type=opi + +nologo_esp32s3_pico.menu.FlashMode.qio=QIO 80MHz +nologo_esp32s3_pico.menu.FlashMode.qio.build.flash_mode=dio +nologo_esp32s3_pico.menu.FlashMode.qio.build.boot=qio +nologo_esp32s3_pico.menu.FlashMode.qio.build.boot_freq=80m +nologo_esp32s3_pico.menu.FlashMode.qio.build.flash_freq=80m +nologo_esp32s3_pico.menu.FlashMode.qio120=QIO 120MHz +nologo_esp32s3_pico.menu.FlashMode.qio120.build.flash_mode=dio +nologo_esp32s3_pico.menu.FlashMode.qio120.build.boot=qio +nologo_esp32s3_pico.menu.FlashMode.qio120.build.boot_freq=120m +nologo_esp32s3_pico.menu.FlashMode.qio120.build.flash_freq=80m +nologo_esp32s3_pico.menu.FlashMode.dio=DIO 80MHz +nologo_esp32s3_pico.menu.FlashMode.dio.build.flash_mode=dio +nologo_esp32s3_pico.menu.FlashMode.dio.build.boot=dio +nologo_esp32s3_pico.menu.FlashMode.dio.build.boot_freq=80m +nologo_esp32s3_pico.menu.FlashMode.dio.build.flash_freq=80m +nologo_esp32s3_pico.menu.FlashMode.opi=OPI 80MHz +nologo_esp32s3_pico.menu.FlashMode.opi.build.flash_mode=dout +nologo_esp32s3_pico.menu.FlashMode.opi.build.boot=opi +nologo_esp32s3_pico.menu.FlashMode.opi.build.boot_freq=80m +nologo_esp32s3_pico.menu.FlashMode.opi.build.flash_freq=80m + +nologo_esp32s3_pico.menu.FlashSize.8M=8MB (64Mb) +nologo_esp32s3_pico.menu.FlashSize.8M.build.flash_size=8MB +nologo_esp32s3_pico.menu.FlashSize.8M.build.partitions=default_8MB +nologo_esp32s3_pico.menu.FlashSize.16M=16MB (128Mb) +nologo_esp32s3_pico.menu.FlashSize.16M.build.flash_size=16MB + +nologo_esp32s3_pico.menu.LoopCore.1=Core 1 +nologo_esp32s3_pico.menu.LoopCore.1.build.loop_core=-DARDUINO_RUNNING_CORE=1 +nologo_esp32s3_pico.menu.LoopCore.0=Core 0 +nologo_esp32s3_pico.menu.LoopCore.0.build.loop_core=-DARDUINO_RUNNING_CORE=0 + +nologo_esp32s3_pico.menu.EventsCore.1=Core 1 +nologo_esp32s3_pico.menu.EventsCore.1.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=1 +nologo_esp32s3_pico.menu.EventsCore.0=Core 0 +nologo_esp32s3_pico.menu.EventsCore.0.build.event_core=-DARDUINO_EVENT_RUNNING_CORE=0 + +nologo_esp32s3_pico.menu.USBMode.hwcdc=Hardware CDC and JTAG +nologo_esp32s3_pico.menu.USBMode.hwcdc.build.usb_mode=1 +nologo_esp32s3_pico.menu.USBMode.default=USB-OTG (TinyUSB) +nologo_esp32s3_pico.menu.USBMode.default.build.usb_mode=0 + +nologo_esp32s3_pico.menu.CDCOnBoot.default=Enabled +nologo_esp32s3_pico.menu.CDCOnBoot.default.build.cdc_on_boot=1 +nologo_esp32s3_pico.menu.CDCOnBoot.cdc=Enabled +nologo_esp32s3_pico.menu.CDCOnBoot.cdc.build.cdc_on_boot=1 + +nologo_esp32s3_pico.menu.MSCOnBoot.default=Disabled +nologo_esp32s3_pico.menu.MSCOnBoot.default.build.msc_on_boot=0 +nologo_esp32s3_pico.menu.MSCOnBoot.msc=Enabled (Requires USB-OTG Mode) +nologo_esp32s3_pico.menu.MSCOnBoot.msc.build.msc_on_boot=1 + +nologo_esp32s3_pico.menu.DFUOnBoot.default=Disabled +nologo_esp32s3_pico.menu.DFUOnBoot.default.build.dfu_on_boot=0 +nologo_esp32s3_pico.menu.DFUOnBoot.dfu=Enabled (Requires USB-OTG Mode) +nologo_esp32s3_pico.menu.DFUOnBoot.dfu.build.dfu_on_boot=1 + +nologo_esp32s3_pico.menu.UploadMode.default=UART0 / Hardware CDC +nologo_esp32s3_pico.menu.UploadMode.default.upload.use_1200bps_touch=false +nologo_esp32s3_pico.menu.UploadMode.default.upload.wait_for_upload_port=false +nologo_esp32s3_pico.menu.UploadMode.cdc=USB-OTG CDC (TinyUSB) +nologo_esp32s3_pico.menu.UploadMode.cdc.upload.use_1200bps_touch=true +nologo_esp32s3_pico.menu.UploadMode.cdc.upload.wait_for_upload_port=true + +nologo_esp32s3_pico.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.default.build.partitions=default +nologo_esp32s3_pico.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.defaultffat.build.partitions=default_ffat +nologo_esp32s3_pico.menu.PartitionScheme.default_8MB=8M with spiffs (3MB APP/1.5MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.default_8MB.build.partitions=default_8MB +nologo_esp32s3_pico.menu.PartitionScheme.default_8MB.upload.maximum_size=3342336 +nologo_esp32s3_pico.menu.PartitionScheme.minimal=Minimal (1.3MB APP/700KB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.minimal.build.partitions=minimal +nologo_esp32s3_pico.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.no_ota.build.partitions=no_ota +nologo_esp32s3_pico.menu.PartitionScheme.no_ota.upload.maximum_size=2097152 +nologo_esp32s3_pico.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.noota_3g.build.partitions=noota_3g +nologo_esp32s3_pico.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576 +nologo_esp32s3_pico.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat +nologo_esp32s3_pico.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152 +nologo_esp32s3_pico.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat +nologo_esp32s3_pico.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576 +nologo_esp32s3_pico.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.huge_app.build.partitions=huge_app +nologo_esp32s3_pico.menu.PartitionScheme.huge_app.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) +nologo_esp32s3_pico.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs +nologo_esp32s3_pico.menu.PartitionScheme.min_spiffs.upload.maximum_size=1966080 +nologo_esp32s3_pico.menu.PartitionScheme.fatflash=16M Flash (2MB APP/12.5MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.fatflash.build.partitions=ffat +nologo_esp32s3_pico.menu.PartitionScheme.fatflash.upload.maximum_size=2097152 +nologo_esp32s3_pico.menu.PartitionScheme.app3M_fat9M_16MB=16M Flash (3MB APP/9.9MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.app3M_fat9M_16MB.build.partitions=app3M_fat9M_16MB +nologo_esp32s3_pico.menu.PartitionScheme.app3M_fat9M_16MB.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.rainmaker=RainMaker +nologo_esp32s3_pico.menu.PartitionScheme.rainmaker.build.partitions=rainmaker +nologo_esp32s3_pico.menu.PartitionScheme.rainmaker.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.app5M_fat24M_32MB=32M Flash (4.8MB APP/22MB FATFS) +nologo_esp32s3_pico.menu.PartitionScheme.app5M_fat24M_32MB.build.partitions=large_fat_32MB +nologo_esp32s3_pico.menu.PartitionScheme.app5M_fat24M_32MB.upload.maximum_size=4718592 +nologo_esp32s3_pico.menu.PartitionScheme.app5M_little24M_32MB=32M Flash (4.8MB APP/22MB LittleFS) +nologo_esp32s3_pico.menu.PartitionScheme.app5M_little24M_32MB.build.partitions=large_littlefs_32MB +nologo_esp32s3_pico.menu.PartitionScheme.app5M_little24M_32MB.upload.maximum_size=4718592 +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16=ESP SR 16M (3MB APP/7MB SPIFFS/2.9MB MODEL) +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.upload.maximum_size=3145728 +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.upload.extra_flags=0xD10000 {build.path}/srmodels.bin +nologo_esp32s3_pico.menu.PartitionScheme.esp_sr_16.build.partitions=esp_sr_16 +nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr=Zigbee ZCZR 4MB with spiffs +nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr.build.partitions=zigbee_zczr +nologo_esp32s3_pico.menu.PartitionScheme.zigbee_zczr.upload.maximum_size=1310720 +nologo_esp32s3_pico.menu.PartitionScheme.custom=Custom +nologo_esp32s3_pico.menu.PartitionScheme.custom.build.partitions= +nologo_esp32s3_pico.menu.PartitionScheme.custom.upload.maximum_size=16777216 + +nologo_esp32s3_pico.menu.CPUFreq.240=240MHz (WiFi) +nologo_esp32s3_pico.menu.CPUFreq.240.build.f_cpu=240000000L +nologo_esp32s3_pico.menu.CPUFreq.160=160MHz (WiFi) +nologo_esp32s3_pico.menu.CPUFreq.160.build.f_cpu=160000000L +nologo_esp32s3_pico.menu.CPUFreq.80=80MHz (WiFi) +nologo_esp32s3_pico.menu.CPUFreq.80.build.f_cpu=80000000L +nologo_esp32s3_pico.menu.CPUFreq.40=40MHz +nologo_esp32s3_pico.menu.CPUFreq.40.build.f_cpu=40000000L +nologo_esp32s3_pico.menu.CPUFreq.20=20MHz +nologo_esp32s3_pico.menu.CPUFreq.20.build.f_cpu=20000000L +nologo_esp32s3_pico.menu.CPUFreq.10=10MHz +nologo_esp32s3_pico.menu.CPUFreq.10.build.f_cpu=10000000L + +nologo_esp32s3_pico.menu.UploadSpeed.921600=921600 +nologo_esp32s3_pico.menu.UploadSpeed.921600.upload.speed=921600 +nologo_esp32s3_pico.menu.UploadSpeed.115200=115200 +nologo_esp32s3_pico.menu.UploadSpeed.115200.upload.speed=115200 +nologo_esp32s3_pico.menu.UploadSpeed.256000.windows=256000 +nologo_esp32s3_pico.menu.UploadSpeed.256000.upload.speed=256000 +nologo_esp32s3_pico.menu.UploadSpeed.230400.windows.upload.speed=256000 +nologo_esp32s3_pico.menu.UploadSpeed.230400=230400 +nologo_esp32s3_pico.menu.UploadSpeed.230400.upload.speed=230400 +nologo_esp32s3_pico.menu.UploadSpeed.460800.linux=460800 +nologo_esp32s3_pico.menu.UploadSpeed.460800.macosx=460800 +nologo_esp32s3_pico.menu.UploadSpeed.460800.upload.speed=460800 +nologo_esp32s3_pico.menu.UploadSpeed.512000.windows=512000 +nologo_esp32s3_pico.menu.UploadSpeed.512000.upload.speed=512000 + +nologo_esp32s3_pico.menu.DebugLevel.none=None +nologo_esp32s3_pico.menu.DebugLevel.none.build.code_debug=0 +nologo_esp32s3_pico.menu.DebugLevel.error=Error +nologo_esp32s3_pico.menu.DebugLevel.error.build.code_debug=1 +nologo_esp32s3_pico.menu.DebugLevel.warn=Warn +nologo_esp32s3_pico.menu.DebugLevel.warn.build.code_debug=2 +nologo_esp32s3_pico.menu.DebugLevel.info=Info +nologo_esp32s3_pico.menu.DebugLevel.info.build.code_debug=3 +nologo_esp32s3_pico.menu.DebugLevel.debug=Debug +nologo_esp32s3_pico.menu.DebugLevel.debug.build.code_debug=4 +nologo_esp32s3_pico.menu.DebugLevel.verbose=Verbose +nologo_esp32s3_pico.menu.DebugLevel.verbose.build.code_debug=5 + +nologo_esp32s3_pico.menu.EraseFlash.none=Disabled +nologo_esp32s3_pico.menu.EraseFlash.none.upload.erase_cmd= +nologo_esp32s3_pico.menu.EraseFlash.all=Enabled +nologo_esp32s3_pico.menu.EraseFlash.all.upload.erase_cmd=-e + +nologo_esp32s3_pico.menu.ZigbeeMode.default=Disabled +nologo_esp32s3_pico.menu.ZigbeeMode.default.build.zigbee_mode= +nologo_esp32s3_pico.menu.ZigbeeMode.default.build.zigbee_libs= +nologo_esp32s3_pico.menu.ZigbeeMode.zczr=Zigbee ZCZR (coordinator) +nologo_esp32s3_pico.menu.ZigbeeMode.zczr.build.zigbee_mode=-DZIGBEE_MODE_ZCZR +nologo_esp32s3_pico.menu.ZigbeeMode.zczr.build.zigbee_libs=-lesp_zb_api_zczr -lesp_zb_cli_command -lzboss_stack.zczr.trace -lzboss_stack.zczr -lzboss_port + +############################################################## + mhetesp32devkit.name=MH ET LIVE ESP32DevKIT mhetesp32devkit.bootloader.tool=esptool_py diff --git a/variants/nologo_esp32s3_pico/pins_arduino.h b/variants/nologo_esp32s3_pico/pins_arduino.h new file mode 100644 index 00000000000..42109e0c12b --- /dev/null +++ b/variants/nologo_esp32s3_pico/pins_arduino.h @@ -0,0 +1,37 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +static const uint8_t LED_BUILTIN = 21; +#define BUILTIN_LED LED_BUILTIN +#define LED_BUILTIN LED_BUILTIN +#define RGB_BUILTIN SOC_GPIO_PIN_COUNT + LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +// SPI - unused but you can create your own definition in your sketch +static const int8_t SCK = -1; +static const int8_t MISO = -1; +static const int8_t MOSI = -1; +static const int8_t SS = -1; + +// I2C - unused but you can create your own definition in your sketch +static const uint8_t SDA = -1; +static const uint8_t SCL = -1; + +static const uint8_t A0 = 1; +static const uint8_t A1 = 2; +static const uint8_t A2 = 3; +static const uint8_t A3 = 4; +static const uint8_t A4 = 5; +static const uint8_t A5 = 6; +static const uint8_t A6 = 7; +static const uint8_t A7 = 8; +static const uint8_t A8 = 9; +static const uint8_t A9 = 10; + +#endif /* Pins_Arduino_h */