smbus.c File Reference


Detailed Description

SMBus implementation.

TWI low-level code & command interpreters.

Application note:
AVR453: Smart Battery Reference Design
Documentation:
For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html
Author:
Atmel Corporation: http://www.atmel.com
Support email: avr@atmel.com
Original author: Rob G. Fries - Apt Inc.
Revision
URL
Date

Definition in file smbus.c.

#include <inavr.h>
#include "smbus.h"
#include "timer.h"
#include "pack.h"
#include "analog.h"
#include "calibration.h"
#include <iom406.h>
#include "interpret.h"
#include "main.h"
#include "pwrmgmt.h"

Go to the source code of this file.

Defines

#define HIGHEST_SMB_CMD   0x3F
#define MODULE_SMBUS
#define SMB_GenBusTimeout   1
#define SMB_GotCmdData   4
#define SMB_SetUpReply   2
#define TWC_GO   0x85
#define TWC_READ_NoACK   0x85
#define TWC_RESTART   0xB5
#define TWC_START   0xA5
#define TWC_STOP   0x94
#define TWS_BERR   0x00
#define TWS_FINAL   0xC8
#define TWS_LOST_ARB   0x38
#define TWS_MASK   0xF8
#define TWS_NSTAT   0xF8
#define TWS_RACK   0xB8
#define TWS_RCMD   0x80
#define TWS_RDATA   0x80
#define TWS_READ_ACK   0x40
#define TWS_READ_NAK   0x48
#define TWS_REPEAT   0xA0
#define TWS_RESTART   0x10
#define TWS_RNAK   0xC0
#define TWS_RSTOP   0xA0
#define TWS_RXDATA_ACK   0x50
#define TWS_RXDATA_NACK   0x58
#define TWS_SLA_R   0xA8
#define TWS_SLA_W   0x60
#define TWS_START   0x08
#define TWS_TXDATA_ACK   0x28
#define TWS_TXDATA_NAK   0x30
#define TWS_WRITE_ACK   0x18
#define TWS_WRITE_NAK   0x20
#define TXmsgDelete   {++TXmsgTail; TXmsgTail &= (4-1); TXmsgQty--;}
#define TXmsgEmpty   (TXmsgQty == 0)
#define TXmsgFull   (TXmsgQty == 4)

Typedefs

typedef unsigned char(* ptr2funcUC_V )(void)

Enumerations

enum  {
  TW_IDLE = 0, TW_Wait4Stop, TW_Wait4Cmd, TW_Wait4RW,
  TW_Wait4Data, TW_ReplyData, TW_MSLA_W, TW_MCMD_W,
  TW_MDATA_W
}

Functions

