DC2343A  FW 1.0.2 / GUI 1.0.10
LTC3335 Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter
 All Data Structures Namespaces Files Functions Variables Enumerations Macros Pages
Data Structures | Functions
LTC3335.h File Reference

Firmware Driver Header File for LTC3335 Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter. More...

Go to the source code of this file.

Detailed Description

Firmware Driver Header File for LTC3335 Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter.

This driver was designed to provide the following services to application code:

  1. Perform the basic register commands necessary to access the features of the LTC3335.
  2. Minimize I2C communication in an effort to minimize power consumption.
  3. Use the Counter Test feature of the LTC3335 to provide a real time battery current measurement.

Software correction was not included in this driver due to Program Memory limitations in the PIC16F1459. See the LTC3335.vb file in with the DC2343A GUI source code for an example of software correction of the LTC3335 coulomb count.

Definition in file LTC3335.h.

Data Structures

struct  LTC3335_ALARM_TYPE
 The alarm conditions which cause the LTC3335 to activate the /INT pin. More...
 

Functions

void LTC3335_Init (void)
 Initializes the LTC3335 driver. More...
 
bool_t LTC3335_Set_Voltage (bool_t enabled, LTC3335_OUTPUT_VOLTAGE_TYPE voltage)
 Enables/Disables software control of the LTC3335 output voltage. More...
 
bool_t LTC3335_Get_Voltage (bool_t *enabled, LTC3335_OUTPUT_VOLTAGE_TYPE *voltage)
 Get whether the software control of the LTC3335 output voltage is enabled/disabled. More...
 
bool_t LTC3335_Set_Prescaler (uint8_t prescaler)
 Sets the specified prescaler setting for the LTC3335. More...
 
bool_t LTC3335_Get_Prescaler (uint8_t *prescaler)
 Gets the prescaler setting from the LTC3335. More...
 
bool_t LTC3335_Set_Alarm_Threshold (uint8_t threshold)
 Sets the specified alarm threshold for the LTC3335. More...
 
bool_t LTC3335_Get_Alarm_Threshold (uint8_t *threshold)
 Gets the alarm threshold from the LTC3335. More...
 
bool_t LTC3335_Set_Accumulator (uint8_t accumulator)
 Sets the specified accumulator value for the LTC3335. More...
 
bool_t LTC3335_Get_Accumulator (uint8_t *accumulator)
 Gets the specified accumulator value from the LTC3335. More...
 
bool_t LTC3335_Get_Alarms (LTC3335_ALARM_TYPE *alarms)
 Gets the alarms active from the LTC3335. More...
 
bool_t LTC3335_Clear_Int (void)
 Sends the command to clear the INT condition. More...
 
bool_t LTC3335_Set_Counter_Test (bool_t enabled)
 Enables/Disables the LTC3335 Counter Test feature. More...
 
bool_t LTC3335_Get_Counter_Test (bool_t *enabled)
 Gets whether the LTC3335 Counter Test feature is Enabled/Disabled. More...
 
bool_t LTC3335_Get_Counter_Test_Results (bool_t *enabled, uint32_t *edge_count, uint32_t *time)
 Gets whether the LTC3335 Counter Test feature is Enabled/Disabled. More...
 
bool_t LTC3335_Reset_Counter_Test (void)
 Resets the number of edges and the amount of time stored for the Counter Test feature. More...
 
void LTC3335_Counter_Test_Task (void)
 Task that must be run periodically, for the edges and time to be stored for the LTC3335 Counter Test feature. More...
 

Macros

LTC3335 Driver Properties
#define LTC3335_BAUD_RATE   400
 in kHz, Max Clock Operating Frequency (fSCL from datasheet page 5) More...
 
#define LTC3335_PRESCALER_MAX   15
 the maximum prescaler that be selected for the LTC3335. More...
 
LTC3335 I/O
#define LTC3335_DVCC   DVCC_OUT_PIN
 DVCC pin must be high for LTC3335 to communicate. More...
 
