DAC driver has been redesigned (see DAC API Reference), which aims to unify and extend the usage of DAC peripheral. Although it’s recommended to use the new driver APIs, the legacy driver is still available in the previous include path driver/dac.h. However, by default, including driver/dac.h will bring a build warning like The legacy DAC driver is deprecated, please use ‘driver/dac_oneshot.h’, ‘driver/dac_cosine.h’ or ‘driver/dac_continuous.h’ instead. The warning can be suppressed by the Kconfig option CONFIG_DAC_SUPPRESS_DEPRECATE_WARN.

The major breaking changes in concept and usage are listed as follows:

Breaking Changes in Concepts

  • dac_channel_t which used to identify the hardware channel are removed from user space, the channel index now starts from 0, please use DAC_CHAN_0 and DAC_CHAN_1 instead. And in the new driver, DAC channels can be seleted by dac_channel_mask_t. And these channels can be allocated in a same channel group which is represented by dac_channels_handle_t.

  • dac_cw_scale_t is replaced by dac_cosine_atten_t, to decupling the legacy driver and the new driver.

  • dac_cw_phase_t is replaced by dac_cosine_phase_t, the enum value is now the phase angle directly.

  • dac_cw_config_t is replaced by dac_cosine_config_t, but the en_ch field is removed because it should be specify while allocate the channel group.

Breaking Changes in Usage

  • dac_pad_get_io_num is removed.

  • dac_output_voltage is replaced by dac_oneshot_output_voltage().

  • dac_output_enable is removed, for oneshot mode, it will be enabled after the channel allocated.

  • dac_output_disable is removed, for oneshot mode, it will be disabled before the channel deleted.

  • dac_cw_generator_enable is replaced by dac_cosine_start().

  • dac_cw_generator_disable is replaced by dac_cosine_stop().

  • dac_cw_generator_config is replaced by dac_cosine_new_channel().