DC2100A  1.2.0
Bi-Directional Cell Balancer Using the LTC3300-1 and the LTC6804-2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LTC6804-2_Config.h File Reference

Driver Configuration Header File for LTC6804-2 Multicell Battery Monitors. More...

Go to the source code of this file.

Detailed Description

Driver Configuration Header File for LTC6804-2 Multicell Battery Monitors.

Definition in file LTC6804-2_Config.h.

Macros

#define LT6804_CONFIG_CS   PIN_A5
 Configures CS pin used to communicate with LTC6804-2. Note that code module directly controls CS for wakeup signals. More...
 
#define LTC6804_CONFIG_TIMER   PIC18FXXJ_Timer_Update()
 Configures Free Running Timer used to determine if the LTC6804 needs a LTC6804_TWAKE or LTC6804_TREADY duration wakeup pulse. More...
 
#define LTC6804_CONFIG_TIMER_RESOLUTION   (1L*PIC18FXXJ_TIMER_TICKS_PER_SEC)
 Resolution of LTC6804_CONFIG_TIMER in ticks per second. More...
 
#define LTC6804_CONFIG_DELAY_US(us)   delay_us(us)
 Function for delaying a specified number of us. More...
 
#define LTC6804_CONFIG_NUM_BOARDS   System_Num_Boards
 The number of LTC6804 addresses used in this system. This is used for loops over all available LTC6804s. More...
 
#define LTC6804_CONFIG_GET_BOARD_ADDRESS(board_num)   ((board_num == LTC6804_BROADCAST) ? LTC6804_COMMAND_CODE_BROADCAST_ADDRESS : System_Address_Table[board_num] | LTC6804_COMMAND_CODE_ADDRESSED_BIT)
 Returns the physical address for a LTC6804 in the system given its logical address. More...
 
#define LTC6804_CONFIG_SPI_SET_BAUD(baud_khz)   PIC18FXXJ_SPI_Set_Baud(baud_khz)
 Configures the function called to set the baud rate to the LTC6804. More...
 
#define LTC6804_CONFIG_SPI_BUFFER_RECEIVE_START(buffer, num_bytes)   PIC18FXXJ_SPI_Buffer_Receive_Start(buffer, num_bytes)
 Note - This LTC6804 driver is designed for a buffered SPI peripheral (DMA, Interrupt driven, etc) to maximize throughput. More...
 
#define LTC6804_CONFIG_SPI_BUFFER_SEND_START(buffer, num_bytes)   PIC18FXXJ_SPI_Buffer_Send_Start(buffer, num_bytes)
 Configures the function called to start sending a string of bytes to the LTC6804. More...
 
#define LTC6804_CONFIG_SPI_BUFFER_DONE()   PIC18FXXJ_SPI_Buffer_Done()
 Configures the function called to check if the last SPI communication to LTC6804 is done and SPI is ready to send/receive more data. More...
 
#define LTC6804_CONFIG_SPI_BUFFER_RECEIVE_BYTES_AVAILABLE(buffer)   PIC18FXXJ_SPI_Buffer_Receive_Bytes_Available(buffer)
 Configures the function called to return the number of bytes received in a buffer. More...
 
#define LTC6804_CONFIG_ERROR_CRC(address, command, data_ptr, num_bytes)
 Configures interface through which LTC6804-2 driver module reports its CRC errors. More...
 

Macro Definition Documentation

#define LT6804_CONFIG_CS   PIN_A5

Configures CS pin used to communicate with LTC6804-2. Note that code module directly controls CS for wakeup signals.

Definition at line 88 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_DELAY_US (   us)    delay_us(us)

Function for delaying a specified number of us.

This is used to generate wakeup signals for LTC6804.

  • Parameters
    • us: The number of us to delay.

