// Input_9222.h: interface for the CInput_9222 class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_INPUT_9222_H__8AE04FC2_DB1F_4077_B420_18124E467E84__INCLUDED_)
#define AFX_INPUT_9222_H__8AE04FC2_DB1F_4077_B420_18124E467E84__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "InputBase.h"

class CAdlinkCommon;

// NOTE: the Channel/Point number for analog input is 0 to 15 only
// However, MIT internal setting is 16 to 31.

class CInput_9222 : public CInputBase
{
public:
    CInput_9222(const CInputSetting &Setting);
    virtual ~CInput_9222();

// nRange setting
/*
   #define AD_B_10_V     1
   #define AD_B_5_V      2
   #define AD_B_2_5_V    3
   #define AD_B_1_25_V   4
   #define AD_B_0_625_V  5
   #define AD_B_0_3125_V 6
   #define AD_B_0_5_V    7
   #define AD_B_0_05_V   8
   #define AD_B_0_005_V  9
   #define AD_B_1_V      10
   #define AD_B_0_1_V    11
   #define AD_B_0_01_V   12
   #define AD_B_0_001_V  13
   #define AD_U_20_V     14
   #define AD_U_10_V     15
   #define AD_U_5_V      16
   #define AD_U_2_5_V    17
   #define AD_U_1_25_V   18
   #define AD_U_1_V      19
   #define AD_U_0_1_V    20
   #define AD_U_0_01_V   21
   #define AD_U_0_001_V  22
   #define AD_B_2_V      23
   #define AD_B_0_25_V   24
   #define AD_B_0_2_V    25
   #define AD_U_4_V      26
   #define AD_U_2_V      27
   #define AD_U_0_5_V    28
   #define AD_U_0_4_V    29
 */
// method to query Analog input voltage
    BOOL GetVoltage(double &dVoltage, int nRange) override;

    int GetState() override;

    BOOL ClearCounter() override;

    BOOL EnableCounter() override;

    BOOL DisableCounter() override;

    unsigned long ReadCounter() override;

/* Mode
   SimpleGatedEventCNT
   SinglePeriodMSR
   SinglePulseWidthMSR
   SingleGatedPulseGen
   SingleTrigPulseGen
   RetrigSinglePulseGen
   SingleTrigContPulseGen
   ContGatedPulseGen
   EdgeSeparationMSR
   SingleTrigContPulseGenPWM
   ContGatedPulseGenPWM
   CW_CCW_Encoder
   x1_AB_Phase_Encoder
   x2_AB_Phase_Encoder
   x4_AB_Phase_Encoder
   Phase_Z
 */
    BOOL SetupCounter(int nMode) override;

    BOOL SetupCounter(int nMode, unsigned int LReg1_Val, unsigned int LReg2_Val) override;

private:
    std::unique_ptr<CAdlinkCommon> m_pCommon;
};

#endif // !defined(AFX_INPUT_9222_H__8AE04FC2_DB1F_4077_B420_18124E467E84__INCLUDED_)
