dac_hal.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 soc/include/hal/readme.md
  18. ******************************************************************************/
  19. #pragma once
  20. #include "hal/dac_ll.h"
  21. #include "hal/hal_defs.h"
  22. #include <esp_err.h>
  23. /**
  24. * Power on dac module and start output voltage.
  25. *
  26. * @note Before powering up, make sure the DAC PAD is set to RTC PAD and floating status.
  27. * @param channel DAC channel num.
  28. */
  29. #define dac_hal_power_on(channel) dac_ll_power_on(channel)
  30. /**
  31. * Power done dac module and stop output voltage.
  32. *
  33. * @param channel DAC channel num.
  34. */
  35. #define dac_hal_power_down(channel) dac_ll_power_down(channel)
  36. /**
  37. * Enable/disable the synchronization operation function of ADC1 and DAC.
  38. *
  39. * @note If enabled(default), ADC RTC controller sampling will cause the DAC channel output voltage.
  40. *
  41. * @param enable Enable or disable adc and dac synchronization function.
  42. */
  43. #define dac_hal_rtc_sync_by_adc(enable) dac_ll_rtc_sync_by_adc(enable)
  44. /**
  45. * Output voltage with value (8 bit).
  46. *
  47. * @param channel DAC channel num.
  48. * @param value Output value. Value range: 0 ~ 255.
  49. * The corresponding range of voltage is 0v ~ VDD3P3_RTC.
  50. */
  51. #define dac_hal_update_output_value(channel, value) dac_ll_update_output_value(channel, value)
  52. /**
  53. * Enable cosine wave generator output.
  54. */
  55. #define dac_hal_cw_generator_enable() dac_ll_cw_generator_enable()
  56. /**
  57. * Disable cosine wave generator output.
  58. */
  59. #define dac_hal_cw_generator_disable() dac_ll_cw_generator_disable()
  60. /**
  61. * Config the cosine wave generator function in DAC module.
  62. *
  63. * @param cw Configuration.
  64. */
  65. void dac_hal_cw_generator_config(dac_cw_config_t *cw);
  66. /**
  67. * Enable/disable DAC output data from DMA.
  68. */
  69. #define dac_hal_digi_enable_dma(enable) dac_ll_digi_enable_dma(enable)