1 /* This file has been prepared for Doxygen automatic documentation generation.*/
\r
2 /*! \file *********************************************************************
\r
5 * Headerfile for statefunc.c
\r
7 * Contains definitions for SPI mode and error identifiers.
\r
9 * \par Application note:
\r
10 * AVR458: Charging Li-Ion Batteries with BC100
\r
12 * \par Documentation
\r
13 * For comprehensive code documentation, supported compilers, compiler
\r
14 * settings and supported devices see readme.html
\r
17 * Atmel Corporation: http://www.atmel.com \n
\r
18 * Support email: avr@atmel.com
\r
24 * $URL: http://svn.norway.atmel.com/AppsAVR8/avr458_Charging_Li-Ion_Batteries_with_BC100/tag/20070904_release_1.0/code/IAR/statefunc.h $
\r
25 * $Date: 2007-08-10 09:28:35 +0200 (fr, 10 aug 2007) $\n
\r
26 ******************************************************************************/
\r
31 //! number of connectors (1: just process A, 2 process A and B )
\r
33 #if ( BATCONN < 1 ) || ( BATCONN > 2 )
\r
34 #error "Invalid BATCONN. Must be set to 1 or 2."
\r
37 //******************************************************************************
\r
39 //******************************************************************************
\r
40 //! Sample on leading _rising_ edge, setup on trailing _falling_ edge.
\r
43 //! Sample on leading _falling_ edge, setup on trailing _rising_ edge.
\r
47 //******************************************************************************
\r
48 // Typical and maximum voltage difference between supply and battery
\r
49 //******************************************************************************
\r
50 //! Typical difference between VIN and VBAT, in mV.
\r
51 #define VIN_VBAT_DIFF_TYP 600
\r
53 //! Maximum allowed difference between VIN - VIN_VBAT_DIFF_TYP and VBAT, in mV.
\r
54 #define VIN_VBAT_DIFF_MAX 500
\r
57 //******************************************************************************
\r
58 // Error-flag bit identifiers
\r
59 //******************************************************************************
\r
60 //! Wrong jumper settings.
\r
61 #define ERR_JUMPER_MISMATCH 0x01
\r
63 //! Both batteries disabled.
\r
64 #define ERR_NO_BATTERIES_ENABLED 0x02
\r
66 //! PWM output too much/little.
\r
67 #define ERR_PWM_CONTROL 0x04
\r
69 //! Battery temperature out of limits.
\r
70 #define ERR_BATTERY_TEMPERATURE 0x08
\r
72 //! Battery couldn't be charged.
\r
73 #define ERR_BATTERY_EXHAUSTED 0x10
\r
76 //******************************************************************************
\r
77 // Function prototypes
\r
78 //******************************************************************************
\r
79 unsigned char Initialize(unsigned char);
\r
80 unsigned char BatteryControl(unsigned char);
\r
81 unsigned char Discharge(unsigned char);
\r
82 unsigned char Sleep(unsigned char);
\r
84 unsigned char Error(unsigned char);
\r
85 void SetErrorFlag(unsigned char);
\r
86 unsigned char JumperCheck(void);
\r
88 #endif // STATEFUNC_H
\r