spi_cxx.cpp 682 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #if __cpp_exceptions
  7. #include "driver/spi_common.h"
  8. #include "esp_exception.hpp"
  9. #include "spi_cxx.hpp"
  10. namespace idf {
  11. esp_err_t check_spi_num(uint32_t spi_num) noexcept {
  12. if (spi_num >= static_cast<uint32_t>(SPI_HOST_MAX)) {
  13. return ESP_ERR_INVALID_ARG;
  14. }
  15. return ESP_OK;
  16. }
  17. SPI_DMAConfig SPI_DMAConfig::DISABLED() {
  18. return SPI_DMAConfig(static_cast<uint32_t>(spi_common_dma_t::SPI_DMA_DISABLED));
  19. }
  20. SPI_DMAConfig SPI_DMAConfig::AUTO() {
  21. return SPI_DMAConfig(static_cast<uint32_t>(spi_common_dma_t::SPI_DMA_CH_AUTO));
  22. }
  23. }
  24. #endif