void Check50uS (void)
unsigned char FastCRC (unsigned char LastCRC, unsigned char newbyte)
void FillResponseInt (unsigned int info)
void FillResponseStr (char __flash *source)
void InitSMBus (void)
void InitSMBvariables (void)
void MasterInsertMsg (unsigned char addr, unsigned char cmd, unsigned int data)
__interrupt void PCINT0_ISR (void)
__interrupt void PCINT1_ISR (void)
void SMB_CmdInterpreter (void)
void SMB_Master (void)
void SMB_RestoreBus (void)
unsigned char SMBR_AbsSOC (void)
unsigned char SMBR_AtRate (void)
unsigned char SMBR_AtRateOK (void)
unsigned char SMBR_AtRateTTE (void)
unsigned char SMBR_AtRateTTF (void)
unsigned char SMBR_AvgCurrent (void)
unsigned char SMBR_AvgTTE (void)
unsigned char SMBR_AvgTTF (void)
unsigned char SMBR_BattMode (void)
unsigned char SMBR_BattStatus (void)
unsigned char SMBR_ChgCurrent (void)
unsigned char SMBR_ChgVoltage (void)
unsigned char SMBR_Current (void)
unsigned char SMBR_CycleCount (void)
unsigned char SMBR_DesignCap (void)
unsigned char SMBR_DesignVolt (void)
unsigned char SMBR_DeviceChem (void)
unsigned char SMBR_DeviceName (void)
unsigned char SMBR_FullChgCap (void)
unsigned char SMBR_invalid (void)
unsigned char SMBR_MaxError (void)
unsigned char SMBR_MfrAccess (void)
unsigned char SMBR_MfrData (void)
unsigned char SMBR_MfrDate (void)
unsigned char SMBR_MfrName (void)
unsigned char SMBR_Opt1 (void)
unsigned char SMBR_Opt2 (void)
unsigned char SMBR_Opt3 (void)
unsigned char SMBR_Opt4 (void)
unsigned char SMBR_Opt5 (void)
unsigned char SMBR_RelSOC (void)
unsigned char SMBR_RemCap (void)
unsigned char SMBR_RemCapAlm (void)
unsigned char SMBR_RemTimeAlm (void)
unsigned char SMBR_RunTTE (void)
unsigned char SMBR_SerialNo (void)
unsigned char SMBR_SpecInfo (void)
unsigned char SMBR_Temperature (void)
unsigned char SMBR_Voltage (void)
unsigned char SMBW_AtRate (void)
unsigned char SMBW_BattMode (void)
unsigned char SMBW_Invalid (void)
unsigned char SMBW_MfrAccess (void)
unsigned char SMBW_Opt1 (void)
unsigned char SMBW_Opt2 (void)
unsigned char SMBW_Opt3 (void)
unsigned char SMBW_Opt4 (void)
unsigned char SMBW_Opt5 (void)
unsigned char SMBW_RemCapAlm (void)
unsigned char SMBW_RemTimeAlm (void)
__interrupt void TWI_ISR (void)
__interrupt void TWICD_ISR (void)

Variables

__flash unsigned char crctable [16] = {0,0x07,0x0E,0x90, 0x1c,0x1b,0x12,0x15, 0x38,0x3F,0x36,0x31, 0x24,0x23,0x2A,0x2D}
__flash unsigned char crctable2 [16] = {0,0x70,0xE0,0x90, 0xC1,0xB1,0x21,0x51, 0x83,0xF3,0x63,0x13, 0x42,0x32,0xA2,0xD2}
unsigned char CurrentCmd = 0xFF
ptr2funcUC_V SMB_ReadCmd []
ptr2funcUC_V SMB_WriteCmd []
unsigned char SMLOCK = 0
unsigned char TEST50US = 0
unsigned char TW_MTxBuf [8]
unsigned char TW_MTxBufCnt = 0
unsigned char TW_MTxBufIndex = 0
unsigned char TW_RxBuf [10]
signed char TW_RxBufCnt = 0
unsigned char TW_RxBufIndex = 0
unsigned char TW_TxBuf [36]
unsigned char TW_TxBufCnt = 0
unsigned char TW_TxBufIndex = 0
unsigned char TWI_CmdFlags
unsigned char TWISR_state = TW_IDLE
unsigned char TXmsg [4][4]
volatile unsigned char TXmsgHead = 0
volatile unsigned char TXmsgQty = 0
volatile unsigned char TXmsgTail = 0
unsigned char UsePEC = 0


Define Documentation

#define HIGHEST_SMB_CMD   0x3F

Definition at line 64 of file smbus.c.

#define MODULE_SMBUS

Definition at line 39 of file smbus.c.

#define SMB_GenBusTimeout   1

Definition at line 137 of file smbus.c.

#define SMB_GotCmdData   4

Definition at line 139 of file smbus.c.

#define SMB_SetUpReply   2

Definition at line 138 of file smbus.c.

#define TWC_GO   0x85

Definition at line 104 of file smbus.c.

#define TWC_READ_NoACK   0x85

Definition at line 105 of file smbus.c.

#define TWC_RESTART   0xB5

Definition at line 108 of file smbus.c.

#define TWC_START   0xA5

Definition at line 106 of file smbus.c.

#define TWC_STOP   0x94

Definition at line 107 of file smbus.c.

#define TWS_BERR   0x00

Definition at line 99 of file smbus.c.

#define TWS_FINAL   0xC8

Definition at line 98 of file smbus.c.

#define TWS_LOST_ARB   0x38

Definition at line 81 of file smbus.c.

#define TWS_MASK   0xF8

