Skip to content

Commit f6a6de1

Browse files
committed
Merge branch 'espressif-master'
2 parents 11d8deb + 2a41811 commit f6a6de1

File tree

5 files changed

+26
-35
lines changed

5 files changed

+26
-35
lines changed

cores/esp32/esp32-hal-dac.c

+20-34
Original file line numberDiff line numberDiff line change
@@ -13,51 +13,37 @@
1313
// limitations under the License.
1414

1515
#include "esp32-hal.h"
16+
#include "soc/soc_caps.h"
1617

17-
#if CONFIG_IDF_TARGET_ESP32
18-
#include "soc/rtc_io_reg.h"
19-
#define DAC1 25
20-
#define DAC2 26
21-
#elif CONFIG_IDF_TARGET_ESP32S2
22-
#include "soc/rtc_io_reg.h"
23-
#define DAC1 17
24-
#define DAC2 18
25-
#elif CONFIG_IDF_TARGET_ESP32C3
18+
#ifndef SOC_DAC_SUPPORTED
2619
#define NODAC
2720
#else
28-
#error Target CONFIG_IDF_TARGET is not supported
29-
#endif
30-
31-
#ifndef NODAC
32-
#include "esp_attr.h"
33-
#include "soc/rtc_cntl_reg.h"
34-
#include "soc/rtc_io_periph.h"
35-
#include "soc/sens_reg.h"
36-
#include "soc/sens_struct.h"
37-
#include "driver/dac.h"
21+
#include "soc/dac_channel.h"
22+
#include "driver/dac_common.h"
3823

3924
void ARDUINO_ISR_ATTR __dacWrite(uint8_t pin, uint8_t value)
4025
{
41-
if(pin < DAC1 || pin > DAC2){
26+
if(pin < DAC_CHANNEL_1_GPIO_NUM || pin > DAC_CHANNEL_2_GPIO_NUM){
4227
return;//not dac pin
4328
}
44-
pinMode(pin, ANALOG);
45-
uint8_t channel = pin - DAC1;
46-
#if CONFIG_IDF_TARGET_ESP32
47-
CLEAR_PERI_REG_MASK(SENS_SAR_DAC_CTRL1_REG, SENS_SW_TONE_EN);
48-
#elif CONFIG_IDF_TARGET_ESP32S2
49-
SENS.sar_dac_ctrl1.dac_clkgate_en = 1;
50-
#endif
51-
RTCIO.pad_dac[channel].dac_xpd_force = 1;
52-
RTCIO.pad_dac[channel].xpd_dac = 1;
53-
if (channel == 0) {
54-
SENS.sar_dac_ctrl2.dac_cw_en1 = 0;
55-
} else if (channel == 1) {
56-
SENS.sar_dac_ctrl2.dac_cw_en2 = 0;
29+
30+
uint8_t channel = pin - DAC_CHANNEL_1_GPIO_NUM;
31+
dac_output_enable(channel);
32+
dac_output_voltage(channel, value);
33+
34+
}
35+
36+
void ARDUINO_ISR_ATTR __dacDisable(uint8_t pin)
37+
{
38+
if(pin < DAC_CHANNEL_1_GPIO_NUM || pin > DAC_CHANNEL_2_GPIO_NUM){
39+
return;//not dac pin
5740
}
58-
RTCIO.pad_dac[channel].dac = value;
41+
42+
uint8_t channel = pin - DAC_CHANNEL_1_GPIO_NUM;
43+
dac_output_disable(channel);
5944
}
6045

6146
extern void dacWrite(uint8_t pin, uint8_t value) __attribute__ ((weak, alias("__dacWrite")));
47+
extern void dacDisable(uint8_t pin) __attribute__ ((weak, alias("__dacDisable")));
6248

6349
#endif

cores/esp32/esp32-hal-dac.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ extern "C" {
2828
#include "driver/gpio.h"
2929

3030
void dacWrite(uint8_t pin, uint8_t value);
31+
void dacDisable(uint8_t pin);
3132

3233
#ifdef __cplusplus
3334
}

cores/esp32/esp32-hal-uart.c

+3
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ uart_t* uartBegin(uint8_t uart_nr, uint32_t baudrate, uint32_t config, int8_t rx
140140
ESP_ERROR_CHECK(uart_set_line_inverse(uart_nr, UART_SIGNAL_TXD_INV | UART_SIGNAL_RXD_INV));
141141
}
142142

143+
// Set RS485 half duplex mode on UART. This shall force flush to wait up to sending all bits out
144+
ESP_ERROR_CHECK(uart_set_mode(uart_nr, UART_MODE_RS485_HALF_DUPLEX));
145+
143146
UART_MUTEX_UNLOCK();
144147

145148
uartFlush(uart);

libraries/WiFi/src/WiFiSTA.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void wifi_sta_config(wifi_config_t * wifi_config, const char * ssid=NULL,
9292
wifi_config->sta.pmf_cfg.required = pmf_required;
9393
wifi_config->sta.bssid_set = 0;
9494
memset(wifi_config->sta.bssid, 0, 6);
95-
wifi_config->sta.threshold.authmode = WIFI_AUTH_OPEN;
95+
wifi_config->sta.threshold.authmode = WIFI_AUTH_WPA2_PSK;
9696
wifi_config->sta.ssid[0] = 0;
9797
wifi_config->sta.password[0] = 0;
9898
if(ssid != NULL && ssid[0] != 0){

variants/adafruit_qtpy_esp32s2/pins_arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static const uint8_t RX = 16;
5151
#define TX1 TX
5252
#define RX1 RX
5353

54+
5455
static const uint8_t T5 = 5;
5556
static const uint8_t T6 = 6;
5657
static const uint8_t T7 = 7;

0 commit comments

Comments
 (0)