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
32 //******************************************************************************
\r
34 //******************************************************************************
\r
35 //! Sample on leading _rising_ edge, setup on trailing _falling_ edge.
\r
38 //! Sample on leading _falling_ edge, setup on trailing _rising_ edge.
\r
39 //#define SPIMODE 1
\r
42 //******************************************************************************
\r
43 // Typical and maximum voltage difference between supply and battery
\r
44 //******************************************************************************
\r
45 //! Typical difference between VIN and VBAT, in mV.
\r
46 #define VIN_VBAT_DIFF_TYP 600
\r
48 //! Maximum allowed difference between VIN - VIN_VBAT_DIFF_TYP and VBAT, in mV.
\r
49 #define VIN_VBAT_DIFF_MAX 500
\r
52 //******************************************************************************
\r
53 // Error-flag bit identifiers
\r
54 //******************************************************************************
\r
55 //! Wrong jumper settings.
\r
56 #define ERR_JUMPER_MISMATCH 0x01
\r
58 //! Both batteries disabled.
\r
59 #define ERR_NO_BATTERIES_ENABLED 0x02
\r
61 //! PWM output too much/little.
\r
62 #define ERR_PWM_CONTROL 0x04
\r
64 //! Battery temperature out of limits.
\r
65 #define ERR_BATTERY_TEMPERATURE 0x08
\r
67 //! Battery couldn't be charged.
\r
68 #define ERR_BATTERY_EXHAUSTED 0x10
\r
71 //******************************************************************************
\r
72 // Function prototypes
\r
73 //******************************************************************************
\r
74 unsigned char Initialize(unsigned char);
\r
75 unsigned char BatteryControl(unsigned char);
\r
76 unsigned char Discharge(unsigned char);
\r
77 unsigned char Sleep(unsigned char);
\r
79 unsigned char Error(unsigned char);
\r
80 void SetErrorFlag(unsigned char);
\r
81 unsigned char JumperCheck(void);
\r
83 #endif // STATEFUNC_H
\r