Definition at line 71 of file smbus.c.

#define TWS_NSTAT   0xF8

Definition at line 72 of file smbus.c.

#define TWS_RACK   0xB8

Definition at line 96 of file smbus.c.

#define TWS_RCMD   0x80

Definition at line 93 of file smbus.c.

#define TWS_RDATA   0x80

Definition at line 92 of file smbus.c.

#define TWS_READ_ACK   0x40

Definition at line 83 of file smbus.c.

#define TWS_READ_NAK   0x48

Definition at line 84 of file smbus.c.

#define TWS_REPEAT   0xA0

Definition at line 95 of file smbus.c.

#define TWS_RESTART   0x10

Definition at line 76 of file smbus.c.

#define TWS_RNAK   0xC0

Definition at line 97 of file smbus.c.

#define TWS_RSTOP   0xA0

Definition at line 94 of file smbus.c.

#define TWS_RXDATA_ACK   0x50

Definition at line 85 of file smbus.c.

#define TWS_RXDATA_NACK   0x58

Definition at line 86 of file smbus.c.

#define TWS_SLA_R   0xA8

Definition at line 91 of file smbus.c.

#define TWS_SLA_W   0x60

Definition at line 90 of file smbus.c.

#define TWS_START   0x08

Definition at line 75 of file smbus.c.

#define TWS_TXDATA_ACK   0x28

Definition at line 79 of file smbus.c.

#define TWS_TXDATA_NAK   0x30

Definition at line 80 of file smbus.c.

#define TWS_WRITE_ACK   0x18

Definition at line 77 of file smbus.c.

#define TWS_WRITE_NAK   0x20

Definition at line 78 of file smbus.c.

#define TXmsgDelete   {++TXmsgTail; TXmsgTail &= (4-1); TXmsgQty--;}

Definition at line 298 of file smbus.c.

Referenced by TWI_ISR().

#define TXmsgEmpty   (TXmsgQty == 0)

Definition at line 296 of file smbus.c.

Referenced by SMB_Master().

#define TXmsgFull   (TXmsgQty == 4)

Definition at line 297 of file smbus.c.

Referenced by MasterInsertMsg().


Typedef Documentation

typedef unsigned char(* ptr2funcUC_V)(void)

Definition at line 54 of file smbus.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
TW_IDLE 
TW_Wait4Stop 
TW_Wait4Cmd 
TW_Wait4RW 
TW_Wait4Data 
TW_ReplyData 
TW_MSLA_W 
TW_MCMD_W 
TW_MDATA_W 

Definition at line 368 of file smbus.c.


Function Documentation

void Check50uS ( void   ) 

Definition at line 760 of file smbus.c.

Referenced by main().

unsigned char FastCRC ( unsigned char  LastCRC,
unsigned char  newbyte 
)

void FillResponseInt ( unsigned int  info  ) 

Definition at line 920 of file smbus.c.

References TW_TxBuf, TW_TxBufCnt, and TW_TxBufIndex.

Referenced by SMBR_AbsSOC(), SMBR_AtRate(), SMBR_AtRateOK(), SMBR_AtRateTTE(), SMBR_AtRateTTF(), SMBR_AvgCurrent(), SMBR_AvgTTE(), SMBR_AvgTTF(), SMBR_BattMode(), SMBR_BattStatus(), SMBR_ChgCurrent(), SMBR_ChgVoltage(), SMBR_Current(), SMBR_CycleCount(), SMBR_DesignCap(), SMBR_DesignVolt(), SMBR_FullChgCap(), SMBR_MaxError(), SMBR_MfrAccess(), SMBR_MfrDate(), SMBR_Opt4(), SMBR_Opt5(), SMBR_RelSOC(), SMBR_RemCap(), SMBR_RemCapAlm(), SMBR_RemTimeAlm(), SMBR_RunTTE(), SMBR_SerialNo(), SMBR_SpecInfo(), SMBR_Temperature(), and SMBR_Voltage().

void FillResponseStr ( char __flash *  source  ) 

Definition at line 930 of file smbus.c.

References ctr, TW_TxBuf, TW_TxBufCnt, and TW_TxBufIndex.

