1 /* This file has been prepared for Doxygen automatic documentation generation.*/
\r
2 /*! \file *********************************************************************
\r
5 * Structs in common for Slave and Master
\r
7 * Contains struct declarations for ADC.c and battery.c.\n
\r
8 * These are also used in the Master, and have therefore been
\r
9 * put in a separate file for convenience.
\r
11 * \par Application note:
\r
12 * AVR458: Charging Li-Ion Batteries with BC100
\r
14 * \par Documentation:
\r
15 * For comprehensive code documentation, supported compilers, compiler
\r
16 * settings and supported devices see readme.html
\r
19 * Atmel Corporation: http://www.atmel.com \n
\r
20 * Support email: avr@atmel.com \n
\r
25 * $URL: http://svn.norway.atmel.com/AppsAVR8/avr458_Charging_Li-Ion_Batteries_with_BC100/tag/20070904_release_1.0/code/IAR/structs.h $
\r
26 * $Date: 2007-08-10 09:28:35 +0200 (fr, 10 aug 2007) $\n
\r
27 ******************************************************************************/
\r
34 //******************************************************************************
\r
35 // Battery struct declarations
\r
36 //******************************************************************************
\r
37 /*! \brief Holds status and various data for a battery
\r
39 * These data are updated by BatteryStatusRefresh(), RIDLookUp(),
\r
40 * NTCLookUp() and BatteryDataRefresh().
\r
42 struct Batteries_struct
\r
44 unsigned char Present : 1; //!< Battery found. (TRUE/FALSE)
\r
45 unsigned char Charged : 1; //!< Battery fully charged. (TRUE/FALSE)
\r
46 unsigned char Low : 1; //!< Battery low voltage. (TRUE/FALSE)
\r
47 unsigned char Exhausted : 1; //!< Battery exhausted. (TRUE/FALSE)
\r
48 unsigned char HasRID : 1; //!< Battery has resistor ID. (TRUE/FALSE)
\r
49 unsigned char Circuit; //!< Battery safety circuit (family id).
\r
50 signed char Temperature; //!< Battery temperature, in centigrade.
\r
51 unsigned char ADCSteps; //!< ADC steps per half degree.
\r
52 unsigned int Capacity; //!< Capacity, in mAh.
\r
53 unsigned int MaxCurrent; //!< Charge current, in mA.
\r
54 unsigned int MaxTime; //!< Charge cut-off time, in minutes.
\r
55 unsigned int MinCurrent; //!< Cut-off current, in mA.
\r
57 typedef struct Batteries_struct Batteries_t; //!< For convenience.
\r
60 //! \brief Holds control data for a battery
\r
61 struct Battery_struct
\r
63 //! Battery valid, enabling allowed. (TRUE/FALSE)
\r
64 unsigned char Enabled : 1;
\r
66 //! Disconnect allowed. (TRUE/FALSE)
\r
67 unsigned char DisconnectAllowed : 1;
\r
69 //! Inhibit charging. (TRUE/FALSE) \todo Changed by master?
\r
70 unsigned char ChargeInhibit : 1;
\r
72 typedef struct Battery_struct Battery_t; //!< For convenience.
\r
75 //******************************************************************************
\r
76 // ADC status struct declaration
\r
77 //******************************************************************************
\r
78 /*! \brief Holds ADC-status and samples
\r
80 * Is updated by ADC_ISR().
\r
82 struct ADC_Status_struct
\r
84 unsigned char MUX : 5; //!< Corresponds to ADMUX low bits MUX4..0.
\r
85 unsigned char Flag : 1; //!< ADC cycle complete (TRUE/FALSE).
\r
86 unsigned char Mains : 1; //!< Mains OK? (TRUE/FALSE).
\r
87 unsigned char Halt : 1; //!< Stop A/D-conversions (TRUE/FALSE).
\r
88 unsigned char ADC3_G20_OS : 4; //!< Offset on ADC3 at 20x gain.
\r
89 unsigned char ADC5_G20_OS : 4; //!< Offset on ADC5 at 20x gain.
\r
90 unsigned int rawRID; //!< Raw, unconditioned resistor ID data.
\r
91 unsigned int rawNTC; //!< Raw, unconditioned thermistor data.
\r
92 unsigned int rawVBAT; //!< Raw, unconditioned battery voltage.
\r
93 unsigned int VIN; //!< Supply voltage, in mV.
\r
94 unsigned int VBAT; //!< Battery voltage, in mV.
\r
95 signed int IBAT; //!< Battery current, in mA.
\r
96 signed int discIBAT[4]; //!< Discrete battery current readings, in mA.
\r
97 signed int avgIBAT; //!< Average of the last four IBAT readings, in mA.
\r
99 typedef struct ADC_Status_struct ADC_Status_t; //!< For convenience.
\r
102 #endif // STRUCTS_H
\r