Skip to content

Commit fd72e96

Browse files
committed
Merge branch 'master' into feature/uvc
2 parents 9e9ea35 + 15bbd0a commit fd72e96

35 files changed

+116
-92
lines changed

boards.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -9687,10 +9687,10 @@ deneyapmini.build.boot=qio
96879687
deneyapmini.build.partitions=default
96889688
deneyapmini.build.defines=
96899689

9690-
deneyapmini.menu.SerialMode.default=USB_CDC
9691-
deneyapmini.menu.SerialMode.default.build.serial=1
9692-
deneyapmini.menu.SerialMode.uart=UART0
9693-
deneyapmini.menu.SerialMode.uart.build.serial=0
9690+
deneyapmini.menu.CDCOnBoot.default=Disabled
9691+
deneyapmini.menu.CDCOnBoot.default.build.cdc_on_boot=0
9692+
deneyapmini.menu.CDCOnBoot.cdc=Enabled
9693+
deneyapmini.menu.CDCOnBoot.cdc.build.cdc_on_boot=1
96949694

96959695
deneyapmini.menu.PSRAM.disabled=Disabled
96969696
deneyapmini.menu.PSRAM.disabled.build.defines=

cores/esp32/esp32-hal-adc.c

+19-8
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,23 @@ static uint8_t __analogVRefPin = 0;
4646
#endif
4747

4848
static uint8_t __analogAttenuation = 3;//11db
49-
#if CONFIG_IDF_TARGET_ESP32S2
50-
static uint8_t __analogWidth = 4; // 13 bits
51-
#else
52-
static uint8_t __analogWidth = 3; // 12 bits
53-
#endif
49+
static uint8_t __analogWidth = ADC_WIDTH_MAX - 1; //3 for ESP32/ESP32C3; 4 for ESP32S2
50+
static uint8_t __analogReturnedWidth = SOC_ADC_MAX_BITWIDTH; //12 for ESP32/ESP32C3; 13 for ESP32S2
5451
static uint8_t __analogClockDiv = 1;
5552
static adc_attenuation_t __pin_attenuation[SOC_GPIO_PIN_COUNT];
5653

54+
static inline uint16_t mapResolution(uint16_t value)
55+
{
56+
uint8_t from = __analogWidth + 9;
57+
if (from == __analogReturnedWidth) {
58+
return value;
59+
}
60+
if (from > __analogReturnedWidth) {
61+
return value >> (from - __analogReturnedWidth);
62+
}
63+
return value << (__analogReturnedWidth - from);
64+
}
65+
5766
void __analogSetClockDiv(uint8_t clockDiv){
5867
if(!clockDiv){
5968
clockDiv = 1;
@@ -150,6 +159,7 @@ void __analogReadResolution(uint8_t bits)
150159
if(!bits || bits > 16){
151160
return;
152161
}
162+
__analogReturnedWidth = bits;
153163
#if CONFIG_IDF_TARGET_ESP32
154164
__analogSetWidth(bits); // hadware from 9 to 12
155165
#endif
@@ -169,7 +179,7 @@ uint16_t __analogRead(uint8_t pin)
169179
channel -= 10;
170180
r = adc2_get_raw( channel, __analogWidth, &value);
171181
if ( r == ESP_OK ) {
172-
return value;
182+
return mapResolution(value);
173183
} else if ( r == ESP_ERR_INVALID_STATE ) {
174184
log_e("GPIO%u: %s: ADC2 not initialized yet.", pin, esp_err_to_name(r));
175185
} else if ( r == ESP_ERR_TIMEOUT ) {
@@ -178,9 +188,10 @@ uint16_t __analogRead(uint8_t pin)
178188
log_e("GPIO%u: %s", pin, esp_err_to_name(r));
179189
}
180190
} else {
181-
return adc1_get_raw(channel);
191+
value = adc1_get_raw(channel);
192+
return mapResolution(value);
182193
}
183-
return value;
194+
return mapResolution(value);
184195
}
185196