Referenced by SMBR_DeviceChem(), SMBR_DeviceName(), SMBR_MfrData(), and SMBR_MfrName().

void InitSMBus ( void   ) 

Definition at line 153 of file smbus.c.

Referenced by InitAll().

void InitSMBvariables ( void   ) 

Todo:
This can be modified to load defaults from EEPROM rather than fixed values to the SMB variables.

Todo:
Fill in current year, month, day. Values are octal

Todo:
for testing, initialized value before reaching fully charged, 6600mAh * 10727

Definition at line 1618 of file smbus.c.

Referenced by InitAll().

void MasterInsertMsg ( unsigned char  addr,
unsigned char  cmd,
unsigned int  data 
)

Definition at line 301 of file smbus.c.

Referenced by MasterSMBusCheck().

__interrupt void PCINT0_ISR ( void   ) 

Definition at line 200 of file smbus.c.

References TEST50US.

__interrupt void PCINT1_ISR ( void   ) 

Definition at line 209 of file smbus.c.

void SMB_CmdInterpreter ( void   ) 

Todo:
Add code here if encryption is desired.

Todo:
Add code here if encryption is desired.

Definition at line 771 of file smbus.c.

void SMB_Master ( void   ) 

Definition at line 694 of file smbus.c.

Referenced by Check50uS(), and MasterSMBusCheck().

void SMB_RestoreBus ( void   ) 

Definition at line 874 of file smbus.c.

unsigned char SMBR_AbsSOC ( void   ) 

Definition at line 1070 of file smbus.c.

References AbsoluteSOC(), FillResponseInt(), SMBV_AbsSOC, and SMBvar_int.

unsigned char SMBR_AtRate ( void   ) 

Definition at line 981 of file smbus.c.

References FillResponseInt(), SMBV_AtRate, and SMBvar_int.

unsigned char SMBR_AtRateOK ( void   ) 

Definition at line 1006 of file smbus.c.

References AtRateOK(), FillResponseInt(), SMBV_AtRateOK, and SMBvar_int.

unsigned char SMBR_AtRateTTE ( void   ) 

Definition at line 997 of file smbus.c.

References AtRateTTE(), FillResponseInt(), SMBV_AtRateTTE, and SMBvar_int.

unsigned char SMBR_AtRateTTF ( void   ) 

Definition at line 988 of file smbus.c.

References AtRateTTF(), FillResponseInt(), SMBV_AtRateTTF, and SMBvar_int.

unsigned char SMBR_AvgCurrent ( void   ) 

Definition at line 1043 of file smbus.c.

References CCarray_Average(), FillResponseInt(), SMBV_AvgCurrent, and SMBvar_int.

unsigned char SMBR_AvgTTE ( void   ) 

Definition at line 1106 of file smbus.c.

References FillResponseInt(), SMBV_AvgTTE, SMBvar_int, and TimeToEmpty().

unsigned char SMBR_AvgTTF ( void   ) 

Definition at line 1115 of file smbus.c.

References AvgTimeToFull(), FillResponseInt(), SMBV_AvgTTF, and SMBvar_int.

unsigned char SMBR_BattMode ( void   ) 

Definition at line 974 of file smbus.c.

References FillResponseInt(), SMBV_BattMode, and SMBvar_int.

unsigned char SMBR_BattStatus ( void   ) 

Definition at line 1147 of file smbus.c.

References FillResponseInt(), lobyte, SMBV_BattStatus, SMBvar_int, and SMBvariables.

unsigned char SMBR_ChgCurrent ( void   ) 

Definition at line 1128 of file smbus.c.

References FillResponseInt(), lobyte, SMBV_BattStatus, SMBV_ChgCurrent, SMBvar_int, and SMBvariables.

unsigned char SMBR_ChgVoltage ( void   ) 

Definition at line 1136 of file smbus.c.

References FillResponseInt(), lobyte, SMBV_BattStatus, SMBV_ChgVoltage, SMBvar_int, and SMBvariables.

unsigned char SMBR_Current ( void   ) 

Definition at line 1033 of file smbus.c.

References Current1Sec(), FillResponseInt(), SMBV_Current, and SMBvar_int.

