compb.h
Go to the documentation of this file.
00001 #ifndef __MSP430WARE_COMPB_H__
00002 #define __MSP430WARE_COMPB_H__
00003 
00004 #define __MSP430_HAS_COMPB__
00005 
00006 
00007 //*****************************************************************************
00008 //
00009 //The following are values that can be passed to Comp_init(),
00010 //Comp_disableInputBuffer(), and Comp_enableInputBuffer() in the
00011 //positiveTerminalInput, negativeTerminalInput, and inputPort parameters.
00012 //
00013 //*****************************************************************************
00014 #define COMPB_INPUT0  (CBIPSEL_0)
00015 #define COMPB_INPUT1  (CBIPSEL_1)
00016 #define COMPB_INPUT2  (CBIPSEL_2)
00017 #define COMPB_INPUT3  (CBIPSEL_3)
00018 #define COMPB_INPUT4  (CBIPSEL_4)
00019 #define COMPB_INPUT5  (CBIPSEL_5)
00020 #define COMPB_INPUT6  (CBIPSEL_6)
00021 #define COMPB_INPUT7  (CBIPSEL_7)
00022 #define COMPB_INPUT8  (CBIPSEL_8)
00023 #define COMPB_INPUT9  (CBIPSEL_9)
00024 #define COMPB_INPUT10 (CBIPSEL_10)
00025 #define COMPB_INPUT11 (CBIPSEL_11)
00026 #define COMPB_INPUT12 (CBIPSEL_12)
00027 #define COMPB_INPUT13 (CBIPSEL_13)
00028 #define COMPB_INPUT14 (CBIPSEL_14)
00029 #define COMPB_INPUT15 (CBIPSEL_15)
00030 #define COMPB_VREF    (0x10)
00031 
00032 //*****************************************************************************
00033 //
00034 //The following are values that can be passed to Comp_init() in the
00035 //powerModeSelect parameter.
00036 //
00037 //*****************************************************************************
00038 #define COMPB_POWERMODE_HIGHSPEED     (CBPWRMD_0)
00039 #define COMPB_POWERMODE_NORMALMODE    (CBPWRMD_1)
00040 #define COMPB_POWERMODE_ULTRALOWPOWER (CBPWRMD_2)
00041 
00042 //*****************************************************************************
00043 //
00044 //The following are values that can be passed to Comp_init() in the
00045 //outputFilterEnableAndDelayLevel parameter.
00046 //
00047 //*****************************************************************************
00048 #define COMPB_FILTEROUTPUT_OFF     0x00
00049 #define COMPB_FILTEROUTPUT_DLYLVL1 (CBF + CBFDLY_0)
00050 #define COMPB_FILTEROUTPUT_DLYLVL2 (CBF + CBFDLY_1)
00051 #define COMPB_FILTEROUTPUT_DLYLVL3 (CBF + CBFDLY_2)
00052 #define COMPB_FILTEROUTPUT_DLYLVL4 (CBF + CBFDLY_3)
00053 
00054 //*****************************************************************************
00055 //
00056 //The following are values that can be passed to Comp_init() in the
00057 //invertedOutputPolarity parameter.
00058 //
00059 //*****************************************************************************
00060 #define COMPB_NORMALOUTPUTPOLARITY   ( !(CBOUTPOL) )
00061 #define COMPB_INVERTEDOUTPUTPOLARITY (CBOUTPOL)
00062 
00063 //*****************************************************************************
00064 //
00065 //The following are values that can be passed to Comp_setReferenceVoltage() in
00066 //the supplyVoltageBase parameter.
00067 //
00068 //*****************************************************************************
00069 #define COMPB_VREFBASE_VCC (CBREFL_0)
00070 #define COMPB_VREFBASE1_5V (CBREFL_1)
00071 #define COMPB_VREFBASE2_0V (CBREFL_2)
00072 #define COMPB_VREFBASE2_5V (CBREFL_3)
00073 
00074 //*****************************************************************************
00075 //
00076 //The following are values that can be passed to Comp_setEdgeDirection() in
00077 //the edgeDirection parameter.
00078 //
00079 //*****************************************************************************
00080 #define COMPB_FALLINGEDGE ( !(CBIES) )
00081 #define COMPB_RISINGEDGE  (CBIES)
00082 
00083 //*****************************************************************************
00084 //
00085 //The following are values that returned by COMPB_outputValue().
00086 //
00087 //*****************************************************************************
00088 #define COMPB_LOW  (0x0)
00089 #define COMPB_HIGH (0x1)
00090 
00091 
00092 //*****************************************************************************
00093 //API
00094 //*****************************************************************************
00095 
00096 extern unsigned short COMPB_init (unsigned int baseAddress,
00097     unsigned char positiveTerminalInput,
00098     unsigned char negativeTerminalInput,
00099     unsigned int powerModeSelect,
00100     unsigned char outputFilterEnableAndDelayLevel,
00101     unsigned short invertedOutputPolarity);
00102 
00103 extern void COMPB_setReferenceVoltage (unsigned int baseAddress,
00104     unsigned int supplyVoltageReferenceBase,
00105     unsigned int lowerLimitSupplyVoltageFractionOf32,
00106     unsigned int upperLimitSupplyVoltageFractionOf32);
00107 
00108 extern void COMPB_enableInterrupt (unsigned int baseAddress, unsigned int mask);
00109 
00110 extern void COMPB_disableInterrupt (unsigned int baseAddress,
00111     unsigned int mask);
00112 
00113 extern void COMPB_clearInterrupt (unsigned int baseAddress, unsigned int mask);
00114 
00115 extern unsigned char COMPB_getInterruptStatus (unsigned int baseAddress,
00116     unsigned int mask);
00117 
00118 extern void COMPB_interruptSetEdgeDirection (unsigned int baseAddress,
00119     unsigned short edgeDirection);
00120 
00121 extern void COMPB_interruptToggleEdgeDirection (unsigned int baseAddress);
00122 
00123 extern void COMPB_enable (unsigned int baseAddress);
00124 
00125 extern void COMPB_disable (unsigned int baseAddress);
00126 
00127 extern void COMPB_enableShortOfInputs (unsigned int baseAddress);
00128 
00129 extern void COMPB_disableShortOfInputs (unsigned int baseAddress);
00130 
00131 extern void COMPB_disableInputBuffer (unsigned int baseAddress,
00132     unsigned char inputPort);
00133 
00134 extern void COMPB_enableInputBuffer (unsigned int baseAddress,
00135     unsigned char inputPort);
00136 
00137 extern void COMPB_IOSwap (unsigned int baseAddress);
00138 
00139 extern unsigned short COMPB_outputValue (unsigned int baseAddress);
00140 
00141 #endif

Copyright 2012, Texas Instruments Incorporated