186197
uint32_t __analogReadMilliVolts(uint8_t pin){

libraries/EEPROM/examples/eeprom_class/eeprom_class.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
#include "EEPROM.h"
1212

1313
// Instantiate eeprom objects with parameter/argument names and sizes
14-
EEPROMClass NAMES("eeprom0", 0x500);
15-
EEPROMClass HEIGHT("eeprom1", 0x200);
16-
EEPROMClass AGE("eeprom2", 0x100);
14+
EEPROMClass NAMES("eeprom0");
15+
EEPROMClass HEIGHT("eeprom1");
16+
EEPROMClass AGE("eeprom2");
1717

1818
void setup() {
1919
Serial.begin(115200);
2020
delay(1000);
2121
Serial.println("Testing EEPROMClass\n");
22-
if (!NAMES.begin(NAMES.length())) {
22+
if (!NAMES.begin(0x500)) {
2323
Serial.println("Failed to initialise NAMES");
2424
Serial.println("Restarting...");
2525
delay(1000);
2626
ESP.restart();
2727
}
28-
if (!HEIGHT.begin(HEIGHT.length())) {
28+
if (!HEIGHT.begin(0x200)) {
2929
Serial.println("Failed to initialise HEIGHT");
3030
Serial.println("Restarting...");
3131
delay(1000);
3232
ESP.restart();
3333
}
34-
if (!AGE.begin(AGE.length())) {
34+
if (!AGE.begin(0x100)) {
3535
Serial.println("Failed to initialise AGE");
3636
Serial.println("Restarting...");
3737
delay(1000);

libraries/EEPROM/src/EEPROM.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ EEPROMClass::EEPROMClass(void)
3434
, _size(0)
3535
, _dirty(false)
3636
, _name("eeprom")
37-
, _user_defined_size(0)
3837
{
3938
}
4039

@@ -45,17 +44,15 @@ EEPROMClass::EEPROMClass(uint32_t sector)
4544
, _size(0)
4645
, _dirty(false)
4746
, _name("eeprom")
48-
, _user_defined_size(0)
4947
{
5048
}
5149

52-
EEPROMClass::EEPROMClass(const char* name, uint32_t user_defined_size)
50+
EEPROMClass::EEPROMClass(const char* name)
5351
: _handle(0)
5452
, _data(0)
5553
, _size(0)
5654
, _dirty(false)
5755
, _name(name)
58-
, _user_defined_size(user_defined_size)
5956
{
6057
}
6158

@@ -133,7 +130,7 @@ bool EEPROMClass::begin(size_t size) {
133130

134131
_data = (uint8_t*) malloc(size);
135132
if(!_data) {
136-
log_e("Not enough memory for %d bytes in EEPROM");
133+
log_e("Not enough memory for %d bytes in EEPROM", size);
137134
return false;
138135
}
139136
_size = size;
@@ -215,7 +212,7 @@ uint8_t * EEPROMClass::getDataPtr() {
215212
*/
216213
uint16_t EEPROMClass::length ()
217214
{
218-
return _user_defined_size;
215+
return _size;
219216
}
220217

221218
/*

libraries/EEPROM/src/EEPROM.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ typedef uint32_t nvs_handle;
3535
class EEPROMClass {
3636
public:
3737
EEPROMClass(uint32_t sector);
38-
EEPROMClass(const char* name, uint32_t user_defined_size);
38+
EEPROMClass(const char* name);
3939
EEPROMClass(void);
4040
~EEPROMClass(void);
4141

@@ -112,7 +112,6 @@ class EEPROMClass {
112112
size_t _size;
113113
bool _dirty;
114114
const char* _name;
115-
uint32_t _user_defined_size;
116115
};
117116

118117
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_EEPROM)

libraries/WiFi/src/ETH.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
237237
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
238238
esp_netif_t *eth_netif = esp_netif_new(&cfg);
239239

240-
if(esp_eth_set_default_handlers(eth_netif) != ESP_OK){
241-
log_e("esp_eth_set_default_handlers failed");
242-
return false;
243-
}
244-
245-
246240
esp_eth_mac_t *eth_mac = NULL;
247241
#if CONFIG_ETH_SPI_ETHERNET_DM9051
248242
if(type == ETH_PHY_DM9051){

libraries/WiFiClientSecure/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,18 @@ To use PSK:
6666
encryption for the connection
6767

6868
Please see the WiFiClientPSK example.
69+
70+
Specifying the ALPN Protocol
71+
----------------------------
72+
73+
Application-Layer Protocol Negotiation (ALPN) is a Transport Layer Security (TLS) extension that allows
74+
the application layer to negotiate which protocol should be performed over a secure connection in a manner
75+
that avoids additional round trips and which is independent of the application-layer protocols.
76+
77+
For example, this is used with AWS IoT Custom Authorizers where an MQTT client must set the ALPN protocol to ```mqtt```:
78+
79+
```
80+
const char *aws_protos[] = {"mqtt", NULL};
81+
...
82+
wiFiClient.setAlpnProtocols(aws_protos);
83+
```

libraries/WiFiClientSecure/keywords.txt

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ connected KEYWORD2
2929
setCACert KEYWORD2
3030
setCertificate KEYWORD2
3131
setPrivateKey KEYWORD2
32+
setAlpnProtocols KEYWORD2
3233

3334
#######################################
3435
# Constants (LITERAL1)

libraries/WiFiClientSecure/src/WiFiClientSecure.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ WiFiClientSecure::WiFiClientSecure()
4343
_pskIdent = NULL;
4444
_psKey = NULL;
4545
next = NULL;
46+
_alpn_protos = NULL;
4647
}
4748

4849

@@ -66,6 +67,7 @@ WiFiClientSecure::WiFiClientSecure(int sock)
6667
_pskIdent = NULL;
6768
_psKey = NULL;
6869
next = NULL;
70+
_alpn_protos = NULL;
6971
}
7072

7173
WiFiClientSecure::~WiFiClientSecure()
@@ -127,7 +129,7 @@ int WiFiClientSecure::connect(const char *host, uint16_t port, const char *CA_ce
127129
if(_timeout > 0){
128130
sslclient->handshake_timeout = _timeout;
129131
}
130-
int ret = start_ssl_client(sslclient, host, port, _timeout, CA_cert, cert, private_key, NULL, NULL, _use_insecure);
132+
int ret = start_ssl_client(sslclient, host, port, _timeout, CA_cert, cert, private_key, NULL, NULL, _use_insecure, _alpn_protos);
131133
_lastError = ret;
132134
if (ret < 0) {
133135
log_e("start_ssl_client: %d", ret);
@@ -147,7 +149,7 @@ int WiFiClientSecure::connect(const char *host, uint16_t port, const char *pskId
147149
if(_timeout > 0){
148150
sslclient->handshake_timeout = _timeout;
149151
}
150-
int ret = start_ssl_client(sslclient, host, port, _timeout, NULL, NULL, NULL, pskIdent, psKey, _use_insecure);
152+
int ret = start_ssl_client(sslclient, host, port, _timeout, NULL, NULL, NULL, pskIdent, psKey, _use_insecure, _alpn_protos);
151153
_lastError = ret;
152154
if (ret < 0) {
153155
log_e("start_ssl_client: %d", ret);
@@ -341,3 +343,8 @@ void WiFiClientSecure::setHandshakeTimeout(unsigned long handshake_timeout)
341343
{
342344
sslclient->handshake_timeout = handshake_timeout * 1000;
343345
}
346+
347+
void WiFiClientSecure::setAlpnProtocols(const char **alpn_protos)
348+
{
349+
_alpn_protos = alpn_protos;
350+
}

libraries/WiFiClientSecure/src/WiFiClientSecure.h

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class WiFiClientSecure : public WiFiClient
3939
const char *_private_key;
4040
const char *_pskIdent; // identity for PSK cipher suites
4141
const char *_psKey; // key in hex for PSK cipher suites
42+
const char **_alpn_protos;
4243

4344
public:
4445
WiFiClientSecure *next;
@@ -73,6 +74,7 @@ class WiFiClientSecure : public WiFiClient
7374
bool loadPrivateKey(Stream& stream, size_t size);
7475
bool verify(const char* fingerprint, const char* domain_name);
7576
void setHandshakeTimeout(unsigned long handshake_timeout);
77+
void setAlpnProtocols(const char **alpn_protos);
7678
const mbedtls_x509_crt* getPeerCertificate() { return mbedtls_ssl_get_peer_cert(&sslclient->ssl_ctx); };
7779
bool getFingerprintSHA256(uint8_t sha256_result[32]) { return get_peer_fingerprint(sslclient, sha256_result); };
7880
int setTimeout(uint32_t seconds){ return 0; }

libraries/WiFiClientSecure/src/ssl_client.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void ssl_init(sslclient_context *ssl_client)
5151
}
5252

5353

54-
int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure)
54+
int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos)
5555
{
5656
char buf[512];
5757
int ret, flags;
@@ -156,6 +156,13 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
156156
return handle_error(ret);
157157
}
158158

159+
if (alpn_protos != NULL) {
160+
log_v("Setting ALPN protocols");
161+
if ((ret = mbedtls_ssl_conf_alpn_protocols(&ssl_client->ssl_conf, alpn_protos) ) != 0) {
162+
return handle_error(ret);
163+
}
164+
}
165+
159166
// MBEDTLS_SSL_VERIFY_REQUIRED if a CA certificate is defined on Arduino IDE and
160167
// MBEDTLS_SSL_VERIFY_NONE if not.
161168

libraries/WiFiClientSecure/src/ssl_client.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ typedef struct sslclient_context {
2929

3030

3131
void ssl_init(sslclient_context *ssl_client);
32-
int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure);
32+
int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure, const char **alpn_protos);
3333
void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, const char *cli_cert, const char *cli_key);
3434
int data_to_read(sslclient_context *ssl_client);
3535
int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len);

platform.txt

+3-3
Large diffs are not rendered by default.

tools/platformio-build-esp32.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
"UNITY_INCLUDE_CONFIG_H",
302302
"WITH_POSIX",
303303
"_GNU_SOURCE",
304-
("IDF_VER", '\\"v4.4-dev-3540-g4e03a9c34c\\"'),
304+
("IDF_VER", '\\"v4.4-dev-3544-g2720d45e71\\"'),
305305
"ESP_PLATFORM",
306306
"ARDUINO_ARCH_ESP32",
307307
"ESP32",

tools/platformio-build-esp32c3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
"UNITY_INCLUDE_CONFIG_H",
293293
"WITH_POSIX",
294294
"_GNU_SOURCE",
295-
("IDF_VER", '\\"v4.4-dev-3540-g4e03a9c34c\\"'),
295+
("IDF_VER", '\\"v4.4-dev-3544-g2720d45e71\\"'),
296296
"ESP_PLATFORM",
297297
"ARDUINO_ARCH_ESP32",
298298
"ESP32",

tools/platformio-build-esp32s2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
"UNITY_INCLUDE_CONFIG_H",
288288
"WITH_POSIX",
289289
"_GNU_SOURCE",
290-
("IDF_VER", '\\"v4.4-dev-3540-g4e03a9c34c\\"'),
290+
("IDF_VER", '\\"v4.4-dev-3544-g2720d45e71\\"'),
291291
"ESP_PLATFORM",
292292
"ARDUINO_ARCH_ESP32",
293293
"ESP32",

tools/sdk/esp32/include/config/sdkconfig.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371
#define CONFIG_LWIP_GARP_TMR_INTERVAL 60
372372
#define CONFIG_LWIP_TCPIP_RECVMBOX_SIZE 32
373373
#define CONFIG_LWIP_DHCP_RESTORE_LAST_IP 1
374-
#define CONFIG_LWIP_DHCP_OPTIONS_LEN 68
374+
#define CONFIG_LWIP_DHCP_OPTIONS_LEN 128
375375
#define CONFIG_LWIP_DHCPS 1
376376
#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60
377377
#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8
@@ -673,5 +673,5 @@
673673
#define CONFIG_ULP_COPROC_RESERVE_MEM CONFIG_ESP32_ULP_COPROC_RESERVE_MEM
674674
#define CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS
675675
#define CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP
676-
#define CONFIG_ARDUINO_IDF_COMMIT "4e03a9c34c"
677-
#define CONFIG_ARDUINO_IDF_BRANCH "master"
676+
#define CONFIG_ARDUINO_IDF_COMMIT "2720d45e71"
677+
#define CONFIG_ARDUINO_IDF_BRANCH "release/v4.4"

tools/sdk/esp32/lib/libapp_update.a

0 Bytes
Binary file not shown.

tools/sdk/esp32/lib/libesp_system.a

0 Bytes
Binary file not shown.

tools/sdk/esp32/lib/liblwip.a

-140 Bytes
Binary file not shown.

tools/sdk/esp32/sdkconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
10291029
# CONFIG_LWIP_DHCP_DOES_ARP_CHECK is not set
10301030
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
10311031
CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y
1032-
CONFIG_LWIP_DHCP_OPTIONS_LEN=68
1032+
CONFIG_LWIP_DHCP_OPTIONS_LEN=128
10331033

10341034
#
10351035
# DHCP server

tools/sdk/esp32c3/include/config/sdkconfig.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
#define CONFIG_LWIP_GARP_TMR_INTERVAL 60
341341
#define CONFIG_LWIP_TCPIP_RECVMBOX_SIZE 32
342342
#define CONFIG_LWIP_DHCP_DOES_ARP_CHECK 1
343-
#define CONFIG_LWIP_DHCP_OPTIONS_LEN 68
343+
#define CONFIG_LWIP_DHCP_OPTIONS_LEN 128
344344
#define CONFIG_LWIP_DHCPS 1
345345
#define CONFIG_LWIP_DHCPS_LEASE_UNIT 60
346346
#define CONFIG_LWIP_DHCPS_MAX_STATION_NUM 8
@@ -627,5 +627,5 @@
627627
#define CONFIG_TIMER_TASK_STACK_SIZE CONFIG_ESP_TIMER_TASK_STACK_SIZE
628628
#define CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX
629629
#define CONFIG_UDP_RECVMBOX_SIZE CONFIG_LWIP_UDP_RECVMBOX_SIZE
630-
#define CONFIG_ARDUINO_IDF_COMMIT "4e03a9c34c"
631-
#define CONFIG_ARDUINO_IDF_BRANCH "master"
630+
#define CONFIG_ARDUINO_IDF_COMMIT "2720d45e71"
631+
#define CONFIG_ARDUINO_IDF_BRANCH "release/v4.4"

tools/sdk/esp32c3/lib/libapp_update.a

0 Bytes
Binary file not shown.

tools/sdk/esp32c3/lib/libesp_system.a

0 Bytes
Binary file not shown.

tools/sdk/esp32c3/lib/liblwip.a

280 Bytes
Binary file not shown.

tools/sdk/esp32c3/sdkconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
10471047
CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
10481048
# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set
10491049
# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
1050-
CONFIG_LWIP_DHCP_OPTIONS_LEN=68
1050+
CONFIG_LWIP_DHCP_OPTIONS_LEN=128
10511051

10521052
#
10531053
# DHCP server

tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/usbtmc/usbtmc_device.h

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/*
2-
* usbtmc_device.h
3-
*
4-
* Created on: Sep 10, 2019
5-
* Author: nconrad
6-
*/
71
/*
82
* The MIT License (MIT)
93
*

0 commit comments

Comments
 (0)