unsigned char SMBR_CycleCount ( void   ) 

Definition at line 1155 of file smbus.c.

References FillResponseInt(), SMBV_CycleCount, and SMBvar_int.

unsigned char SMBR_DesignCap ( void   ) 

Definition at line 1162 of file smbus.c.

References CAPACITY_MODE, FillResponseInt(), hibyte, PACK_DESIGNCAPC5, PACK_DESIGNCAPMW, SMBV_BattMode, SMBV_DesignCap, SMBvar_int, and SMBvariables.

unsigned char SMBR_DesignVolt ( void   ) 

Definition at line 1177 of file smbus.c.

References FillResponseInt(), PACK_NOMINALV, SMBV_DesignVolt, and SMBvar_int.

unsigned char SMBR_DeviceChem ( void   ) 

Todo:
Modify as needed. __flash char defined in smbus.h

Definition at line 1222 of file smbus.c.

References FillResponseStr().

unsigned char SMBR_DeviceName ( void   ) 

Todo:
Modify as needed. __flash char defined in smbus.h

Definition at line 1215 of file smbus.c.

References FillResponseStr().

unsigned char SMBR_FullChgCap ( void   ) 

Definition at line 1088 of file smbus.c.

References FillResponseInt(), FullChgCap(), SMBV_FullChgCap, and SMBvar_int.

unsigned char SMBR_invalid ( void   ) 

Definition at line 1273 of file smbus.c.

References SMBerr_UnsuptdCommand.

unsigned char SMBR_MaxError ( void   ) 

Definition at line 1053 of file smbus.c.

References FillResponseInt(), SMBV_MaxError, and SMBvar_int.

unsigned char SMBR_MfrAccess ( void   ) 

Definition at line 952 of file smbus.c.

References FillResponseInt(), SMBV_MfrAccess, and SMBvar_int.

unsigned char SMBR_MfrData ( void   ) 

Todo:
Modify as needed. __flash char defined in smbus.h

Definition at line 1229 of file smbus.c.

References FillResponseStr().

unsigned char SMBR_MfrDate ( void   ) 

Todo:
this value is filled in as const by init.

Definition at line 1192 of file smbus.c.

References FillResponseInt(), SMBV_MfrDate, and SMBvar_int.

unsigned char SMBR_MfrName ( void   ) 

Todo:
Modify as needed. __flash char defined in smbus.h

Definition at line 1207 of file smbus.c.

References FillResponseStr().

unsigned char SMBR_Opt1 ( void   ) 

Definition at line 1266 of file smbus.c.

References SMBerr_ReservedCommand.

unsigned char SMBR_Opt2 ( void   ) 

Definition at line 1259 of file smbus.c.

References SMBerr_ReservedCommand.

unsigned char SMBR_Opt3 ( void   ) 

Definition at line 1252 of file smbus.c.

References SMBerr_ReservedCommand.

unsigned char SMBR_Opt4 ( void   ) 

Definition at line 1244 of file smbus.c.

References calibration_state, and FillResponseInt().

unsigned char SMBR_Opt5 ( void   ) 

Todo:
this value is defined as a constant here.

Definition at line 1236 of file smbus.c.

References FillResponseInt().

unsigned char SMBR_RelSOC ( void   ) 

Definition at line 1060 of file smbus.c.

References FillResponseInt(), RelativeSOC(), SMBV_RelSOC, and SMBvar_int.

unsigned char SMBR_RemCap ( void   ) 

Definition at line 1079 of file smbus.c.

References FillResponseInt(), RemainingCap(), SMBV_RemCap, and SMBvar_int.

unsigned char SMBR_RemCapAlm ( void   ) 

Definition at line 960 of file smbus.c.

References FillResponseInt(), SMBV_RemCapAlm, and SMBvar_int.

unsigned char SMBR_RemTimeAlm ( void   ) 

Definition at line 967 of file smbus.c.

References FillResponseInt(), SMBV_RemTimeAlm, and SMBvar_int.

unsigned char SMBR_RunTTE ( void   ) 

Definition at line 1097 of file smbus.c.

