/*H**************************************************************************
* NAME: adc_drv.h
*----------------------------------------------------------------------------
* Copyright (c) 2002 Atmel.
*----------------------------------------------------------------------------
* RELEASE: snd1c-refd-nf-3_0_0
* REVISION: 1.4
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains the A to D Converter driver definitions
*****************************************************************************/
#ifndef _ADC_DRV_H_
#define _ADC_DRV_H_
/*_____ I N C L U D E S ____________________________________________________*/
/*_____ M A C R O S ________________________________________________________*/
/*_____ D E F I N I T I O N ________________________________________________*/
/*_____ D E C L A R A T I O N ______________________________________________*/
void adc_set_prio (Byte);
#define Adc_set_clock(clock) (ADCLK = clock)
#define Adc_enable() (ADCON |= MSK_ADEN)
#define Adc_disable() (ADCON &= ~MSK_ADEN)
#define Adc_enable_int() (IEN1 |= MSK_EADC)
#define Adc_disable_int() (IEN1 &= ~MSK_EADC)
#define Adc_end_of_conv() ((ADCON & MSK_ADEOC) == MSK_ADEOC)
#define Adc_ack_conversion() (ADCON &= ~(MSK_ADEOC | MSK_ADCS))
#define Adc_get_data_h() (ADDH)
#define Adc_get_data_l() (ADDL)
#define Adc_start_std(channel) (ADCON |= (MSK_ADSST | channel))
#define Adc_start_idle(channel) (ADCON |= (MSK_ADSST | MSK_ADIDL | channel))
#define Adc_select_channel(c) (ADCON &= ~MSK_ADCS); (ADCON |= c)
#define Adc_convert_std() (ADCON |= MSK_ADSST)
#define Adc_convert_idle() (ADCON |= MSK_ADSST | MSK_ADIDL)
#endif /* _ADC_DRV_H_ */