/*!
 * @file        bmp561_cadc.h
 *
 * @brief       This file contains all the functions prototypes for the CADC 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_CADC_H
#define __BMP561_CADC_H

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

#ifdef __cplusplus
  extern "C" {
#endif

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

/** @addtogroup CADC_Driver CADC Driver
  @{
*/

/** @addtogroup CADC_Enumerations Enumerations
  @{
*/

/**
 * @brief   CADC OSR
 */
typedef enum
{
    CADC_OSR_128  = 0x00,    /*!< 128 OSR  */
    CADC_OSR_256  = 0x01,    /*!< 256 OSR  */
    CADC_OSR_512  = 0x02,    /*!< 512 OSR  */
    CADC_OSR_1024 = 0x03     /*!< 1024 OSR */
} CADC_OSR_T;

/**@} end of group CADC_Enumerations */

/** @addtogroup CADC_Functions Functions
  @{
*/

/* CADC common configuration */
void CADC_Reset(void);
void CADC_Enable(void);
void CADC_Disable(void);
void CADC_EnableChopper(void);
void CADC_DisableChopper(void);
void CADC_EnableChopperDelay(void);
void CADC_DisableChopperDelay(void);
void CADC_ConfigOSR(CADC_OSR_T OSRVal);
void CADC_EnableBoostMode(void);
void CADC_DisableBoostMode(void);

/* CADC sample interrupt */
void CADC_EnableSampleInterrupt(void);
void CADC_DisableSampleInterrupt(void);
uint8_t CADC_ReadSampleFlag(void);
void CADC_ClearSampleFlag(void);
void CADC_ClearSampleInterruptFlag(void);

/* CADC data */
uint16_t CADC_GetData(void);
uint32_t CADC_GetRawData(void);

/**@} end of group CADC_Functions*/
/**@} end of group CADC_Driver*/
/**@} end of group Peripherals_Library*/

#ifdef __cplusplus
}
#endif

#endif /* __BMP561_CADC_H */