References FillResponseInt(), SMBV_RunTTE, SMBvar_int, and TimeToEmpty().

unsigned char SMBR_SerialNo ( void   ) 

Todo:
this value is filled in as const by init.

Definition at line 1199 of file smbus.c.

References FillResponseInt(), SMBV_SerialNo, and SMBvar_int.

unsigned char SMBR_SpecInfo ( void   ) 

Todo:
this value is filled in as const by init.

Definition at line 1185 of file smbus.c.

References FillResponseInt(), SMBV_SpecInfo, and SMBvar_int.

unsigned char SMBR_Temperature ( void   ) 

Definition at line 1015 of file smbus.c.

References FillResponseInt(), GetTemperature(), SMBV_Temperature, and SMBvar_int.

unsigned char SMBR_Voltage ( void   ) 

Definition at line 1024 of file smbus.c.

References FillResponseInt(), GetVoltage(), SMBV_Voltage, and SMBvar_int.

unsigned char SMBW_AtRate ( void   ) 

Definition at line 1432 of file smbus.c.

References lobyte, SMBV_AtRate, SMBV_BattStatus, SMBvar_int, SMBvariables, TW_RxBuf, and TW_RxBufIndex.

unsigned char SMBW_BattMode ( void   ) 

Definition at line 1387 of file smbus.c.

References ALARM_MODE, CAPACITY_MODE, CHARGE_CONTROLLER_ENABLED, CHARGER_MODE, INTERNAL_CHARGE_CONTROLLER, lobyte, PRIMARY_BATTERY, SetAlarmMode, SMBerr_AccessDenied, SMBV_BattMode, SMBvar_int, SMBvariables, TW_RxBuf, and TW_RxBufIndex.

unsigned char SMBW_Invalid ( void   ) 

Definition at line 1477 of file smbus.c.

References SMBerr_AccessDenied.

unsigned char SMBW_MfrAccess ( void   ) 

Definition at line 1360 of file smbus.c.

References lobyte, SMBV_BattStatus, SMBV_MfrAccess, SMBvar_int, SMBvariables, TW_RxBuf, and TW_RxBufIndex.

unsigned char SMBW_Opt1 ( void   ) 

Definition at line 1472 of file smbus.c.

References SMBerr_ReservedCommand.

unsigned char SMBW_Opt2 ( void   ) 

Definition at line 1467 of file smbus.c.

References SMBerr_ReservedCommand.

unsigned char SMBW_Opt3 ( void   ) 

Definition at line 1462 of file smbus.c.

References SMBerr_ReservedCommand.

unsigned char SMBW_Opt4 ( void   ) 

Definition at line 1454 of file smbus.c.

References calibration_state_req, SetCalibRequest, TW_RxBuf, and TW_RxBufIndex.

unsigned char SMBW_Opt5 ( void   ) 

Definition at line 1440 of file smbus.c.

unsigned char SMBW_RemCapAlm ( void   ) 

Definition at line 1369 of file smbus.c.

References lobyte, SMBV_BattStatus, SMBV_RemCapAlm, SMBvar_int, SMBvariables, TW_RxBuf, and TW_RxBufIndex.

unsigned char SMBW_RemTimeAlm ( void   ) 

Definition at line 1378 of file smbus.c.

References lobyte, SMBV_BattStatus, SMBV_RemTimeAlm, SMBvar_int, SMBvariables, TW_RxBuf, and TW_RxBufIndex.

__interrupt void TWI_ISR ( void   ) 

Definition at line 374 of file smbus.c.

References CurrentCmd, HIGHEST_SMB_CMD, lobyte, SCRG, SCRW, SCWG, SCWW, SM_Cmd_Table, SMB_GenBusTimeout, SMB_GotCmdData, SMB_SetUpReply, SMBerr_AccessDenied, SMBerr_BadSize, SMBerr_UnknownError, SMBslave, SMBV_BattStatus, SMBvariables, SMLOCK, Status, TW_IDLE, TW_MCMD_W, TW_MSLA_W, TW_MTxBuf, TW_MTxBufCnt, TW_MTxBufIndex, TW_ReplyData, TW_RxBuf, TW_RxBufCnt, TW_RxBufIndex, TW_TxBuf, TW_TxBufCnt, TW_TxBufIndex, TW_Wait4Cmd, TW_Wait4Data, TW_Wait4RW, TW_Wait4Stop, TWI_CmdFlags, TWISR_state, TWS_RACK, TWS_RCMD, TWS_RDATA, TWS_REPEAT, TWS_RNAK, TWS_RSTOP, TWS_SLA_R, TWS_SLA_W, TWS_START, TWS_TXDATA_ACK, TWS_WRITE_ACK, TXmsgDelete, and UsePEC.