Definition at line 99 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_ERROR_CRC (   address,
  command,
  data_ptr,
  num_bytes 
)
Value:
{ \
int8 temp_data[ERROR_DATA_SIZE]; \
int8 byte_num; \
temp_data[0] = address; \
temp_data[1] = UPPER_BYTE(command); \
temp_data[2] = LOWER_BYTE(command); \
for (byte_num = 3; byte_num < MIN(num_bytes + 3, ERROR_DATA_SIZE); byte_num++) \
{ \
temp_data[byte_num] = data_ptr[byte_num - 3]; \
} \
Error_Data_Set(ERROR_CODE_LTC6804_CRC, temp_data, num_bytes + 3); \
}

Configures interface through which LTC6804-2 driver module reports its CRC errors.

  • Parameters
    • address: The logical address for the PCB containing this LTC6804-2 IC.
    • command: LTC6804 Command which generated CRC error.
    • data_ptr: Pointer to bytes read from LTC6804-2.
    • num_bytes: Number of bytes to be read via SPI.
  • Usage Examples
    • Example 1: If DC2100A Error.c/.h code module is defined for a system, framing the data and passing to that error reporting module would be here.
    • Example 2: if stdout is defined for a system, this macro would format the data into a printf() statement.
    • Example 3: If LTC6804-2 CRC errors are to be ignored, this macro could be defined as blank.

Definition at line 151 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_GET_BOARD_ADDRESS (   board_num)    ((board_num == LTC6804_BROADCAST) ? LTC6804_COMMAND_CODE_BROADCAST_ADDRESS : System_Address_Table[board_num] | LTC6804_COMMAND_CODE_ADDRESSED_BIT)

Returns the physical address for a LTC6804 in the system given its logical address.

Definition at line 105 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_NUM_BOARDS   System_Num_Boards

The number of LTC6804 addresses used in this system. This is used for loops over all available LTC6804s.

Definition at line 102 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_SPI_BUFFER_DONE ( )    PIC18FXXJ_SPI_Buffer_Done()

Configures the function called to check if the last SPI communication to LTC6804 is done and SPI is ready to send/receive more data.

Definition at line 132 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_SPI_BUFFER_RECEIVE_BYTES_AVAILABLE (   buffer)    PIC18FXXJ_SPI_Buffer_Receive_Bytes_Available(buffer)

Configures the function called to return the number of bytes received in a buffer.

  • Parameters
    • buffer: Pointer where the received bytes are being stored.

Definition at line 138 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_SPI_BUFFER_RECEIVE_START (   buffer,
  num_bytes 
)    PIC18FXXJ_SPI_Buffer_Receive_Start(buffer, num_bytes)

Note - This LTC6804 driver is designed for a buffered SPI peripheral (DMA, Interrupt driven, etc) to maximize throughput.

If a simple, non-buffered SPI driver is all that's available, while loops will need to be incorporated in these defines. Configures the function called to start receiving a string of bytes to the LTC6804.

  • Parameters
    • buffer: Pointer where to store the received bytes.
    • num_bytes: The number of bytes to receive.

Definition at line 121 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_SPI_BUFFER_SEND_START (   buffer,
  num_bytes 
)    PIC18FXXJ_SPI_Buffer_Send_Start(buffer, num_bytes)

Configures the function called to start sending a string of bytes to the LTC6804.

  • Parameters
    • buffer: Pointer to the bytes to send.
    • num_bytes: The number of bytes to send.

Definition at line 128 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_SPI_SET_BAUD (   baud_khz)    PIC18FXXJ_SPI_Set_Baud(baud_khz)

Configures the function called to set the baud rate to the LTC6804.

This is used to control the baud rate of the I2C and SPI Buses implemented with the LTC6804 GPIO

  • Parameters
    • baud_khz: The baud rate in kHz.

Definition at line 111 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_TIMER   PIC18FXXJ_Timer_Update()

Configures Free Running Timer used to determine if the LTC6804 needs a LTC6804_TWAKE or LTC6804_TREADY duration wakeup pulse.

Definition at line 91 of file LTC6804-2_Config.h.

#define LTC6804_CONFIG_TIMER_RESOLUTION   (1L*PIC18FXXJ_TIMER_TICKS_PER_SEC)

Resolution of LTC6804_CONFIG_TIMER in ticks per second.

Definition at line 94 of file LTC6804-2_Config.h.