Skip to content

Commit

Permalink
Merge branch 'master' into feature/ledc-channel-selection
Browse files Browse the repository at this point in the history
  • Loading branch information
P-R-O-C-H-Y authored Dec 22, 2023
2 parents 42765f5 + f6e12eb commit f57137d
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cores/esp32/USBCDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void tud_cdc_tx_complete_cb(uint8_t itf){

static void ARDUINO_ISR_ATTR cdc0_write_char(char c){
if(devices[0] != NULL){
devices[0]->write(c);
tud_cdc_n_write_char(0, c);
}
}

Expand Down
5 changes: 4 additions & 1 deletion cores/esp32/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,10 @@ int String::lastIndexOf(char ch, unsigned int fromIndex) const {
wbuffer()[fromIndex + 1] = tempchar;
if(temp == NULL)
return -1;
return temp - buffer();
const int rv = temp - buffer();
if(rv >= len())
return -1;
return rv;
}

int String::lastIndexOf(const String &s2) const {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
This Sketch demonstrates how to use the Hardware Serial peripheral to communicate over an RS485 bus.
Data received on the primary serial port is relayed to the bus acting as an RS485 interface and vice versa.
UART to RS485 translation hardware (e.g., MAX485, MAX33046E, ADM483) is assumed to be configured in half-duplex
mode with collision detection as described in
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#circuit-a-collision-detection-circuit
To use the script open the Arduino serial monitor (or alternative serial monitor on the Arduino port). Then,
using an RS485 tranciver, connect another serial monitor to the RS485 port. Entering data on one terminal
should be displayed on the other terminal.
*/
#include "hal/uart_types.h"

#define RS485_RX_PIN 16
#define RS485_TX_PIN 5
#define RS485_RTS_PIN 4

#define RS485 Serial1

void setup() {
Serial.begin(115200);
while(!Serial) { delay(10); }

RS485.begin(9600, SERIAL_8N1, RS485_RX_PIN, RS485_TX_PIN);
while(!RS485) { delay(10); }
if(!RS485.setPins(-1, -1, -1, RS485_RTS_PIN)){
Serial.print("Failed to set RS485 pins");
}

// Certain versions of Arduino core don't define MODE_RS485_HALF_DUPLEX and so fail to compile.
// By using UART_MODE_RS485_HALF_DUPLEX defined in hal/uart_types.h we work around this problem.
// If using a newer IDF and Arduino core you can ommit including hal/uart_types.h and use MODE_RS485_HALF_DUPLEX
// defined in esp32-hal-uart.h (included during other build steps) instead.
if(!RS485.setMode(UART_MODE_RS485_HALF_DUPLEX)) {
Serial.print("Failed to set RS485 mode");
}
}

void loop() {
if (RS485.available()) {
Serial.write(RS485.read());
}
if (Serial.available()) {
RS485.write(Serial.read());
}
}
1 change: 0 additions & 1 deletion libraries/WiFi/src/WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
wifi_sta_config(&conf);

if(WiFi.getMode() & WIFI_MODE_STA){
_useStaticIp = false;
if(eraseap){
if(esp_wifi_set_config((wifi_interface_t)ESP_IF_WIFI_STA, &conf)){
log_e("clear config failed!");
Expand Down
2 changes: 1 addition & 1 deletion libraries/WiFi/src/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class WiFiServer : public Server {
log_v("WiFiServer::WiFiServer(addr=%s, port=%d, ...)", addr.toString().c_str(), port);
}
~WiFiServer(){ end();}
WiFiClient available() __attribute__((deprecated("Renamed to accept().")));
WiFiClient available();
WiFiClient accept();
void begin(uint16_t port=0);
void begin(uint16_t port, int reuse_enable);
Expand Down
Binary file modified variants/adafruit_camera_esp32s3/bootloader-tinyuf2.bin
Binary file not shown.
15 changes: 6 additions & 9 deletions variants/adafruit_camera_esp32s3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ static const uint8_t LED_BUILTIN = PIN_NEOPIXEL+SOC_GPIO_PIN_COUNT;
#define RGB_BRIGHTNESS 64


//static const uint8_t TFT_BACKLIGHT = 41;
static const uint8_t TFT_BACKLIGHT = 45;
static const uint8_t TFT_DC = 40;
static const uint8_t TFT_CS = 39;
static const uint8_t TFT_RESET = 38;
static const uint8_t TFT_RST = 38;

static const uint8_t SD_CS = 48;
static const uint8_t SD_CHIP_SELECT = 48;
static const uint8_t SPEAKER = 41;
static const uint8_t SPEAKER = 46;

static const uint8_t SDA = 33;
static const uint8_t SCL = 34;
static const uint8_t SCL = 33;
static const uint8_t SDA = 34;

static const uint8_t SS = 48;
static const uint8_t MOSI = 35;
Expand All @@ -55,19 +55,16 @@ static const uint8_t DAC2 = 18;

#define AWEXP_SPKR_SD 0
#define AWEXP_BUTTON_SEL 1
#define AWEXP_BACKLIGHT 2
#define AWEXP_CAM_PWDN 7
#define AWEXP_SD_DET 8
#define AWEXP_SD_PWR 9
#define AWEXP_CAM_RST 10
#define AWEXP_BUTTON_OK 11
#define AWEXP_BUTTON_RIGHT 12
#define AWEXP_BUTTON_UP 13
#define AWEXP_BUTTON_LEFT 14
#define AWEXP_BUTTON_DOWN 15

#define PWDN_GPIO_NUM -1 // connected through expander
#define RESET_GPIO_NUM -1 // connected through expander
#define RESET_GPIO_NUM 47
#define PWDN_GPIO_NUM 21
#define XCLK_GPIO_NUM 8
#define SIOD_GPIO_NUM SDA
#define SIOC_GPIO_NUM SCL
Expand Down
Binary file modified variants/adafruit_camera_esp32s3/tinyuf2.bin
Binary file not shown.
11 changes: 10 additions & 1 deletion variants/adafruit_camera_esp32s3/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ extern "C" {
// Initialize variant/board, called before setup()
void initVariant(void)
{

pinMode(TFT_BACKLIGHT, OUTPUT);
digitalWrite(TFT_BACKLIGHT, LOW);
pinMode(SD_CS, OUTPUT);
digitalWrite(SD_CS, HIGH);
pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH);
pinMode(TFT_RESET, OUTPUT);
digitalWrite(TFT_RESET, LOW);
delay(1);
digitalWrite(TFT_RESET, HIGH);
}
}
Binary file modified variants/adafruit_metro_esp32s3/bootloader-tinyuf2.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion variants/adafruit_metro_esp32s3/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define BUILTIN_LED LED_BUILTIN // backward compatibility

// Neopixel
#define PIN_NEOPIXEL 45
#define PIN_NEOPIXEL 46
// RGB_BUILTIN and RGB_BRIGHTNESS can be used in new Arduino API neopixelWrite() and digitalWrite() for blinking
#define RGB_BUILTIN (PIN_NEOPIXEL+SOC_GPIO_PIN_COUNT)
#define RGB_BRIGHTNESS 64
Expand Down
Binary file modified variants/adafruit_metro_esp32s3/tinyuf2.bin
Binary file not shown.
3 changes: 2 additions & 1 deletion variants/adafruit_metro_esp32s3/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ extern "C" {

// Initialize variant/board, called before setup()
void initVariant(void) {
// default SD_CS to input pullup
// default SD_CS to input pullup (we cannot have built in pullup since its
// a strapping pin!)
pinMode(SS, INPUT_PULLUP);
}

Expand Down

0 comments on commit f57137d

Please sign in to comment.