/*!
 * @file        bmp561_wwdt.h
 *
 * @brief       This file contains all the functions prototypes for the WWDT 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_WWDT_H
#define __BMP561_WWDT_H

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

#ifdef __cplusplus
  extern "C" {
#endif

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

/** @addtogroup WWDT_Driver WWDT Driver
  @{
*/

/** @addtogroup WWDT_Enumerations Enumerations
  @{
*/

/**
 * @brief    WWDT prescaler
 */

typedef enum
{
    WWDT_PS_0  = ((uint8_t)0x00),    /*!< WWDT counter clock = Fsys/2^0 */
    WWDT_PS_1  = ((uint8_t)0x01),    /*!< WWDT counter clock = Fsys/2^1 */
    WWDT_PS_2  = ((uint8_t)0x02),    /*!< WWDT counter clock = Fsys/2^2 */
    WWDT_PS_3  = ((uint8_t)0x03),    /*!< WWDT counter clock = Fsys/2^3 */
    WWDT_PS_4  = ((uint8_t)0x04),    /*!< WWDT counter clock = Fsys/2^4 */
    WWDT_PS_5  = ((uint8_t)0x05),    /*!< WWDT counter clock = Fsys/2^5 */
    WWDT_PS_6  = ((uint8_t)0x06),    /*!< WWDT counter clock = Fsys/2^6 */
    WWDT_PS_7  = ((uint8_t)0x07),    /*!< WWDT counter clock = Fsys/2^7 */
    WWDT_PS_8  = ((uint8_t)0x08),    /*!< WWDT counter clock = Fsys/2^8 */
    WWDT_PS_9  = ((uint8_t)0x09),    /*!< WWDT counter clock = Fsys/2^9 */
    WWDT_PS_10 = ((uint8_t)0x0A),    /*!< WWDT counter clock = Fsys/2^10 */
    WWDT_PS_11 = ((uint8_t)0x0B),    /*!< WWDT counter clock = Fsys/2^11 */
    WWDT_PS_12 = ((uint8_t)0x0C),    /*!< WWDT counter clock = Fsys/2^12 */
    WWDT_PS_13 = ((uint8_t)0x0D),    /*!< WWDT counter clock = Fsys/2^13 */
    WWDT_PS_14 = ((uint8_t)0x0E),    /*!< WWDT counter clock = Fsys/2^14 */
    WWDT_PS_15 = ((uint8_t)0x0F)     /*!< WWDT counter clock = Fsys/2^15 */
} WWDT_PS_T;

/**@} end of group WWDT_Enumerations */

/** @addtogroup WWDT_Macros Macros
  @{
*/

/* WWDT feed dog value */
#define WWDT_FEEDDOG    ((uint32_t)0x000000AA)

/**@} end of group WWDT_Macros */

/** @addtogroup  WWDT_Functions Functions
  @{
*/

/* WWDT configuration */
void WWDT_ConfigPrescaler(WWDT_PS_T prescaler);
void WWDT_SetWindowValue(uint16_t windowVal);
void WWDT_SetCounter(uint16_t counter);
uint16_t WWDT_GetCounter(void);

/* WWDT enable */
void WWDT_FeedDog(void);

/* WWDT interrupt */
void WWDT_EnableInterrupt(void);
void WWDT_DisableInterrupt(void);
uint8_t WWDT_ReadIntFlag(void);
void WWDT_ClearIntFlag(void);

/**@} end of group WWDT_Functions */
/**@} end of group WWDT_Driver */
/**@} end of group Peripherals_Library */

#ifdef __cplusplus
}
#endif

#endif /* __BMP561_WWDT_H */
