===============================================================================================
                               Comparator Example
===============================================================================================
Copyright(C) Redpine Signals 2016
All rights reserved by Redpine Signals.

This program should be used on your own responsibility.
Redpine Signals assumes no responsibility for any losses
incurred by customers or third parties arising from the use of this file. 
                                                  
Function description:
===============================================================================================
This example demostrate comparator functionality,If non-inverting input voltage greater than
inverting input voltage then comparator output will high and comparator interrupt will hit.
Following Configuration are used in example :
Non-inverting input pin -> AGPIO0(ULP_GPIO_0) 
Inverting input pin     -> AGPIO1(ULP_GPIO_1)
Comparator number       -> Comparator1 used for operation.
SiliconRev              -> This parameter define chip revision number,For example metal_rev_1p4 is 0x14
                           and for metal_rev_1p3 is 0x13 etc.						   
===============================================================================================
MACROs Usage
===============================================================================================
COMP1_POS_INPUT_EXTERNAL_NEG_INPUT_EXTERNAL   : If this MACRO enable then for comparator1 both
                                                non-inverting and inverting input form GPIOs.
COMP1_POS_INPUT_EXTERNAL_NEG_INPUT_REF_SCALER : If this MACRO enable then for comparator1 non-inverting
                                                form GPIO and inverting input form internal reference
												scaler output.
Note->In above MACROs at time only one MACRO should be enable.												
===============================================================================================
Environment
===============================================================================================
Test Board:
---------------------
Smart EVK 

---------------------


Assistance software:
---------------------
===============================================================================================
Setup requirement:
===============================================================================================
If 'COMP1_POS_INPUT_EXTERNAL_NEG_INPUT_EXTERNAL' MACRO enable then connect external voltage 
to following pin
Non-inverting input : (ULP_GPIO_0):J2.6 (Analog pin0)
Inverting input     : (ULP_GPIO_1):J2.8 (Analog pin1)

If 'COMP1_POS_INPUT_EXTERNAL_NEG_INPUT_REF_SCALER' MACRO enable then connect external
voltage to non-inverting terminal (ULP_GPIO_0):J2.6 (Analog pin0) and inverting 
terminal will connect the reference scaler output.
===============================================================================================
===============================================================================================
Pass criteria:
====================================================================================================================
1.For 'COMP1_POS_INPUT_EXTERNAL_NEG_INPUT_EXTERNAL' MACRO enable
  If Applied AGPIO0 input supply >= Applied AGPIO1 input supply then comparator output will high,interrupt will hit
                                    and UULP_GPIO3 will toggle.                                             
  If Applied AGPIO0 input supply < Applied AGPIO1 input supply then comparator output will low,interrupt will not hit
 
2.For 'COMP1_POS_INPUT_EXTERNAL_NEG_INPUT_REF_SCALER' MACRO enable
  If Applied AGPIO0 input supply >= 0.8V(reference scaler output) then comparator output will high,interrupt will hit
                                    and UULP_GPIO3 will toggle.
  If Applied AGPIO0 input supply < 0.8V(reference scaler output) then comparator output will low,interrupt will not hit.  
====================================================================================================================