Skip to content

Commit ab05844

Browse files
authored
Merge branch 'master' into NanoC6
2 parents 4b72aad + 4e3523c commit ab05844

File tree

17 files changed

+872
-9
lines changed

17 files changed

+872
-9
lines changed

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ repos:
3434
hooks:
3535
- id: clang-format
3636
types_or: [c, c++]
37+
exclude: ^.*\/build_opt\.h$
3738
- repo: https://github.com/psf/black-pre-commit-mirror
3839
rev: "22.10.0"
3940
hooks:

boards.txt

+363
Large diffs are not rendered by default.

cores/esp32/esp32-hal-gpio.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
#include "hal/gpio_hal.h"
1818
#include "soc/soc_caps.h"
1919

20+
// RGB_BUILTIN is defined in pins_arduino.h
21+
// If RGB_BUILTIN is defined, it will be used as a pin number for the RGB LED
22+
// If RGB_BUILTIN has a side effect that prevents using RMT Legacy driver in IDF 5.1
23+
// Define ESP32_ARDUINO_NO_RGB_BUILTIN in build_opt.h or through CLI to disable RGB_BUILTIN
24+
#ifdef ESP32_ARDUINO_NO_RGB_BUILTIN
25+
#ifdef RGB_BUILTIN
26+
#undef RGB_BUILTIN
27+
#endif
28+
#endif
29+
2030
// It fixes lack of pin definition for S3 and for any future SoC
2131
// this function works for ESP32, ESP32-S2 and ESP32-S3 - including the C3, it will return -1 for any pin
2232
#if SOC_TOUCH_SENSOR_NUM > 0
@@ -159,7 +169,7 @@ extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
159169
neopixelWrite(RGB_BUILTIN, comm_val, comm_val, comm_val);
160170
return;
161171
}
162-
#endif
172+
#endif // RGB_BUILTIN
163173
if (perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) != NULL) {
164174
gpio_set_level((gpio_num_t)pin, val);
165175
} else {

cores/esp32/esp32-hal-uart.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,16 @@ uart_t *uartBegin(
513513
retCode &= ESP_OK == uart_param_config(uart_nr, &uart_config);
514514
}
515515

516-
// Is it right or the idea is to swap rx and tx pins?
517-
if (retCode && inverted) {
518-
// invert signal for both Rx and Tx
519-
retCode &= ESP_OK == uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV);
516+
if (retCode) {
517+
if (inverted) {
518+
// invert signal for both Rx and Tx
519+
retCode &= ESP_OK == uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV);
520+
} else {
521+
// disable invert signal for both Rx and Tx
522+
retCode &= ESP_OK == uart_set_line_inverse(uart_nr, UART_SIGNAL_INV_DISABLE);
523+
}
520524
}
521-
525+
// if all fine, set internal parameters
522526
if (retCode) {
523527
uart->_baudrate = baudrate;
524528
uart->_config = config;

docs/en/api/i2s.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,9 @@ Sample code
546546
I2S.read();
547547
available_bytes = I2S.available();
548548
if(available_bytes < buff_size) {
549-
read_bytes = I2S.read(buffer, available_bytes);
549+
read_bytes = I2S.readBytes(buffer, available_bytes);
550550
} else {
551-
read_bytes = I2S.read(buffer, buff_size);
551+
read_bytes = I2S.readBytes(buffer, buff_size);
552552
}
553553
I2S.write(buffer, read_bytes);
554554
I2S.end();

docs/en/lib_builder.rst

+20
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,26 @@ Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash
181181
182182
./build.sh -t esp32 -b idf_libs qio 80m
183183
184+
User Interface
185+
--------------
186+
187+
There is also a terminal user interface that can be used to configure the libraries to be compiled.
188+
It allows the user to select the targets to compile, change the configuration options and compile the libraries.
189+
It has mouse support and can be pre-configured using command line arguments.
190+
For more information and troubleshooting, check `the documentation <https://github.com/espressif/esp32-arduino-lib-builder/blob/master/tools/config_editor/README.md>`_.
191+
192+
To use the terminal user interface, make sure to have ``python>=3.9``, all the previous dependencies and install the ``textual`` library:
193+
194+
.. code-block:: bash
195+
196+
pip install --user textual
197+
198+
You can then run the UI using the following command:
199+
200+
.. code-block:: bash
201+
202+
./tools/config_editor/app.py
203+
184204
Docker Image
185205
------------
186206

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* This example demonstrates how to use the file build_opt.h to disable the new RMT Driver
3+
* Note that this file shall be added the Arduino project
4+
*
5+
* If the content of this file changes, it is necessary to delete the compiled Arduino IDE cache
6+
* It can be done by changing, for instance, the "Core Debug Level" option, forcing the system to rebuild the Arduino Core
7+
*
8+
*/
9+
10+
#ifndef ESP32_ARDUINO_NO_RGB_BUILTIN
11+
12+
// add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NO_RGB_BUILTIN" to use the RMT Legacy driver
13+
#error "ESP32_ARDUINO_NO_RGB_BUILTIN is not defined, this example is intended to demonstrate the RMT Legacy driver.
14+
#error "Please add the file 'build_opt.h' with '-DESP32_ARDUINO_NO_RGB_BUILTIN' to your Arduino project folder."
15+
#error "Another way to disable the RGB_BUILTIN is to define it in the platformio.ini file, for instance: '-D ESP32_ARDUINO_NO_RGB_BUILTIN'"
16+
17+
#else
18+
19+
// add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NO_RGB_BUILTIN" to use the RMT Legacy driver
20+
// neoPixelWrite() is a function that writes to the RGB LED and it won't be available here
21+
#include "driver/rmt.h"
22+
23+
bool installed = false;
24+
25+
void setup() {
26+
Serial.begin(115200);
27+
Serial.println("This sketch is using the RMT Legacy driver.");
28+
installed = rmt_driver_install(RMT_CHANNEL_0, 0, 0) == ESP_OK;
29+
}
30+
31+
void loop() {
32+
String msg = "RMT Legacy driver is installed: ";
33+
msg += (char *)(installed ? "Yes." : "No.");
34+
Serial.println(msg);
35+
delay(5000);
36+
}
37+
38+
#endif // ESP32_ARDUINO_NO_RGB_BUILTIN
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-DESP32_ARDUINO_NO_RGB_BUILTIN

libraries/Network/src/NetworkInterface.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,15 @@ bool NetworkInterface::hasGlobalIPv6() const {
320320
bool NetworkInterface::enableIPv6(bool en) {
321321
if (en) {
322322
setStatusBits(ESP_NETIF_WANT_IP6_BIT);
323+
if (_esp_netif != NULL && connected()) {
324+
// If we are already connected, try to enable IPv6 immediately
325+
esp_err_t err = esp_netif_create_ip6_linklocal(_esp_netif);
326+
if (err != ESP_OK) {
327+
log_e("Failed to enable IPv6 Link Local on %s: [%d] %s", desc(), err, esp_err_to_name(err));
328+
} else {
329+
log_v("Enabled IPv6 Link Local on %s", desc());
330+
}
331+
}
323332
} else {
324333
clearStatusBits(ESP_NETIF_WANT_IP6_BIT);
325334
}

libraries/WiFiProv/examples/WiFiProv/WiFiProv.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void SysProvEvent(arduino_event_t *sys_event) {
5353

5454
void setup() {
5555
Serial.begin(115200);
56+
WiFi.begin(); // no SSID/PWD - get it from the Provisioning APP or from NVS (last successful connection)
5657
WiFi.onEvent(SysProvEvent);
5758

5859
// BLE Provisioning using the ESP SoftAP Prov works fine for any BLE SoC, including ESP32, ESP32S3 and ESP32C3.
@@ -61,7 +62,7 @@ void setup() {
6162
// Sample uuid that user can pass during provisioning using BLE
6263
uint8_t uuid[16] = {0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf, 0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02};
6364
WiFiProv.beginProvision(
64-
WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, pop, service_name, service_key, uuid, reset_provisioned
65+
WIFI_PROV_SCHEME_BLE, WIFI_PROV_SCHEME_HANDLER_FREE_BLE, WIFI_PROV_SECURITY_1, pop, service_name, service_key, uuid, reset_provisioned
6566
);
6667
log_d("ble qr");
6768
WiFiProv.printQR(service_name, pop, "ble");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
#include "soc/soc_caps.h"
6+
7+
#define PIN_NEOPIXEL 9
8+
// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino
9+
static const uint8_t LED_BUILTIN = 15;
10+
#define BUILTIN_LED LED_BUILTIN // backward compatibility
11+
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
12+
// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite()
13+
#define RGB_BUILTIN (SOC_GPIO_PIN_COUNT + PIN_NEOPIXEL)
14+
#define RGB_BRIGHTNESS 64
15+
16+
#define NEOPIXEL_I2C_POWER 20 // I2C power pin
17+
#define PIN_NEOPIXEL_I2C_POWER 20 // I2C power pin
18+
19+
static const uint8_t TX = 16;
20+
static const uint8_t RX = 17;
21+
22+
static const uint8_t SDA = 19;
23+
static const uint8_t SCL = 18;
24+
25+
static const uint8_t SS = 0;
26+
static const uint8_t MOSI = 22;
27+
static const uint8_t MISO = 23;
28+
static const uint8_t SCK = 21;
29+
30+
static const uint8_t A0 = 1;
31+
static const uint8_t A1 = 4;
32+
static const uint8_t A2 = 6;
33+
static const uint8_t A3 = 5;
34+
static const uint8_t A4 = 3;
35+
static const uint8_t A5 = 2;
36+
static const uint8_t A6 = 0;
37+
38+
#endif /* Pins_Arduino_h */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021 Ha Thach (tinyusb.org) for Adafruit Industries
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
25+
#include "esp32-hal-gpio.h"
26+
#include "pins_arduino.h"
27+
28+
extern "C" {
29+
30+
// Initialize variant/board, called before setup()
31+
void initVariant(void) {
32+
// This board has a power control pin, and we must set it to output and high
33+
// in order to enable the NeoPixels & I2C
34+
pinMode(NEOPIXEL_I2C_POWER, OUTPUT);
35+
digitalWrite(NEOPIXEL_I2C_POWER, HIGH);
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
#define USB_VID 0x303a
7+
#define USB_PID 0x820A
8+
9+
static const uint8_t LED_BUILTIN = 37;
10+
#define BUILTIN_LED LED_BUILTIN // backward compatibility
11+
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
12+
13+
static const uint8_t BUTTON_1 = 0;
14+
static const uint8_t BAT_VOLT = 1;
15+
16+
static const uint8_t TX = 43;
17+
static const uint8_t RX = 44;
18+
19+
static const uint8_t SDA = 18;
20+
static const uint8_t SCL = 17;
21+
22+
#define WIRE1_PIN_DEFINED //QWIIC
23+
static const uint8_t SDA1 = 10;
24+
static const uint8_t SCL1 = 21;
25+
26+
// SD Card SPI
27+
static const uint8_t SS = 13;
28+
static const uint8_t MOSI = 11;
29+
static const uint8_t MISO = 2;
30+
static const uint8_t SCK = 14;
31+
32+
#define LORA_SCK 5 // LR1121 SCK
33+
#define LORA_MISO 3 // LR1121 MISO
34+
#define LORA_MOSI 6 // LR1121 MOSI
35+
#define LORA_CS 7 // LR1121 CS
36+
#define LORA_RST 8 // LR1121 RST
37+
38+
#define LORA_DIO9 36 // LR1121 DIO9
39+
#define LORA_BUSY 34 // LR1121 BUSY
40+
#define LORA_IRQ LORA_DIO9
41+
42+
// P1
43+
static const uint8_t PIN_42 = 45;
44+
static const uint8_t PIN_46 = 46;
45+
static const uint8_t PIN_45 = 45;
46+
static const uint8_t PIN_41 = 41;
47+
static const uint8_t PIN_40 = 40;
48+
static const uint8_t PIN_39 = 39;
49+
static const uint8_t PIN_43 = 43;
50+
static const uint8_t PIN_44 = 44;
51+
static const uint8_t PIN_38 = 38;
52+
53+
// P2
54+
static const uint8_t PIN_37 = 37;
55+
static const uint8_t PIN_36 = 36;
56+
static const uint8_t PIN_0 = 0;
57+
static const uint8_t PIN_35 = 35;
58+
static const uint8_t PIN_34 = 34;
59+
static const uint8_t PIN_33 = 33;
60+
static const uint8_t PIN_47 = 47;
61+
static const uint8_t PIN_48 = 48;
62+
static const uint8_t PIN_12 = 12;
63+
static const uint8_t PIN_8 = 8;
64+
static const uint8_t PIN_15 = 15;
65+
static const uint8_t PIN_16 = 16;
66+
67+
#endif /* Pins_Arduino_h */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
#define USB_VID 0x303a
7+
#define USB_PID 0x820A
8+
9+
static const uint8_t LED_BUILTIN = 37;
10+
#define BUILTIN_LED LED_BUILTIN // backward compatibility
11+
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
12+
13+
static const uint8_t BUTTON_1 = 0;
14+
static const uint8_t BAT_VOLT = 1;
15+
16+
static const uint8_t TX = 43;
17+
static const uint8_t RX = 44;
18+
19+
static const uint8_t SDA = 18;
20+
static const uint8_t SCL = 17;
21+
22+
#define WIRE1_PIN_DEFINED //QWIIC
23+
static const uint8_t SDA1 = 10;
24+
static const uint8_t SCL1 = 21;
25+
26+
// SD Card SPI
27+
static const uint8_t SS = 13;
28+
static const uint8_t MOSI = 11;
29+
static const uint8_t MISO = 2;
30+
static const uint8_t SCK = 14;
31+
32+
#define LORA_SCK 5 // SX1262 SCK
33+
#define LORA_MISO 3 // SX1262 MISO
34+
#define LORA_MOSI 6 // SX1262 MOSI
35+
#define LORA_CS 7 // SX1262 CS
36+
#define LORA_RST 8 // SX1262 RST
37+
38+
#define LORA_DIO1 33 //SX1262 DIO1
39+
#define LORA_BUSY 34
40+
#define LORA_IRQ LORA_DIO1
41+
42+
// P1
43+
static const uint8_t PIN_42 = 45;
44+
static const uint8_t PIN_46 = 46;
45+
static const uint8_t PIN_45 = 45;
46+
static const uint8_t PIN_41 = 41;
47+
static const uint8_t PIN_40 = 40;
48+
static const uint8_t PIN_39 = 39;
49+
static const uint8_t PIN_43 = 43;
50+
static const uint8_t PIN_44 = 44;
51+
static const uint8_t PIN_38 = 38;
52+
53+
// P2
54+
static const uint8_t PIN_37 = 37;
55+
static const uint8_t PIN_36 = 36;
56+
static const uint8_t PIN_0 = 0;
57+
static const uint8_t PIN_35 = 35;
58+
static const uint8_t PIN_34 = 34;
59+
static const uint8_t PIN_33 = 33;
60+
static const uint8_t PIN_47 = 47;
61+
static const uint8_t PIN_48 = 48;
62+
static const uint8_t PIN_12 = 12;
63+
static const uint8_t PIN_8 = 8;
64+
static const uint8_t PIN_15 = 15;
65+
static const uint8_t PIN_16 = 16;
66+
67+
#endif /* Pins_Arduino_h */

0 commit comments

Comments
 (0)