/*!
 * @file        bmp561_vadc.h
 *
 * @brief       This file contains all the functions prototypes for the VADC firmware library
 *
 * @version     V1.0.0
 *
 * @date        2025-01-01
 *
 * @attention
 *
 *  Copyright (C) 2025 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */

/* Define to prevent recursive inclusion */
#ifndef __BMP561_VADC_H
#define __BMP561_VADC_H

/* Includes */
#include "bmp561.h"

#ifdef __cplusplus
  extern "C" {
#endif

/** @addtogroup Peripherals_Library Standard Peripheral Library
  @{
*/

/** @addtogroup VADC_Driver VADC Driver
  @{
*/

/** @addtogroup VADC_Enumerations Enumerations
  @{
*/

/**
 * @brief   VADC OSR
 */
typedef enum
{
    VADC_OSR_128  = 0x00,    /*!< 128 OSR */
    VADC_OSR_256  = 0x01,    /*!< 256 OSR */
    VADC_OSR_512  = 0x02,    /*!< 512 OSR */
    VADC_OSR_1024 = 0x03     /*!< 1024 OSR */
} VADC_OSR_T;

/**
 * @brief   VADC Vref
 */
typedef enum
{
    VADC_VOL_2P7V = 0x00,    /*!< 2.7V */
    VADC_VOL_1P8V = 0x01,    /*!< 1.8V */
} VADC_VOL_T;

/**@} end of group VADC_Enumerations */

/** @addtogroup VADC_Functions Functions
  @{
*/

/* VADC common configuration */
void VADC_Reset(void);
void VADC_Enable(void);
void VADC_Disable(void);
void VADC_EnableChopper(void);
void VADC_DisableChopper(void);
void VADC_EnableChopperDelay(void);
void VADC_DisableChopperDelay(void);
void VADC_ConfigOSR(VADC_OSR_T OSRVal);

/* VADC sample interrupt */
void VADC_EnableSampleInterrupt(void);
void VADC_DisableSampleInterrupt(void);
uint8_t VADC_ReadSampleFlag(void);
void VADC_ClearSampleFlag(void);
void VADC_ClearSampleInterruptFlag(void);
VADC_VOL_T VADC_ReadVoltage(void);

/* VADC data */
uint16_t VADC_GetData(void);
uint32_t VADC_GetRawData(void);

/**@} end of group VADC_Functions*/
/**@} end of group VADC_Driver*/
/**@} end of group Peripherals_Library*/

#ifdef __cplusplus
}
#endif

#endif /* __BMP561_VADC_H */