#define LTC3335_PGOOD   PGOOD_IN_PIN
 PGOOD is high when LTC3335 is in regulation. More...
 
#define LTC3335_IRQ   IRQ_IN_PIN
 IRQ is low when alarm condition is present or has not been cleared. More...
 

Enumerations

Voltage Settings

Options available for setting output voltage via I2C.

enum  LTC3335_OUTPUT_VOLTAGE_TYPE {
  LTC3335_OUTPUT_VOLTAGE_1_8V,
  LTC3335_OUTPUT_VOLTAGE_2_5V,
  LTC3335_OUTPUT_VOLTAGE_2_8V,
  LTC3335_OUTPUT_VOLTAGE_3_0V,
  LTC3335_OUTPUT_VOLTAGE_3_3V,
  LTC3335_OUTPUT_VOLTAGE_3_6V,
  LTC3335_OUTPUT_VOLTAGE_4_5V,
  LTC3335_OUTPUT_VOLTAGE_5_0V,
  LTC3335_NUM_OUTPUT_VOLTAGES
}
 
IPeak Settings

Options available for IPeak setting.

NOTE! This can not be set via I2C. It can only be set with resistors on pins 13-15 of the LTC3335, along with the an appropriately sized inductor. In order to translate accumulator values to coulombs, and Counter Test results to amps, this setting must be known.

enum  LTC3335_IPEAK_CONFIGURATION_TYPE {
  LTC3335_IPEAK_CONFIGURATION_IPEAK_5MA,
  LTC3335_IPEAK_CONFIGURATION_IPEAK_10MA,
  LTC3335_IPEAK_CONFIGURATION_IPEAK_15MA,
  LTC3335_IPEAK_CONFIGURATION_IPEAK_25MA,
  LTC3335_IPEAK_CONFIGURATION_IPEAK_50MA,
  LTC3335_IPEAK_CONFIGURATION_IPEAK_100MA,
  LTC3335_IPEAK_CONFIGURATION_IPEAK_150MA,
  LTC3335_IPEAK_CONFIGURATION_IPEAK_250MA,
  LTC3335_NUM_IPEAK_CONFIGURATIONS
}
 

Function Documentation

bool_t LTC3335_Clear_Int ( void  )

Sends the command to clear the INT condition.

NOTE! Additional registers will also need to be rewritten in order for the INT condition to not be immediately reset.

Returns
TRUE if the LTC3335 communication was successful.

Definition at line 356 of file LTC3335.c.

void LTC3335_Counter_Test_Task ( void  )

Task that must be run periodically, for the edges and time to be stored for the LTC3335 Counter Test feature.

Returns
TRUE if the LTC3335 communication was successful.

Definition at line 454 of file LTC3335.c.

bool_t LTC3335_Get_Accumulator ( uint8_t *  accumulator)

Gets the specified accumulator value from the LTC3335.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
accumulatorThe current LTC3335 accumulator value.

Definition at line 297 of file LTC3335.c.

bool_t LTC3335_Get_Alarm_Threshold ( uint8_t *  threshold)

Gets the alarm threshold from the LTC3335.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
thresholdThe alarm threshold setting being used by the LTC3335.

Definition at line 271 of file LTC3335.c.

bool_t LTC3335_Get_Alarms ( LTC3335_ALARM_TYPE alarms)

Gets the alarms active from the LTC3335.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
alarmsBitmap containing the LTC3335 active alarms.

Definition at line 313 of file LTC3335.c.

bool_t LTC3335_Get_Counter_Test ( bool_t *  enabled)

Gets whether the LTC3335 Counter Test feature is Enabled/Disabled.

Parameters
enabledTRUE if Counter Test is enabled, FALSE is Counter Test is disabled.

Definition at line 408 of file LTC3335.c.

bool_t LTC3335_Get_Counter_Test_Results ( bool_t *  enabled,
uint32_t *  edge_count,
uint32_t *  time 
)

Gets whether the LTC3335 Counter Test feature is Enabled/Disabled.

