You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @note TX PDM can only be set to the following two upsampling rate configurations:
64
+
* 1: fp = 960, fs = sample_rate / 100, in this case, Fpdm = 128*48000
65
+
* 2: fp = 960, fs = 480, in this case, Fpdm = 128*Fpcm = 128*sample_rate
66
+
* If the pdm receiver do not care the pdm serial clock, it's recommended set Fpdm = 128*48000.
67
+
* Otherwise, the second configuration should be applied.
68
+
*/
69
+
typedefstruct {
70
+
intsample_rate; /*!< I2S PDM sample rate */
71
+
intfp; /*!< I2S PDM TX upsampling paramater. Normally it should be set to 960 */
72
+
intfs; /*!< I2S PDM TX upsampling paramater. When it is set to 480, the pdm clock frequency Fpdm = 128 * sample_rate, when it is set to sample_rate / 100, Fpdm will be fixed to 128*48000 */
73
+
} i2s_pdm_tx_upsample_cfg_t;
74
+
#endif
75
+
76
+
/**
77
+
* @brief I2S pin number for i2s_set_pin
78
+
*
79
+
*/
80
+
typedefstruct {
81
+
intmck_io_num; /*!< MCK in out pin*/
82
+
intbck_io_num; /*!< BCK in out pin*/
83
+
intws_io_num; /*!< WS in out pin*/
84
+
intdata_out_num; /*!< DATA out pin*/
85
+
intdata_in_num; /*!< DATA in pin*/
86
+
} i2s_pin_config_t;
87
+
88
+
/**
89
+
* @brief I2S driver configuration parameters
90
+
*
91
+
*/
92
+
typedefstruct {
93
+
94
+
i2s_mode_tmode; /*!< I2S work mode */
95
+
uint32_tsample_rate; /*!< I2S sample rate */
96
+
i2s_bits_per_sample_tbits_per_sample; /*!< I2S sample bits in one channel */
i2s_comm_format_tcommunication_format; /*!< I2S communication format */
99
+
intintr_alloc_flags; /*!< Flags used to allocate the interrupt. One or multiple (ORred) ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info */
100
+
intdma_buf_count; /*!< I2S DMA Buffer Count */
101
+
intdma_buf_len; /*!< I2S DMA Buffer Length */
102
+
booluse_apll; /*!< I2S using APLL as main I2S clock, enable it to get accurate clock */
103
+
booltx_desc_auto_clear; /*!< I2S auto clear tx descriptor if there is underflow condition (helps in avoiding noise in case of data unavailability) */
104
+
intfixed_mclk; /*!< I2S using fixed MCLK output. If use_apll = true and fixed_mclk > 0, then the clock output for i2s is fixed and equal to the fixed_mclk value. If fixed_mclk set, mclk_multiple won't take effect */
105
+
i2s_mclk_multiple_tmclk_multiple; /*!< The multiple of I2S master clock(MCLK) to sample rate */
106
+
i2s_bits_per_chan_tbits_per_chan; /*!< I2S total bits in one channel, only take effect when larger than 'bits_per_sample', default '0' means equal to 'bits_per_sample' */
107
+
108
+
#ifSOC_I2S_SUPPORTS_TDM
109
+
i2s_channel_tchan_mask; /*!< I2S active channel bit mask, set value in `i2s_channel_t` to enable specific channel, the bit map of active channel can not exceed (0x1<<total_chan). */
110
+
uint32_ttotal_chan; /*!< I2S Total number of channels. If it is smaller than the biggest active channel number, it will be set to this number automatically. */
111
+
boolleft_align; /*!< Set to enable left alignment */
112
+
boolbig_edin; /*!< Set to enable big edin */
113
+
boolbit_order_msb; /*!< Set to enable msb order */
114
+
boolskip_msk; /*!< Set to enable skip mask. If it is enabled, only the data of the enabled channels will be sent, otherwise all data stored in DMA TX buffer will be sent */
115
+
#endif// SOC_I2S_SUPPORTS_TDM
116
+
117
+
} i2s_driver_config_t;
118
+
119
+
typedefi2s_driver_config_ti2s_config_t; // for backward compatible
120
+
typedefintr_handle_ti2s_isr_handle_t; // for backward compatible
121
+
122
+
/**
123
+
* @brief I2S event queue types
124
+
*
125
+
*/
126
+
typedefenum {
127
+
I2S_EVENT_DMA_ERROR,
128
+
I2S_EVENT_TX_DONE, /*!< I2S DMA finish sent 1 buffer*/
129
+
I2S_EVENT_RX_DONE, /*!< I2S DMA finish received 1 buffer*/
130
+
I2S_EVENT_TX_Q_OVF, /*!< I2S DMA sent queue overflow*/
0 commit comments