Driver update: I2S pdm and built-in DAC

1. Modify I2S DAC built-in mode settings
2. Add I2S pdm mode
3. Correct I2S signal index in full-duplex mode
4. Modify dac output function
5. Add dac pad init functions
6. Modify DAC documentation
7. Add i2s_set_dac_mode API
This commit is contained in:
Wangjialin
2017-05-03 18:55:52 +08:00
parent 15a6145961
commit 1f055d28b8
6 changed files with 306 additions and 82 deletions

View File

@@ -28,13 +28,31 @@ typedef enum {
DAC_CHANNEL_MAX,
} dac_channel_t;
/**
* @brief Set DAC output voltage.
*
* @note Function has been deprecated, please use dac_output_voltage instead.
* This name will be removed in a future release.
* The difference is that before calling dac_output_voltage, we need to initialize the dac pad by dac_output_enable
*
*
* @param channel DAC channel
* @param dac_value DAC output value
*
* @return
* - ESP_OK success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t dac_out_voltage(dac_channel_t channel, uint8_t dac_value) __attribute__ ((deprecated));
/**
* @brief Set DAC output voltage.
*
* DAC output is 8-bit. Maximum (255) corresponds to VDD.
*
* @note When this function is called, function for the DAC
* channel's GPIO pin is reconfigured for RTC DAC function.
* @note Need to configure DAC pad before calling this function.
* DAC channel 1 is attached to GPIO25, DAC channel 2 is attached to GPIO26
*
* @param channel DAC channel
* @param dac_value DAC output value
@@ -43,8 +61,35 @@ typedef enum {
* - ESP_OK success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t dac_out_voltage(dac_channel_t channel, uint8_t dac_value);
esp_err_t dac_output_voltage(dac_channel_t channel, uint8_t dac_value);
/**
* @brief DAC pad output enable
*
* @param channel DAC channel
* @note DAC channel 1 is attached to GPIO25, DAC channel 2 is attached to GPIO26
* I2S left channel will be mapped to DAC channel 2
* I2S right channel will be mapped to DAC channel 1
*/
esp_err_t dac_output_enable(dac_channel_t channel);
/**
* @brief DAC pad output disable
*
* @param channel DAC channel
* @note DAC channel 1 is attached to GPIO25, DAC channel 2 is attached to GPIO26
*/
esp_err_t dac_output_disable(dac_channel_t channel);
/**
* @brief Enable DAC output data from I2S
*/
esp_err_t dac_i2s_enable();
/**
* @brief Disable DAC output data from I2S
*/
esp_err_t dac_i2s_disable();
#ifdef __cplusplus
}
#endif