i2s: add basic examples for STD/TDM/PDM mode
This commit is contained in:
@@ -73,13 +73,19 @@ typedef struct {
|
||||
i2s_pdm_sig_scale_t lp_scale; /*!< Low pass filter scaling value */
|
||||
i2s_pdm_sig_scale_t sinc_scale; /*!< Sinc filter scaling value */
|
||||
#if SOC_I2S_HW_VERSION_2
|
||||
bool sd_en; /*!< Sigma-delta filter enable */
|
||||
i2s_pdm_tx_line_mode_t line_mode; /*!< PDM TX line mode, on-line codec, one-line dac, two-line dac mode can be selected */
|
||||
bool hp_en; /*!< High pass filter enable */
|
||||
float hp_cut_off_freq_hz; /*!< High pass filter cut-off frequency, range 23.3Hz ~ 185Hz, see cut-off frequency sheet above */
|
||||
uint32_t sd_dither; /*!< Sigma-delta filter dither */
|
||||
uint32_t sd_dither2; /*!< Sigma-delta filter dither2 */
|
||||
#endif // SOC_I2S_HW_VERSION_2
|
||||
} pdm_tx; /*!< Specific configurations for PDM TX mode */
|
||||
#endif
|
||||
#if SOC_I2S_SUPPORTS_PDM_RX
|
||||
/* PDM TX configurations */
|
||||
struct {
|
||||
i2s_pdm_slot_mask_t slot_mask; /*!< Choose the slots to activate */
|
||||
} pdm_rx; /*!< Specific configurations for PDM TX mode */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -101,6 +101,20 @@ typedef enum {
|
||||
I2S_PDM_SIG_SCALING_MUL_2 = 2, /*!< I2S TX PDM signal scaling: x2 */
|
||||
I2S_PDM_SIG_SCALING_MUL_4 = 3, /*!< I2S TX PDM signal scaling: x4 */
|
||||
} i2s_pdm_sig_scale_t;
|
||||
|
||||
#if SOC_I2S_HW_VERSION_2
|
||||
/**
|
||||
* @brief PDM TX line mode
|
||||
* @note For the standard codec mode, PDM pins are connect to a codec which requires both clock signal and data signal
|
||||
* For the DAC output mode, PDM data signal can be connected to a power amplifier directly with a low-pass filter,
|
||||
* normally, DAC output mode doesn't need the clock signal.
|
||||
*/
|
||||
typedef enum {
|
||||
I2S_PDM_TX_ONE_LINE_CODEC, /*!< Standard PDM format output, left and right slot data on a single line */
|
||||
I2S_PDM_TX_ONE_LINE_DAC, /*!< PDM DAC format output, left or right slot data on a single line */
|
||||
I2S_PDM_TX_TWO_LINE_DAC, /*!< PDM DAC format output, left and right slot data on separated lines */
|
||||
} i2s_pdm_tx_line_mode_t;
|
||||
#endif // SOC_I2S_HW_VERSION_2
|
||||
#endif // SOC_I2S_SUPPORTS_PDM_TX
|
||||
|
||||
/**
|
||||
@@ -112,6 +126,16 @@ typedef enum {
|
||||
I2S_STD_SLOT_LEFT_RIGHT = BIT(0) | BIT(1), /*!< I2S transmits or receives both left and right slot */
|
||||
} i2s_std_slot_mask_t;
|
||||
|
||||
/**
|
||||
* @brief I2S slot select in PDM mode
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
I2S_PDM_SLOT_RIGHT = BIT(0), /*!< I2S PDM only transmits or receives the PDM device whose 'select' pin is pulled up */
|
||||
I2S_PDM_SLOT_LEFT = BIT(1), /*!< I2S PDM only transmits or receives the PDM device whose 'select' pin is pulled down */
|
||||
I2S_PDM_SLOT_BOTH = BIT(0) | BIT(1), /*!< I2S PDM transmits or receives both two slots */
|
||||
} i2s_pdm_slot_mask_t;
|
||||
|
||||
#if SOC_I2S_SUPPORTS_TDM
|
||||
/**
|
||||
* @brief tdm slot number
|
||||
|
||||
Reference in New Issue
Block a user