__interrupt void TWICD_ISR ( void   ) 

Definition at line 172 of file smbus.c.

References ChangePowerMode(), hibyte, POWERMODE_ACTIVE, POWERMODE_IDLE, SMBV_BattMode, and SMBvariables.


Variable Documentation

__flash unsigned char crctable[16] = {0,0x07,0x0E,0x90, 0x1c,0x1b,0x12,0x15, 0x38,0x3F,0x36,0x31, 0x24,0x23,0x2A,0x2D}

Definition at line 1569 of file smbus.c.

__flash unsigned char crctable2[16] = {0,0x70,0xE0,0x90, 0xC1,0xB1,0x21,0x51, 0x83,0xF3,0x63,0x13, 0x42,0x32,0xA2,0xD2}

Definition at line 1570 of file smbus.c.

unsigned char CurrentCmd = 0xFF

Definition at line 141 of file smbus.c.

Referenced by SMB_CmdInterpreter(), and TWI_ISR().

ptr2funcUC_V SMB_ReadCmd

Definition at line 1283 of file smbus.c.

Referenced by SMB_CmdInterpreter().

ptr2funcUC_V SMB_WriteCmd

Definition at line 1485 of file smbus.c.

Referenced by SMB_CmdInterpreter().

unsigned char SMLOCK = 0

Definition at line 114 of file smbus.c.

Referenced by SMB_Master(), and TWI_ISR().

unsigned char TEST50US = 0

Definition at line 113 of file smbus.c.

Referenced by Check50uS(), PCINT0_ISR(), and SMB_Master().

unsigned char TW_MTxBuf[8]

Definition at line 116 of file smbus.c.

Referenced by SMB_Master(), and TWI_ISR().

unsigned char TW_MTxBufCnt = 0

Definition at line 117 of file smbus.c.

Referenced by SMB_Master(), and TWI_ISR().

unsigned char TW_MTxBufIndex = 0

Definition at line 118 of file smbus.c.

Referenced by SMB_Master(), and TWI_ISR().

unsigned char TW_RxBuf[10]

Definition at line 126 of file smbus.c.

signed char TW_RxBufCnt = 0

Definition at line 127 of file smbus.c.

unsigned char TW_RxBufIndex = 0

Definition at line 128 of file smbus.c.

unsigned char TW_TxBuf[36]

Definition at line 122 of file smbus.c.

unsigned char TW_TxBufCnt = 0

Definition at line 123 of file smbus.c.

unsigned char TW_TxBufIndex = 0

Definition at line 124 of file smbus.c.

unsigned char TWI_CmdFlags

Definition at line 136 of file smbus.c.

unsigned char TWISR_state = TW_IDLE

Definition at line 370 of file smbus.c.

Referenced by SMB_Master(), SMB_RestoreBus(), and TWI_ISR().

unsigned char TXmsg[4][4]

Definition at line 291 of file smbus.c.

Referenced by MasterInsertMsg(), and SMB_Master().

volatile unsigned char TXmsgHead = 0

Definition at line 292 of file smbus.c.

Referenced by MasterInsertMsg().

volatile unsigned char TXmsgQty = 0

Definition at line 294 of file smbus.c.

Referenced by MasterInsertMsg().

volatile unsigned char TXmsgTail = 0

Definition at line 293 of file smbus.c.

Referenced by SMB_Master().

unsigned char UsePEC = 0

Definition at line 142 of file smbus.c.


Generated on Mon Nov 12 15:59:59 2007 for AVR453 Smart Battery Reference Design by  doxygen 1.5.3