Gets the number of edges and the amount of time since the Counter Test was last reset, which allows edges/sec to be calculated. The edges/sec is proportional to battery current.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
enabledTRUE if Counter Test is enabled, FALSE is Counter Test is disabled.
edge_countThe number of edges counted since the Counter Test was last reset.
timeThe number of timer ticks since the Counter Test was last reset.

Definition at line 429 of file LTC3335.c.

bool_t LTC3335_Get_Prescaler ( uint8_t *  prescaler)

Gets the prescaler setting from the LTC3335.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
prescalerThe prescaler setting being used by the LTC3335.

Definition at line 244 of file LTC3335.c.

bool_t LTC3335_Get_Voltage ( bool_t *  enabled,
LTC3335_OUTPUT_VOLTAGE_TYPE *  voltage 
)

Get whether the software control of the LTC3335 output voltage is enabled/disabled.

Gets the voltage setting, if software control is enabled.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
enabledTRUE if software control of output voltage is enabled, FALSE is software control is disabled (output voltage set by pins 3-5).
voltageThe output voltage setting if software control is enabled.

Definition at line 195 of file LTC3335.c.

void LTC3335_Init ( void  )

Initializes the LTC3335 driver.

Returns
void

Definition at line 154 of file LTC3335.c.

bool_t LTC3335_Reset_Counter_Test ( void  )

Resets the number of edges and the amount of time stored for the Counter Test feature.

Returns
TRUE if the LTC3335 communication was successful.

Definition at line 442 of file LTC3335.c.

bool_t LTC3335_Set_Accumulator ( uint8_t  accumulator)

Sets the specified accumulator value for the LTC3335.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
accumulatorThe accumulator value to set for the LTC3335.

Definition at line 287 of file LTC3335.c.

bool_t LTC3335_Set_Alarm_Threshold ( uint8_t  threshold)

Sets the specified alarm threshold for the LTC3335.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
thresholdThe alarm threshold to set for the LTC3335.

Definition at line 261 of file LTC3335.c.

bool_t LTC3335_Set_Counter_Test ( bool_t  enabled)

Enables/Disables the LTC3335 Counter Test feature.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
enabledTRUE to enable Counter Test feature, FALSE to disable Counter Test feature.

Definition at line 375 of file LTC3335.c.

bool_t LTC3335_Set_Prescaler ( uint8_t  prescaler)

Sets the specified prescaler setting for the LTC3335.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
prescalerThe prescaler setting to set for the LTC3335.

Definition at line 219 of file LTC3335.c.

bool_t LTC3335_Set_Voltage ( bool_t  enabled,
LTC3335_OUTPUT_VOLTAGE_TYPE  voltage 
)

Enables/Disables software control of the LTC3335 output voltage.

If software control is enabled, the voltage is set to the specified setting.

Returns
TRUE if the LTC3335 communication was successful.
Parameters
enabledTRUE to enable software control of output voltage, FALSE to disable software control (output voltage set by pins 3-5).
voltageThe output voltage setting if software control is enabled.

Definition at line 175 of file LTC3335.c.

Macro Definition Documentation

#define LTC3335_BAUD_RATE   400

in kHz, Max Clock Operating Frequency (fSCL from datasheet page 5)

Definition at line 92 of file LTC3335.h.

#define LTC3335_DVCC   DVCC_OUT_PIN

DVCC pin must be high for LTC3335 to communicate.

Definition at line 98 of file LTC3335.h.

#define LTC3335_IRQ   IRQ_IN_PIN

IRQ is low when alarm condition is present or has not been cleared.

IRQ also toggle during Counter Test.

Definition at line 100 of file LTC3335.h.

#define LTC3335_PGOOD   PGOOD_IN_PIN

PGOOD is high when LTC3335 is in regulation.

Definition at line 99 of file LTC3335.h.

#define LTC3335_PRESCALER_MAX   15

the maximum prescaler that be selected for the LTC3335.

Definition at line 93 of file LTC3335.h.