Initial import
[avr_bc100.git] / BaseTinyFirmware / IAR / ADC.h
1 /* This file has been prepared for Doxygen automatic documentation generation.*/\r
2 /*! \file *********************************************************************\r
3  *\r
4  * \brief\r
5  *      Headerfile for ADC.c\r
6  *\r
7  *      Contains definitions for ADC setup, and minimum supply voltage.\r
8  *\r
9  * \par Application note:\r
10  *      AVR458: Charging Li-Ion Batteries with BC100\r
11  *\r
12  * \par Documentation:\r
13  *      For comprehensive code documentation, supported compilers, compiler\r
14  *      settings and supported devices see readme.html\r
15  *\r
16  * \author\r
17  *      Atmel Corporation: http://www.atmel.com \n\r
18  *      Support email: avr@atmel.com \n\r
19  *      Original author: \n\r
20  *\r
21  * $Name$\r
22  * $Revision: 2261 $\r
23  * $RCSfile$\r
24  * $URL: http://svn.norway.atmel.com/AppsAVR8/avr458_Charging_Li-Ion_Batteries_with_BC100/tag/20070904_release_1.0/code/IAR/ADC.h $\r
25  * $Date: 2007-08-10 09:28:35 +0200 (fr, 10 aug 2007) $\n\r
26  ******************************************************************************/\r
27 \r
28 #ifndef ADC_H\r
29 #define ADC_H\r
30 \r
31 //******************************************************************************\r
32 // ADC setup\r
33 //******************************************************************************\r
34 // 8MHz / (25x128) = 2500 samples/s/ch\r
35 #define ADC_PRESCALER     0x07\r
36 /*!< \brief Prescaling of ADC clock.\r
37  *\r
38  * The ADC will run at 8 MHz (system clock) divided by 128\r
39  * (prescaler), and every sample will takes approximately 25 ticks:\r
40  * Sample rate = 8 MHz / (128 * 25 cycles/sample) = 2.5 k samples/sec\r
41  */\r
42 \r
43 \r
44 //******************************************************************************\r
45 // Minimum supply voltage\r
46 //******************************************************************************\r
47 //! Minimum supply voltage (at TP101 = VIN+), in mV.\r
48 #define VIN_MIN               4400\r
49 \r
50 \r
51 //******************************************************************************\r
52 // Global variables\r
53 //******************************************************************************\r
54 extern __eeprom unsigned char VBAT_RANGE;   \r
55 extern ADC_Status_t ADCS;\r
56 \r
57 \r
58 //******************************************************************************\r
59 // Function prototypes\r
60 //******************************************************************************\r
61 #pragma vector=ADC_vect\r
62 __interrupt void ADC_ISR(void);\r
63 \r
64 unsigned int ScaleU(unsigned char setting, unsigned int data);\r
65 unsigned int ScaleI(unsigned char setting, unsigned int data);\r
66 void ADC_Wait(void);\r
67 void ADC_Init(void);\r
68 \r
69 #endif // ADC_H\r
70 \r