i2s_config_t i2s_config = {
.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX),
// ↑ ESP32 เป็น master (สร้าง clock), TX = ส่งข้อมูล
.sample_rate = 16000,
// ↑ ส่ง sample 16000 ตัวต่อวินาที
.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT,
// ↑ แต่ละ sample ใช้ 16 bits
.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,
// ↑ สลับส่ง Left แล้ว Right
.communication_format = I2S_COMM_FORMAT_STAND_I2S,
// ↑ ใช้ standard I2S protocol
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
// ↑ Interrupt priority level 1
.dma_buf_count = 8,
// ↑ ใช้ 8 DMA buffers
.dma_buf_len = 128,
// ↑ แต่ละ buffer เก็บได้ 128 samples
.use_apll = false,
// ↑ ไม่ใช้ APLL (Audio PLL) ใช้ clock ปกติ
.tx_desc_auto_clear = true
// ↑ ล้าง descriptor อัตโนมัติหลังส่งเสร็จ
};