Skip to content

Commit f57137d

Browse files
authored
Merge branch 'master' into feature/ledc-channel-selection
2 parents 42765f5 + f6e12eb commit f57137d

File tree

13 files changed

+73
-16
lines changed

13 files changed

+73
-16
lines changed

Diff for: cores/esp32/USBCDC.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void tud_cdc_tx_complete_cb(uint8_t itf){
7979

8080
static void ARDUINO_ISR_ATTR cdc0_write_char(char c){
8181
if(devices[0] != NULL){
82-
devices[0]->write(c);
82+
tud_cdc_n_write_char(0, c);
8383
}
8484
}
8585

Diff for: cores/esp32/WString.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,10 @@ int String::lastIndexOf(char ch, unsigned int fromIndex) const {
677677
wbuffer()[fromIndex + 1] = tempchar;
678678
if(temp == NULL)
679679
return -1;
680-
return temp - buffer();
680+
const int rv = temp - buffer();
681+
if(rv >= len())
682+
return -1;
683+
return rv;
681684
}
682685

683686
int String::lastIndexOf(const String &s2) const {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
This Sketch demonstrates how to use the Hardware Serial peripheral to communicate over an RS485 bus.
3+
4+
Data received on the primary serial port is relayed to the bus acting as an RS485 interface and vice versa.
5+
6+
UART to RS485 translation hardware (e.g., MAX485, MAX33046E, ADM483) is assumed to be configured in half-duplex
7+
mode with collision detection as described in
8+
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#circuit-a-collision-detection-circuit
9+
10+
To use the script open the Arduino serial monitor (or alternative serial monitor on the Arduino port). Then,
11+
using an RS485 tranciver, connect another serial monitor to the RS485 port. Entering data on one terminal
12+
should be displayed on the other terminal.
13+
*/
14+
#include "hal/uart_types.h"
15+
16+
#define RS485_RX_PIN 16
17+
#define RS485_TX_PIN 5
18+
#define RS485_RTS_PIN 4
19+
20+
#define RS485 Serial1
21+
22+
void setup() {
23+
Serial.begin(115200);
24+
while(!Serial) { delay(10); }
25+
26+
RS485.begin(9600, SERIAL_8N1, RS485_RX_PIN, RS485_TX_PIN);
27+
while(!RS485) { delay(10); }
28+
if(!RS485.setPins(-1, -1, -1, RS485_RTS_PIN)){
29+
Serial.print("Failed to set RS485 pins");
30+
}
31+
32+
// Certain versions of Arduino core don't define MODE_RS485_HALF_DUPLEX and so fail to compile.
33+
// By using UART_MODE_RS485_HALF_DUPLEX defined in hal/uart_types.h we work around this problem.
34+
// If using a newer IDF and Arduino core you can ommit including hal/uart_types.h and use MODE_RS485_HALF_DUPLEX
35+
// defined in esp32-hal-uart.h (included during other build steps) instead.
36+
if(!RS485.setMode(UART_MODE_RS485_HALF_DUPLEX)) {
37+
Serial.print("Failed to set RS485 mode");
38+
}
39+
}
40+
41+
void loop() {
42+
if (RS485.available()) {
43+
Serial.write(RS485.read());
44+
}
45+
if (Serial.available()) {
46+
RS485.write(Serial.read());
47+
}
48+
}

Diff for: libraries/WiFi/src/WiFiSTA.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
373373
wifi_sta_config(&conf);
374374

375375
if(WiFi.getMode() & WIFI_MODE_STA){
376-
_useStaticIp = false;
377376
if(eraseap){
378377
if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf)){
379378
log_e("clear config failed!");

Diff for: libraries/WiFi/src/WiFiServer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class WiFiServer : public Server {
4545
log_v("WiFiServer::WiFiServer(addr=%s, port=%d, ...)", addr.toString().c_str(), port);
4646
}
4747
~WiFiServer(){ end();}
48-
WiFiClient available() __attribute__((deprecated("Renamed to accept().")));
48+
WiFiClient available();
4949
WiFiClient accept();
5050
void begin(uint16_t port=0);
5151
void begin(uint16_t port, int reuse_enable);
0 Bytes
Binary file not shown.

Diff for: variants/adafruit_camera_esp32s3/pins_arduino.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ static const uint8_t LED_BUILTIN = PIN_NEOPIXEL+SOC_GPIO_PIN_COUNT;
2424
#define RGB_BRIGHTNESS 64
2525

2626

27-
//static const uint8_t TFT_BACKLIGHT = 41;
27+
static const uint8_t TFT_BACKLIGHT = 45;
2828
static const uint8_t TFT_DC = 40;
2929
static const uint8_t TFT_CS = 39;
3030
static const uint8_t TFT_RESET = 38;
3131
static const uint8_t TFT_RST = 38;
3232

3333
static const uint8_t SD_CS = 48;
3434
static const uint8_t SD_CHIP_SELECT = 48;
35-
static const uint8_t SPEAKER = 41;
35+
static const uint8_t SPEAKER = 46;
3636

37-
static const uint8_t SDA = 33;
38-
static const uint8_t SCL = 34;
37+
static const uint8_t SCL = 33;
38+
static const uint8_t SDA = 34;
3939

4040
static const uint8_t SS = 48;
4141
static const uint8_t MOSI = 35;
@@ -55,19 +55,16 @@ static const uint8_t DAC2 = 18;
5555

5656
#define AWEXP_SPKR_SD 0
5757
#define AWEXP_BUTTON_SEL 1
58-
#define AWEXP_BACKLIGHT 2
59-
#define AWEXP_CAM_PWDN 7
6058
#define AWEXP_SD_DET 8
6159
#define AWEXP_SD_PWR 9
62-
#define AWEXP_CAM_RST 10
6360
#define AWEXP_BUTTON_OK 11
6461
#define AWEXP_BUTTON_RIGHT 12
6562
#define AWEXP_BUTTON_UP 13
6663
#define AWEXP_BUTTON_LEFT 14
6764
#define AWEXP_BUTTON_DOWN 15
6865

69-
#define PWDN_GPIO_NUM -1 // connected through expander
70-
#define RESET_GPIO_NUM -1 // connected through expander
66+
#define RESET_GPIO_NUM 47
67+
#define PWDN_GPIO_NUM 21
7168
#define XCLK_GPIO_NUM 8
7269
#define SIOD_GPIO_NUM SDA
7370
#define SIOC_GPIO_NUM SCL

Diff for: variants/adafruit_camera_esp32s3/tinyuf2.bin

-8.67 KB
Binary file not shown.

Diff for: variants/adafruit_camera_esp32s3/variant.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ extern "C" {
3131
// Initialize variant/board, called before setup()
3232
void initVariant(void)
3333
{
34-
34+
pinMode(TFT_BACKLIGHT, OUTPUT);
35+
digitalWrite(TFT_BACKLIGHT, LOW);
36+
pinMode(SD_CS, OUTPUT);
37+
digitalWrite(SD_CS, HIGH);
38+
pinMode(TFT_CS, OUTPUT);
39+
digitalWrite(TFT_CS, HIGH);
40+
pinMode(TFT_RESET, OUTPUT);
41+
digitalWrite(TFT_RESET, LOW);
42+
delay(1);
43+
digitalWrite(TFT_RESET, HIGH);
3544
}
3645
}
0 Bytes
Binary file not shown.

Diff for: variants/adafruit_metro_esp32s3/pins_arduino.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define BUILTIN_LED LED_BUILTIN // backward compatibility
1515

1616
// Neopixel
17-
#define PIN_NEOPIXEL 45
17+
#define PIN_NEOPIXEL 46
1818
// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite() and digitalWrite() for blinking
1919
#define RGB_BUILTIN (PIN_NEOPIXEL+SOC_GPIO_PIN_COUNT)
2020
#define RGB_BRIGHTNESS 64

Diff for: variants/adafruit_metro_esp32s3/tinyuf2.bin

0 Bytes
Binary file not shown.

Diff for: variants/adafruit_metro_esp32s3/variant.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ extern "C" {
3030

3131
// Initialize variant/board, called before setup()
3232
void initVariant(void) {
33-
// default SD_CS to input pullup
33+
// default SD_CS to input pullup (we cannot have built in pullup since its
34+
// a strapping pin!)
3435
pinMode(SS, INPUT_PULLUP);
3536
}
3637

0 commit comments

Comments
 (0)