Lumitronix_Iflex_Pro_Workshop
Library to interact with the iFlexPro
Esp32_i2s.h
Go to the documentation of this file.
1 #pragma once
2 
3 // ESP32C3/S3 I2S is not supported yet due to significant changes to interface
4 #if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #include "esp_err.h"
11 
12 #define I2S_DMA_MAX_DATA_LEN 4092// maximum bytes in one dma item
13 
14 typedef enum {
15  I2S_CHAN_STEREO, I2S_CHAN_RIGHT_TO_LEFT, I2S_CHAN_LEFT_TO_RIGHT, I2S_CHAN_RIGHT_ONLY, I2S_CHAN_LEFT_ONLY
16 } i2s_tx_chan_mod_t;
17 
18 typedef enum {
19  I2S_FIFO_16BIT_DUAL, I2S_FIFO_16BIT_SINGLE, I2S_FIFO_32BIT_DUAL, I2S_FIFO_32BIT_SINGLE
20 } i2s_tx_fifo_mod_t;
21 
22 void i2sInit(uint8_t bus_num,
23  bool parallel_mode,
24  size_t bytes_per_sample,
25  uint32_t sample_rate,
26  i2s_tx_chan_mod_t chan_mod,
27  i2s_tx_fifo_mod_t fifo_mod,
28  size_t dma_count,
29  uint8_t* data,
30  size_t dataSize);
31 void i2sDeinit(uint8_t bus_num);
32 void i2sSetPins(uint8_t bus_num,
33  int8_t out,
34  int8_t parallel,
35  int8_t busSampleSize,
36  bool invert);
37 void i2sSetClkWsPins(uint8_t bus_num,
38  int8_t outClk,
39  bool invertClk,
40  int8_t outWs,
41  bool invertWs);
42 bool i2sWrite(uint8_t bus_num);
43 bool i2sWriteDone(uint8_t bus_num);
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif