mirror of https://github.com/arendst/Tasmota.git
Prep ESP32S2
This commit is contained in:
parent
cd38179f7f
commit
5caaf60c68
|
@ -38,7 +38,11 @@ TasmotaSerial *tms_obj_list[16];
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
|
||||||
static int tasmota_serial_index = 2; // Allow UART2 and UART1 only
|
static int tasmota_serial_index = 2; // Allow UART2 and UART1 only
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP32S2 // ESP32-S2
|
||||||
|
static int tasmota_serial_index = 1; // Allow UART1 only
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,13 @@ AudioOutputI2S::AudioOutputI2S(int port, int output_mode, int dma_buf_count, int
|
||||||
}
|
}
|
||||||
|
|
||||||
i2s_mode_t mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX);
|
i2s_mode_t mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX);
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
|
||||||
if (output_mode == INTERNAL_DAC) {
|
if (output_mode == INTERNAL_DAC) {
|
||||||
mode = (i2s_mode_t)(mode | I2S_MODE_DAC_BUILT_IN);
|
mode = (i2s_mode_t)(mode | I2S_MODE_DAC_BUILT_IN);
|
||||||
} else if (output_mode == INTERNAL_PDM) {
|
} else if (output_mode == INTERNAL_PDM) {
|
||||||
mode = (i2s_mode_t)(mode | I2S_MODE_PDM);
|
mode = (i2s_mode_t)(mode | I2S_MODE_PDM);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
i2s_comm_format_t comm_fmt = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB);
|
i2s_comm_format_t comm_fmt = (i2s_comm_format_t)(I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB);
|
||||||
if (output_mode == INTERNAL_DAC) {
|
if (output_mode == INTERNAL_DAC) {
|
||||||
|
@ -192,7 +194,11 @@ bool AudioOutputI2S::ConsumeSample(int16_t sample[2])
|
||||||
} else {
|
} else {
|
||||||
s32 = ((Amplify(ms[RIGHTCHANNEL]))<<16) | (Amplify(ms[LEFTCHANNEL]) & 0xffff);
|
s32 = ((Amplify(ms[RIGHTCHANNEL]))<<16) | (Amplify(ms[LEFTCHANNEL]) & 0xffff);
|
||||||
}
|
}
|
||||||
return i2s_write_bytes((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), 0);
|
// Deprecated. Use i2s_write
|
||||||
|
// return i2s_write_bytes((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), 0);
|
||||||
|
size_t bytes_written;
|
||||||
|
return (ESP_OK == i2s_write((i2s_port_t)portNo, (const char*)&s32, sizeof(uint32_t), &bytes_written, 0));
|
||||||
|
// return bytes_written;
|
||||||
#else
|
#else
|
||||||
uint32_t s32 = ((Amplify(ms[RIGHTCHANNEL]))<<16) | (Amplify(ms[LEFTCHANNEL]) & 0xffff);
|
uint32_t s32 = ((Amplify(ms[RIGHTCHANNEL]))<<16) | (Amplify(ms[LEFTCHANNEL]) & 0xffff);
|
||||||
return i2s_write_sample_nb(s32); // If we can't store it, return false. OTW true
|
return i2s_write_sample_nb(s32); // If we can't store it, return false. OTW true
|
||||||
|
|
|
@ -95,7 +95,11 @@ bool AudioOutputI2SNoDAC::ConsumeSample(int16_t sample[2])
|
||||||
|
|
||||||
// Either send complete pulse stream or nothing
|
// Either send complete pulse stream or nothing
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
if (!i2s_write_bytes((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), 0))
|
|
||||||
|
// Deprecated. Use i2s_write
|
||||||
|
// if (!i2s_write_bytes((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), 0))
|
||||||
|
size_t bytes_written;
|
||||||
|
if (ESP_OK != i2s_write((i2s_port_t)portNo, (const char *)dsBuff, sizeof(uint32_t) * (oversample/32), &bytes_written, 0))
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
if (!i2s_write_sample_nb(dsBuff[0])) return false; // No room at the inn
|
if (!i2s_write_sample_nb(dsBuff[0])) return false; // No room at the inn
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "lwip/apps/sntp.h"
|
//#include "lwip/apps/sntp.h"
|
||||||
#include <nvs.h>
|
#include <nvs.h>
|
||||||
|
|
||||||
// See libraries\ESP32\examples\ResetReason.ino
|
// See libraries\ESP32\examples\ResetReason.ino
|
||||||
|
|
Loading…
Reference in New Issue