mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(adc): added adc enable debug log config
This commit is contained in:
parent
f1e8cfb546
commit
c14d7fbb17
@ -76,4 +76,13 @@ menu "ADC and ADC Calibration"
|
||||
|
||||
If you stick to this, you can enable this option to force use ADC2 under above conditions.
|
||||
For more details, you can search for errata on espressif website.
|
||||
|
||||
config ADC_ENABLE_DEBUG_LOG
|
||||
bool "Enable ADC debug log"
|
||||
default n
|
||||
help
|
||||
Wether to enable the debug log message for ADC driver.
|
||||
Note that this option only controls the ADC driver log, will not affect other drivers.
|
||||
|
||||
note: This cannot be used in the ADC legacy driver.
|
||||
endmenu
|
||||
|
@ -9,6 +9,11 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "sdkconfig.h"
|
||||
#if CONFIG_ADC_ENABLE_DEBUG_LOG
|
||||
// The local log level must be defined before including esp_log.h
|
||||
// Set the maximum log level for this source file
|
||||
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
||||
#endif
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_pm.h"
|
||||
@ -102,6 +107,9 @@ static esp_err_t adc_digi_gpio_init(adc_unit_t adc_unit, uint16_t channel_mask)
|
||||
|
||||
esp_err_t adc_continuous_new_handle(const adc_continuous_handle_cfg_t *hdl_config, adc_continuous_handle_t *ret_handle)
|
||||
{
|
||||
#if CONFIG_ADC_ENABLE_DEBUG_LOG
|
||||
esp_log_level_set(ADC_TAG, ESP_LOG_DEBUG);
|
||||
#endif
|
||||
esp_err_t ret = ESP_OK;
|
||||
ESP_RETURN_ON_FALSE((hdl_config->conv_frame_size % SOC_ADC_DIGI_DATA_BYTES_PER_CONV == 0), ESP_ERR_INVALID_ARG, ADC_TAG, "conv_frame_size should be in multiples of `SOC_ADC_DIGI_DATA_BYTES_PER_CONV`");
|
||||
|
||||
|
@ -7,6 +7,11 @@
|
||||
#include <esp_types.h>
|
||||
#include <sys/lock.h>
|
||||
#include "sdkconfig.h"
|
||||
#if CONFIG_ADC_ENABLE_DEBUG_LOG
|
||||
// The local log level must be defined before including esp_log.h
|
||||
// Set the maximum log level for this source file
|
||||
#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
|
||||
#endif
|
||||
#include "stdatomic.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
@ -69,6 +74,9 @@ esp_err_t adc_oneshot_channel_to_io(adc_unit_t unit_id, adc_channel_t channel, i
|
||||
|
||||
esp_err_t adc_oneshot_new_unit(const adc_oneshot_unit_init_cfg_t *init_config, adc_oneshot_unit_handle_t *ret_unit)
|
||||
{
|
||||
#if CONFIG_ADC_ENABLE_DEBUG_LOG
|
||||
esp_log_level_set(TAG, ESP_LOG_DEBUG);
|
||||
#endif
|
||||
esp_err_t ret = ESP_OK;
|
||||
adc_oneshot_unit_ctx_t *unit = NULL;
|
||||
ESP_GOTO_ON_FALSE(init_config && ret_unit, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument: null pointer");
|
||||
|
Loading…
Reference in New Issue
Block a user