#ifndef __SN32F790_OPA_H
#define __SN32F790_OPA_H

/*_____ I N C L U D E S ____________________________________________________*/
#include <SN32F790.h>
#include <SN32F700_Def.h>

/*_____ D E F I N I T I O N S ______________________________________________*/
/*
	Base Address : 0x4002 A000 (OPA)
*/

/* OPA Control register <OPA_CTRL> (0x00) */
																	//[0:0] OP-Amp 0 enable bit.
#define OP0EN_DIS							0		//Disable. OP0O/OP0P/OP0N pins are GPIO mode
#define OP0EN_EN							1		//Enable. OP0O is OP-Amp 0 output pin.
#define	mskOP0EN_DIS					(OP0EN_DIS << 0)
#define	mskOP0EN_EN						(OP0EN_EN << 0)

																	//[3:3] OP-Amp 0 positive input selection bit
#define OP0PS_GPIO						0		//OP0P is GPIO mode
#define OP0PS_POSITIVE				1		//OP0P is OPA0 positive input pin, and isolate GPIO function.
#define mskOP0PS_GPIO					(OP0PS_GPIO << 3)
#define mskOP0PS_POSITIVE			(OP0PS_POSITIVE << 3)

																	//[4:4] OP-Amp 0 negative input selection bit
#define OP0NS_GPIO						0		//OP0N is GPIO mode
#define OP0NS_NEGATIVE				1		//OP0N is OPA0 negative input pin, and isolate GPIO function.
#define mskOP0NS_GPIO					(OP0NS_GPIO << 4)
#define mskOP0NS_NEGATIVE			(OP0NS_NEGATIVE << 4)
														
																	//[8:8] OP-Amp 1 enable bit.
#define OP1EN_DIS							0		//Disable. OP1O/OP1P/OP1N pins are GPIO mode
#define OP1EN_EN							1		//Enable. OP1O is OP-Amp 1 output pin.
#define	mskOP1EN_DIS					(OP1EN_DIS << 8)
#define	mskOP1EN_EN						(OP1EN_EN << 8)

																	//[11:11] OP-Amp 1 positive input selection bit
#define OP1PS_GPIO						0		//OP1P is GPIO mode
#define OP1PS_POSITIVE				1		//OP1P is OPA1 positive input pin, and isolate GPIO function.
#define mskOP1PS_GPIO					(OP1PS_GPIO << 11)
#define mskOP1PS_POSITIVE			(OP1PS_POSITIVE << 11)

																	//[12:12] OP-Amp 1 negative input selection bit
#define OP1NS_GPIO						0		//OP1N is GPIO mode
#define OP1NS_NEGATIVE				1		//OP1N is OPA1 negative input pin, and isolate GPIO function.
#define mskOP1NS_GPIO					(OP1NS_GPIO << 12)
#define mskOP1NS_NEGATIVE			(OP1NS_NEGATIVE << 12)

/*_____ M A C R O S ________________________________________________________*/
#define __OPA_ENABLE_PCLK			SN_SYS1->AHBCLKEN_b.OPACLKEN = ENABLE		
#define __OPA_DISABLE_PCLK		SN_SYS1->AHBCLKEN_b.OPACLKEN = DISABLE	

/*_____ D E C L A R A T I O N S ____________________________________________*/
void OPA_Init(void);
void OPA_Enable(void);
void OPA_Disable(void);

#endif	/*__SN32F790_OPA_H*/
