2021-05-23 20:02:15 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2020-04-08 09:56:14 -04:00
|
|
|
|
|
|
|
#include "freertos/FreeRTOS.h"
|
2022-05-24 05:26:36 -04:00
|
|
|
#include "hal/dac_ll.h"
|
|
|
|
#include "esp_err.h"
|
2020-04-08 09:56:14 -04:00
|
|
|
|
|
|
|
extern portMUX_TYPE rtc_spinlock; //TODO: Will be placed in the appropriate position after the rtc module is finished.
|
|
|
|
#define DAC_ENTER_CRITICAL() portENTER_CRITICAL(&rtc_spinlock)
|
|
|
|
#define DAC_EXIT_CRITICAL() portEXIT_CRITICAL(&rtc_spinlock)
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------
|
|
|
|
Digital controller setting
|
|
|
|
---------------------------------------------------------------*/
|
|
|
|
|
|
|
|
esp_err_t dac_i2s_enable(void)
|
|
|
|
{
|
|
|
|
DAC_ENTER_CRITICAL();
|
2022-05-24 05:26:36 -04:00
|
|
|
dac_ll_digi_enable_dma(true);
|
2020-04-08 09:56:14 -04:00
|
|
|
DAC_EXIT_CRITICAL();
|
|
|
|
|
|
|
|
return ESP_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t dac_i2s_disable(void)
|
|
|
|
{
|
|
|
|
DAC_ENTER_CRITICAL();
|
2022-05-24 05:26:36 -04:00
|
|
|
dac_ll_digi_enable_dma(false);
|
2020-04-08 09:56:14 -04:00
|
|
|
DAC_EXIT_CRITICAL();
|
|
|
|
|
|
|
|
return ESP_OK;
|
2020-11-10 02:40:01 -05:00
|
|
|
}
|