dac_hal.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*******************************************************************************
  15. * NOTICE
  16. * The hal is not public api, don't use in application code.
  17. * See readme.md in hal/include/hal/readme.md
  18. ******************************************************************************/
  19. #pragma once
  20. #include "hal/dac_ll.h"
  21. /**
  22. * Power on dac module and start output voltage.
  23. *
  24. * @note Before powering up, make sure the DAC PAD is set to RTC PAD and floating status.
  25. * @param channel DAC channel num.
  26. */
  27. #define dac_hal_power_on(channel) dac_ll_power_on(channel)
  28. /**
  29. * Power done dac module and stop output voltage.
  30. *
  31. * @param channel DAC channel num.
  32. */
  33. #define dac_hal_power_down(channel) dac_ll_power_down(channel)
  34. /**
  35. * Enable/disable the synchronization operation function of ADC1 and DAC.
  36. *
  37. * @note If enabled(default), ADC RTC controller sampling will cause the DAC channel output voltage.
  38. *
  39. * @param enable Enable or disable adc and dac synchronization function.
  40. */
  41. #define dac_hal_rtc_sync_by_adc(enable) dac_ll_rtc_sync_by_adc(enable)
  42. /**
  43. * Output voltage with value (8 bit).
  44. *
  45. * @param channel DAC channel num.
  46. * @param value Output value. Value range: 0 ~ 255.
  47. * The corresponding range of voltage is 0v ~ VDD3P3_RTC.
  48. */
  49. #define dac_hal_update_output_value(channel, value) dac_ll_update_output_value(channel, value)
  50. /**
  51. * Enable cosine wave generator output.
  52. */
  53. #define dac_hal_cw_generator_enable() dac_ll_cw_generator_enable()
  54. /**
  55. * Disable cosine wave generator output.
  56. */
  57. #define dac_hal_cw_generator_disable() dac_ll_cw_generator_disable()
  58. /**
  59. * Config the cosine wave generator function in DAC module.
  60. *
  61. * @param cw Configuration.
  62. */
  63. void dac_hal_cw_generator_config(dac_cw_config_t *cw);
  64. /**
  65. * Enable/disable DAC output data from DMA.
  66. */
  67. #define dac_hal_digi_enable_dma(enable) dac_ll_digi_enable_dma(enable)