/* automatically generated by rust-bindgen 0.72.1 */

pub const CMP_WIN_CMP12: u32 = 1;
pub const CMP_WIN_CMP34: u32 = 2;
pub const CMP_POSITIVE_NONE: u32 = 0;
pub const CMP_POSITIVE_INP1: u32 = 1;
pub const CMP_POSITIVE_INP2: u32 = 2;
pub const CMP_POSITIVE_INP3: u32 = 4;
pub const CMP_POSITIVE_INP4: u32 = 8;
pub const CMP_WIN_POSITIVE_NONE: u32 = 0;
pub const CMP_WIN_POSITIVE_INP2: u32 = 2;
pub const CMP_WIN_POSITIVE_INP3: u32 = 4;
pub const CMP_WIN_POSITIVE_INP4: u32 = 8;
pub const CMP_SCAN_STAT_INP_NONE: u32 = 0;
pub const CMP_SCAN_STAT_INP1: u32 = 65536;
pub const CMP_SCAN_STAT_INP2: u32 = 131072;
pub const CMP_SCAN_STAT_INP3: u32 = 262144;
pub const CMP_SCAN_STAT_INP4: u32 = 524288;
pub const CMP_SCAN_STAT_INM_NONE: u32 = 0;
pub const CMP_SCAN_STAT_INM1: u32 = 1;
pub const CMP_SCAN_STAT_INM2: u32 = 2;
pub const CMP_SCAN_STAT_INM3: u32 = 4;
pub const CMP_SCAN_STAT_INM4: u32 = 8;
pub const CMP_SCAN_SRC_INP1_INM1: u32 = 1;
pub const CMP_SCAN_SRC_INP2_INM2: u32 = 2;
pub const CMP_SCAN_SRC_INP3_INM3: u32 = 4;
pub const CMP_SCAN_SRC_INP4_INM4: u32 = 8;
pub const CMP_SCAN_NONE: u32 = 0;
pub const CMP_SCAN_INP: u32 = 8;
pub const CMP_SCAN_INM: u32 = 12;
pub const CMP_NEGATIVE_NONE: u32 = 0;
pub const CMP_NEGATIVE_INM1: u32 = 1;
pub const CMP_NEGATIVE_INM2: u32 = 2;
pub const CMP_NEGATIVE_INM3: u32 = 4;
pub const CMP_NEGATIVE_INM4: u32 = 8;
pub const CMP_WIN_LOW_NONE: u32 = 0;
pub const CMP_WIN_LOW_INM1: u32 = 1;
pub const CMP_WIN_LOW_INM2: u32 = 2;
pub const CMP_WIN_LOW_INM3: u32 = 4;
pub const CMP_WIN_LOW_INM4: u32 = 8;
pub const CMP_WIN_HIGH_NONE: u32 = 0;
pub const CMP_WIN_HIGH_INM1: u32 = 1;
pub const CMP_WIN_HIGH_INM2: u32 = 2;
pub const CMP_WIN_HIGH_INM3: u32 = 4;
pub const CMP_WIN_HIGH_INM4: u32 = 8;
pub const CMP_OUT_INVT_OFF: u32 = 0;
pub const CMP_OUT_INVT_ON: u32 = 2;
pub const CMP_DETECT_EDGS_NONE: u32 = 0;
pub const CMP_DETECT_EDGS_RISING: u32 = 16;
pub const CMP_DETECT_EDGS_FALLING: u32 = 32;
pub const CMP_DETECT_EDGS_BOTH: u32 = 48;
pub const CMP_FLAG_DETECT_EDGS_RISING: u32 = 128;
pub const CMP_FLAG_DETECT_EDGS_FALLING: u32 = 64;
pub const CMP_FLAG_DETECT_EDGS_BOTH: u32 = 192;
pub const CMP_OUT_FILTER_NONE: u32 = 0;
pub const CMP_OUT_FILTER_CLK: u32 = 1;
pub const CMP_OUT_FILTER_CLK_DIV2: u32 = 2;
pub const CMP_OUT_FILTER_CLK_DIV4: u32 = 3;
pub const CMP_OUT_FILTER_CLK_DIV8: u32 = 4;
pub const CMP_OUT_FILTER_CLK_DIV16: u32 = 5;
pub const CMP_OUT_FILTER_CLK_DIV32: u32 = 6;
pub const CMP_OUT_FILTER_CLK_DIV64: u32 = 7;
pub const CMP_BLANKWIN_SRC1: u32 = 1;
pub const CMP_BLANKWIN_SRC2: u32 = 2;
pub const CMP_BLANKWIN_SRC3: u32 = 4;
pub const CMP_BLANKWIN_SRC4: u32 = 8;
pub const CMP_BLANKWIN_SRC5: u32 = 16;
pub const CMP_BLANKWIN_SRC6: u32 = 32;
pub const CMP_BLANKWIN_SRC7: u32 = 64;
pub const CMP_BLANKWIN_SRC8: u32 = 128;
pub const CMP_BLANKWIN_SRC9: u32 = 256;
pub const CMP_BLANKWIN_SRC10: u32 = 512;
pub const CMP_BLANKWIN_SRC11: u32 = 1024;
pub const CMP_BLANKWIN_SRC12: u32 = 2048;
pub const CMP_BLANKWIN_SRC13: u32 = 4096;
pub const CMP_BLANKWIN_SRC14: u32 = 8192;
pub const CMP_BLANKWIN_SRC15: u32 = 16384;
pub const CMP_BLANKWIN_SRC16: u32 = 32768;
pub const CMP_BLANKWIN_VALID_LVL_LOW: u32 = 0;
pub const CMP_BLANKWIN_VALID_LVL_HIGH: u32 = 1;
pub const CMP_BLANKWIN_OUTPUT_LVL_LOW: u32 = 0;
pub const CMP_BLANKWIN_OUTPUT_LVL_HIGH: u32 = 64;
pub const CMP_BLANKWIN_OUTPUT_LVL_HOLD: u32 = 128;
pub const CMP_BLANKWIN_MD_LVL: u32 = 0;
pub const CMP_BLANKWIN_MD_EDGE: u32 = 32;
pub const CMP_BLANKWIN_VALID_EDGE_NONE: u32 = 0;
pub const CMP_BLANKWIN_VALID_EDGE_RISING: u32 = 256;
pub const CMP_BLANKWIN_VALID_EDGE_FALLING: u32 = 512;
pub const CMP_BLANKWIN_VALID_EDGE_ALL: u32 = 768;
pub const en_functional_state_t_DISABLE: en_functional_state_t = 0;
pub const en_functional_state_t_ENABLE: en_functional_state_t = 1;
#[doc = " @brief Functional state"]
pub type en_functional_state_t = ::core::ffi::c_uint;
pub const en_flag_status_t_RESET: en_flag_status_t = 0;
pub const en_flag_status_t_SET: en_flag_status_t = 1;
#[doc = " @brief Flag status"]
pub type en_flag_status_t = ::core::ffi::c_uint;
#[doc = " @brief CMP"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct CM_CMP_TypeDef {
    pub MDR: u8,
    pub FIR: u8,
    pub OCR: u8,
    pub RESERVED0: [u8; 1usize],
    pub PMSR: u32,
    pub RESERVED1: [u8; 8usize],
    pub BWSR1: u32,
    pub BWSR2: u16,
    pub RESERVED2: [u8; 2usize],
    pub SCCR: u32,
    pub SCMR: u32,
}
#[doc = " @brief CMP normal mode configuration structure"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_cmp_init_t {
    #[doc = "< Positive(compare voltage) input @ref CMP_Positive_Input_Select"]
    pub u16PositiveInput: u16,
    #[doc = "< Negative(Reference voltage) input @ref CMP_Negative_Input_Select"]
    pub u16NegativeInput: u16,
    #[doc = "< Output polarity select, @ref CMP_Out_Polarity_Select"]
    pub u16OutPolarity: u16,
    #[doc = "< Output detect edge, @ref CMP_Out_Detect_Edge_Select"]
    pub u16OutDetectEdge: u16,
    #[doc = "< Output Filter, @ref CMP_Out_Filter"]
    pub u16OutFilter: u16,
}
#[doc = " @brief CMP window mode configuration structure"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_cmp_window_init_t {
    #[doc = "< Window mode Positive(compare voltage) input @ref CMP_Window_Positive_Select"]
    pub u16PositiveInput: u16,
    #[doc = "< CMP reference low voltage for window mode @ref CMP_Window_Low_Select"]
    pub u32WinVolLow: u32,
    #[doc = "< CMP reference high voltage for window mode @ref CMP_Window_High_Select"]
    pub u32WinVolHigh: u32,
    #[doc = "< Output polarity select, @ref CMP_Out_Polarity_Select"]
    pub u16OutPolarity: u16,
    #[doc = "< Output detect edge, @ref CMP_Out_Detect_Edge_Select"]
    pub u16OutDetectEdge: u16,
    #[doc = "< Output Filter, @ref CMP_Out_Filter"]
    pub u16OutFilter: u16,
}
#[doc = " @brief CMP blank window function configuration structure"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_cmp_blankwindow_t {
    #[doc = "< blank window mode select, @ref CMP_BlankWindow_Mode"]
    pub u8Mode: u8,
    #[doc = "< blank window source select,\ncan be any combination of @ref CMP_BlankWindow_Src"]
    pub u16Src: u16,
    #[doc = "< Valid level for blank window level mode @ref CMP_BlankWindow_Valid_Level\nValid edge for blank window edge mode @ref CMP_BlankWindow_Valid_Edge"]
    pub u16ValidLevelEdge: u16,
    #[doc = "< Mask width when valid edge occurs for blank window edge mode, which range\nfrom 0~255"]
    pub u16MaskWidth: u16,
    #[doc = "< CMP output level when blank window valid @ref CMP_BlankWindow_output_Level"]
    pub u8OutLevel: u8,
}
#[doc = " @brief CMP input scan mode configuration structure"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_cmp_scan_config_t {
    #[doc = "< Scan mode @ref CMP_Scan_Mode"]
    pub u16Mode: u16,
    #[doc = "< Scan input source @ref CMP_Scan_Inm_Inp_Src"]
    pub u16Src: u16,
    #[doc = "< Scan stable time value, range [0x00U ~ 0x3FU],\nThe CMP stable time = T(CMP clock) x u16Stable,\nThe stable time is recommended greater than 100nS"]
    pub u16Stable: u16,
    #[doc = "< Scan period value, range [0x08 ~ 0xFF],\nu16Period > (u16Stable + u16OutFilter * 4 + CMP_SCAN_PERIOD_IMME)\nu16OutFilter is configured in CMP_NormalModeInit() function."]
    pub u16Period: u16,
}
unsafe extern "C" {
    #[doc = "Global function prototypes (definition in C source)\n/\n/**\n @addtogroup CMP_Global_Functions\n @{"]
    pub fn CMP_StructInit(pstcCmpInit: *mut stc_cmp_init_t) -> i32;
    pub fn CMP_NormalModeInit(CMPx: *mut CM_CMP_TypeDef, pstcCmpInit: *const stc_cmp_init_t)
        -> i32;
    pub fn CMP_DeInit(CMPx: *mut CM_CMP_TypeDef);
    pub fn CMP_FuncCmd(CMPx: *mut CM_CMP_TypeDef, enNewState: en_functional_state_t);
    pub fn CMP_IntCmd(CMPx: *mut CM_CMP_TypeDef, enNewState: en_functional_state_t);
    pub fn CMP_CompareOutCmd(CMPx: *mut CM_CMP_TypeDef, enNewState: en_functional_state_t);
    pub fn CMP_PinVcoutCmd(CMPx: *mut CM_CMP_TypeDef, enNewState: en_functional_state_t);
    pub fn CMP_GetStatus(CMPx: *const CM_CMP_TypeDef) -> en_flag_status_t;
    pub fn CMP_SetOutDetectEdge(CMPx: *mut CM_CMP_TypeDef, u8CmpEdges: u8);
    pub fn CMP_SetOutFilter(CMPx: *mut CM_CMP_TypeDef, u8CmpFilter: u8);
    pub fn CMP_SetOutPolarity(CMPx: *mut CM_CMP_TypeDef, u16CmpPolarity: u16);
    pub fn CMP_SetPositiveInput(CMPx: *mut CM_CMP_TypeDef, u16PositiveInput: u16);
    pub fn CMP_SetNegativeInput(CMPx: *mut CM_CMP_TypeDef, u16NegativeInput: u16);
    pub fn CMP_ClearOutDetectFlag(CMPx: *mut CM_CMP_TypeDef, u8EdgesFlag: u8);
    pub fn CMP_GetOutDetectFlag(CMPx: *const CM_CMP_TypeDef, u8EdgesFlag: u8) -> en_flag_status_t;
    pub fn CMP_WindowModeInit(
        u8WinCMPx: u8,
        pstcCmpWindowInit: *const stc_cmp_window_init_t,
    ) -> i32;
    pub fn CMP_WindowStructInit(pstcCmpWindowInit: *mut stc_cmp_window_init_t) -> i32;
    pub fn CMP_BlankWindowSrcDisable(CMPx: *mut CM_CMP_TypeDef, u16BlankWindowSrc: u16);
    pub fn CMP_BlankWindowConfig(
        CMPx: *mut CM_CMP_TypeDef,
        pstcBlankWindowConfig: *const stc_cmp_blankwindow_t,
    ) -> i32;
    pub fn CMP_BlankWindowStructInit(pstcBlankWindowConfig: *mut stc_cmp_blankwindow_t) -> i32;
    pub fn CMP_BlankWindowCmd(CMPx: *mut CM_CMP_TypeDef, enNewState: en_functional_state_t);
    pub fn CMP_BlankWindowMode(CMPx: *mut CM_CMP_TypeDef, u8Mode: u8);
    pub fn CMP_GetScanInpSrc(CMPx: *mut CM_CMP_TypeDef) -> u32;
    pub fn CMP_GetScanInmSrc(CMPx: *mut CM_CMP_TypeDef) -> u32;
    pub fn CMP_ScanSetSrc(CMPx: *mut CM_CMP_TypeDef, u16Src: u16);
    pub fn CMP_ScanSetMode(CMPx: *mut CM_CMP_TypeDef, u16Mode: u16);
    pub fn CMP_ScanConfig(
        CMPx: *mut CM_CMP_TypeDef,
        pstcCmpScanConfig: *mut stc_cmp_scan_config_t,
    ) -> i32;
    pub fn CMP_ScanStructInit(pstcCmpScanConfig: *mut stc_cmp_scan_config_t) -> i32;
    pub fn CMP_ScanTimeConfig(CMPx: *mut CM_CMP_TypeDef, u16Stable: u16, u16Period: u16) -> i32;
    pub fn CMP_ScanCmd(CMPx: *mut CM_CMP_TypeDef, enNewState: en_functional_state_t);
}
