00001 /* This file has been prepared for Doxygen automatic documentation generation.*/ 00033 #ifndef BATTERY_H 00034 #define BATTERY_H 00035 00036 00037 //****************************************************************************** 00038 // Defines for EEPROM reading 00039 //****************************************************************************** 00040 #define OWIBUS OWI_PIN_0 00041 00042 #define OW_NONE 0x00 00043 #define OW_DS2505 0x09 00044 00045 #define DS2505_MEM_READ 0xF0 00046 #define DS2505_STATUS_READ 0xAA 00047 #define DS2505_DATA_READ 0xC3 00048 00049 00050 //****************************************************************************** 00051 // RID-less charging (for BatteryStatusRefresh()) 00052 //****************************************************************************** 00053 //#define ALLOW_NO_RID //!< Use default battery data if no matching entry found. 00054 00055 #define DEF_BAT_CAPACITY 0 00056 #define DEF_BAT_CURRENT_MAX 0 00057 #define DEF_BAT_TIME_MAX 0 00058 00059 #define DEF_BAT_CURRENT_MIN 0 00060 00061 00062 00063 //****************************************************************************** 00064 // RID and NTC defines and struct declarations 00065 //****************************************************************************** 00066 #define RID_TABLE_SIZE 4 00067 #define NTC_TABLE_SIZE 20 00068 00071 #define NTC_MAX_TEMPERATURE 127 00072 00073 00075 struct RID_Lookup_struct { 00076 unsigned int Low; 00077 unsigned int High; 00078 unsigned int Resistance; 00079 unsigned int Capacity; 00080 unsigned int Icharge; 00081 unsigned int tCutOff; 00082 unsigned int ICutOff; 00083 }; 00084 typedef struct RID_Lookup_struct RID_Lookup_t; 00085 00090 struct NTC_Lookup_struct 00091 { 00092 unsigned int ADC; 00093 unsigned char ADCsteps; 00094 }; 00095 typedef struct NTC_Lookup_struct NTC_Lookup_t; 00096 00097 00098 //****************************************************************************** 00099 // Global variables 00100 //****************************************************************************** 00101 extern __eeprom Battery_t BattControl[]; 00102 extern Batteries_t BattData; 00103 extern __eeprom unsigned char BattEEPROM[][32]; 00104 extern unsigned char BattActive; 00105 00106 00107 //****************************************************************************** 00108 // Function prototypes 00109 //****************************************************************************** 00110 unsigned char BatteryCheck(void); 00111 unsigned char BatteryStatusRefresh(void); 00112 unsigned char BatteryDataRefresh(void); 00113 void EnableBattery(unsigned char); 00114 void DisableBatteries(void); 00115 unsigned char RIDLookUp(void); 00116 void NTCLookUp(void); 00117 00118 00119 #endif // BATTERY_H