adc1_private.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2015-2016 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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #pragma once
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #include "esp_err.h"
  18. /**
  19. * @brief For I2S dma to claim the usage of ADC1.
  20. *
  21. * Other tasks will be forbidden to use ADC1 between ``adc1_dma_mode_acquire`` and ``adc1_i2s_release``.
  22. * The I2S module may have to wait for a short time for the current conversion (if exist) to finish.
  23. *
  24. * @return
  25. * - ESP_OK success
  26. * - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
  27. */
  28. esp_err_t adc1_dma_mode_acquire(void);
  29. /**
  30. * @brief For ADC1 to claim the usage of ADC1.
  31. *
  32. * Other tasks will be forbidden to use ADC1 between ``adc1_rtc_mode_acquire`` and ``adc1_i2s_release``.
  33. * The ADC1 may have to wait for some time for the I2S read operation to finish.
  34. *
  35. * @return
  36. * - ESP_OK success
  37. * - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
  38. */
  39. esp_err_t adc1_rtc_mode_acquire(void);
  40. /**
  41. * @brief to let other tasks use the ADC1 when I2S is not work.
  42. *
  43. * Other tasks will be forbidden to use ADC1 between ``adc1_adc/i2s_mode_acquire`` and ``adc1_i2s_release``.
  44. * Call this function to release the occupation of ADC1
  45. *
  46. * @return always return ESP_OK.
  47. */
  48. esp_err_t adc1_lock_release(void);
  49. #ifdef __cplusplus
  50. }
  51. #endif