// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*******************************************************************************
 * NOTICE
 * The hal is not public api, don't use in application code.
 * See readme.md in hal/include/hal/readme.md
 ******************************************************************************/

// The HAL layer for ADC (esp32 specific part)

#pragma once

#include "hal/adc_ll.h"
#include "hal/adc_types.h"

#include_next "hal/adc_hal.h"

#ifdef __cplusplus
extern "C" {
#endif

/*---------------------------------------------------------------
                    Digital controller setting
---------------------------------------------------------------*/

/**
 * Set I2S DMA data source for digital controller.
 *
 * @param src i2s data source.
 */
#define adc_hal_digi_set_data_source(src) adc_ll_digi_set_data_source(src)

/*---------------------------------------------------------------
                    Common setting
---------------------------------------------------------------*/

/*---------------------------------------------------------------
                    Hall sensor setting
---------------------------------------------------------------*/

/**
 * Enable hall sensor.
 */
#define adc_hal_hall_enable() adc_ll_hall_enable()

/**
 * Disable hall sensor.
 */
#define adc_hal_hall_disable() adc_ll_hall_disable()

/**
 *  Start hall convert and return the hall value.
 *
 *  @return Hall value.
 */
int adc_hal_hall_convert(void);

#ifdef __cplusplus
}
#endif
