Important Files

+
|+BQDrv                                                 Driver Subproject Folder
||-BQDrv.cpp                                            Driver Source
||-BQDrv.def                                            Export definitions of .dll
||-BQDrv.reg                                            Driver registry entry: defines filename used for access by application
|
|+DrvTest
||-bq_drv.h                                             Basic #define's for use with BQ driver
||-DrvTest.cpp                                          Example application using BQ driver

Remaining files are visual studio/platform builder support files.


BQDrv:

The CEDDK defined within the AM3517 BSP contains functions to access the I2C bus (inside <sdk_i2c.h>).  
The driver simply wraps these functions and exposes a stream driver interface.  See code documentation for more details.

Platform specific details:
-Depending on your BSP, you will have a different API to the I2C bus.
-Our platform has 3 I2C busses, and we are using bus 2.  This is platform and setup-specific.  

Choices that reflect the behavior of our BQ gauge.
-Slave Address is 0x55 (LOWER 7 bits of this)
-SubAddress mode: we must write an address to the gauge that we are writing to/reading from before we start reading/writing data.  
 This is an 8 bit address, and is implemented by using I2C_SUBADDRESS_MODE_8
-BQD_Read: This function reads the entire dataRAM.  It knows where the dataRAM is located and how large it is.
-BQ_Data: This structure contains the dataRAM variables in the order that they appear in the address space of the gauge.  This way,
 we can copy directly from the gauge in one I2C transaction, and all of the data ends up in the right position.


DrvTest:
This application loads the stream driver interface using file access.

The application loads the file "BQD1:".  This is defined in the BqDrv.reg (filename "BQD").  Since it is the first instance, it is assigned the integer value '1'.

The BQDrv interface exposes only IOCTLs and the Read function.  For most purposes, the Read function should suffice.  Note that we have re-declared the structure that we are reading in to inside of bq_drv.h.

See code documentation for more details.
