/**
 * *************************************************************************************************************
 * @file Oscillators.h
 * @author BH_CodeGenerator
 * @version 0.1
 * @date 2022-04-01
 * @warning <!--auto generated by Tools, do not modify or add anything, otherwise, your change will be lost!!! -->
 * @brief all the functions prototypes for Oscillators firmware library
 * MCU / CFG Ver. :BH66F2475/1.7
 * Version = 1.0.0
 * # 主要功能
 *  * 系统频率使用fH
 *  * 若有LXT功能，Cpu关闭时默认开启，方便作为RTC计时
 *  * 对于有HXT、LXT的MCU，若使能了HXT、LXT，但硬件异常可能造成MCU WDT溢出
 * *************************************************************************************************************
 *  @attention
 *
 *  Firmware Disclaimer Information
 *
 *  1. The customer hereby acknowledges and agrees that the program technical documentation, including the
 *     code, which is supplied by BEST HEALTH ELECTRONIC Inc., (hereinafter referred to as BestHealth) is the
 *     proprietary and confidential intellectual property of BestHealth, and is protected by copyright law and
 *     other intellectual property laws.
 *
 *  2. The customer hereby acknowledges and agrees that the program technical documentation, including the
 *     code, is confidential information belonging to BestHealth, and must not be disclosed to any third parties
 *     other than BestHealth and the customer.
 *
 *  3. The program technical documentation, including the code, is provided and for customer reference
 *     only. After delivery by BestHealth, the customer shall use the program technical documentation, including
 *     the code, at their own risk. BestHealth disclaims any expressed, implied or statutory warranties, including
 *     the warranties of merchantability, satisfactory quality and fitness for a particular purpose.
 *
 *  <h2><center>Copyright (C) BEST HEALTH ELECTRONIC Inc. All rights reserved</center></h2>
 */
/* Define to prevent recursive inclusion -------------------------------------------------------------------*/
#ifndef _OSCILLATORS_H_
#define _OSCILLATORS_H_

#include "stdint.h"

typedef enum {
    HALT_MODE_SLEEP  = 0x00,    // Sleep mode
    HALT_MODE_IDLE_0 = 0x01,    // Idle mode 0: CPU stops, low-speed oscillator is enabled
    HALT_MODE_IDLE_1 = 0x03,    // Idle mode 1: CPU stops, both high-speed and low-speed oscillators are enabled
    HALT_MODE_IDLE_2 = 0x02,    // Idle mode 2: CPU stops, high-speed oscillator is enabled
} Oscillators_Halt_Mode_e;

typedef enum {
    IRC2_HIRC_4MHZ   = 0x01,    // High-speed internal oscillator at 4 MHz
    IRC2_MIRC_400KHZ = 0x11,    // Medium-speed internal oscillator at 400 kHz
} Oscillators_IRC2_e;

typedef struct
{
    uint8_t haltMode;    //!< R/W @see Oscillators_Halt_Mode_e
    uint8_t irc2;        //!< R/W @see Oscillators_IRC2_e
} Oscillators_Cfg_t;

/* Exported functions --------------------------------------------------------------------------------------*/
void Oscillators_Cfg(Oscillators_Cfg_t *cfg);
void SetHaltMode(uint8_t haltMode);
#endif
