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
Functions
LTC3335.c File Reference

Firmware Driver Code 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 Code 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.c.

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...
 

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.