Browse Source

i2s: removed unsupported features on different targets

Michael (XIAO Xufeng) 4 years ago
parent
commit
67941fc495
2 changed files with 20 additions and 17 deletions
  1. 18 16
      components/driver/include/driver/i2s.h
  2. 2 1
      components/hal/include/hal/i2s_types.h

+ 18 - 16
components/driver/include/driver/i2s.h

@@ -25,6 +25,7 @@
 #include "hal/i2s_types.h"
 #include "driver/periph_ctrl.h"
 #include "esp_intr_alloc.h"
+
 #if SOC_I2S_SUPPORTS_ADC_DAC
 #include "driver/adc.h"
 #endif
@@ -82,21 +83,6 @@ esp_err_t i2s_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin);
 esp_err_t i2s_set_pdm_rx_down_sample(i2s_port_t i2s_num, i2s_pdm_dsr_t dsr);
 #endif
 
-/**
- * @brief Set I2S dac mode, I2S built-in DAC is disabled by default
- *
- * @param dac_mode DAC mode configurations - see i2s_dac_mode_t
- *
- * @note Built-in DAC functions are only supported on I2S0 for current ESP32 chip.
- *       If either of the built-in DAC channel are enabled, the other one can not
- *       be used as RTC DAC function at the same time.
- *
- * @return
- *     - ESP_OK               Success
- *     - ESP_ERR_INVALID_ARG  Parameter error
- */
-esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
-
 /**
  * @brief Install and start I2S driver.
  *
@@ -331,7 +317,23 @@ esp_err_t i2s_adc_enable(i2s_port_t i2s_num);
  *     - ESP_ERR_INVALID_STATE  Driver state error
  */
 esp_err_t i2s_adc_disable(i2s_port_t i2s_num);
-#endif
+
+/**
+ * @brief Set I2S dac mode, I2S built-in DAC is disabled by default
+ *
+ * @param dac_mode DAC mode configurations - see i2s_dac_mode_t
+ *
+ * @note Built-in DAC functions are only supported on I2S0 for current ESP32 chip.
+ *       If either of the built-in DAC channel are enabled, the other one can not
+ *       be used as RTC DAC function at the same time.
+ *
+ * @return
+ *     - ESP_OK               Success
+ *     - ESP_ERR_INVALID_ARG  Parameter error
+ */
+esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode);
+#endif //SOC_I2S_SUPPORTS_ADC_DAC
+
 
 #ifdef __cplusplus
 }

+ 2 - 1
components/hal/include/hal/i2s_types.h

@@ -115,7 +115,6 @@ typedef enum {
     I2S_CLK_APLL,                    /*!< Clock from APLL*/
 } i2s_clock_src_t;
 
-
 /**
  * @brief I2S configuration parameters for i2s_param_config function
  *
@@ -145,6 +144,7 @@ typedef enum {
     I2S_EVENT_MAX,         /*!< I2S event max index*/
 } i2s_event_type_t;
 
+#if SOC_I2S_SUPPORTS_ADC_DAC
 /**
  * @brief I2S DAC mode for i2s_set_dac_mode.
  *
@@ -157,6 +157,7 @@ typedef enum {
     I2S_DAC_CHANNEL_BOTH_EN  = 0x3,  /*!< Enable both of the I2S built-in DAC channels.*/
     I2S_DAC_CHANNEL_MAX      = 0x4,  /*!< I2S built-in DAC mode max index*/
 } i2s_dac_mode_t;
+#endif //SOC_I2S_SUPPORTS_ADC_DAC
 
 /**
  * @brief Event structure used in I2S event queue