new cspot/bell

This commit is contained in:
philippe44
2023-05-06 23:50:26 +02:00
parent e0e7e718ba
commit 8bad480112
163 changed files with 6611 additions and 6739 deletions

View File

@@ -2,45 +2,42 @@
#include "driver/i2s.h"
AC101AudioSink::AC101AudioSink()
{
// Disable software volume control, all handled by ::volumeChanged
softwareVolumeControl = false;
AC101AudioSink::AC101AudioSink() {
// Disable software volume control, all handled by ::volumeChanged
softwareVolumeControl = false;
i2s_config_t i2s_config = {
i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX), // Only TX
.sample_rate = 44100,
.bits_per_sample = (i2s_bits_per_sample_t)16,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, //2-channels
.communication_format = (i2s_comm_format_t)I2S_COMM_FORMAT_I2S,
.intr_alloc_flags = 0, //Default interrupt priority
.dma_buf_count = 8,
.dma_buf_len = 512,
.use_apll = true,
.tx_desc_auto_clear = true //Auto clear tx descriptor on underflow
};
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX), // Only TX
.sample_rate = 44100,
.bits_per_sample = (i2s_bits_per_sample_t)16,
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, //2-channels
.communication_format = (i2s_comm_format_t)I2S_COMM_FORMAT_I2S,
.intr_alloc_flags = 0, //Default interrupt priority
.dma_buf_count = 8,
.dma_buf_len = 512,
.use_apll = true,
.tx_desc_auto_clear = true //Auto clear tx descriptor on underflow
};
i2s_pin_config_t pin_config = {
.bck_io_num = 27,
.ws_io_num = 26,
.data_out_num = 25,
.data_in_num = -1 //Not used
};
i2s_pin_config_t pin_config = {
.bck_io_num = 27,
.ws_io_num = 26,
.data_out_num = 25,
.data_in_num = -1 //Not used
};
dac = &dac_a1s;
dac = &dac_a1s;
dac->init(0, 0, &i2s_config);
dac->speaker(false);
dac->power(ADAC_ON);
dac->init(0, 0, &i2s_config);
dac->speaker(false);
dac->power(ADAC_ON);
startI2sFeed();
startI2sFeed();
}
AC101AudioSink::~AC101AudioSink()
{
}
AC101AudioSink::~AC101AudioSink() {}
void AC101AudioSink::volumeChanged(uint16_t volume) {
dac->volume(volume, volume);
dac->volume(volume, volume);
}