PER Firmware
Loading...
Searching...
No Matches
lv_batt.h File Reference

LV battery voltage, current, and state of charge monitoring. More...

#include <stdint.h>
#include "main.h"
#include "can_library/generated/PDU.h"
#include "lv_soc_params.h"
Include dependency graph for lv_batt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static float lv_batt_adc_to_voltage (uint16_t adc_value)
 
static float lv_batt_adc_to_current (uint16_t adc_value)
 
void lv_batt_init (void)
 
void lv_batt_periodic (void)
 

Variables

static constexpr float LV_BATT_VS_R1_OHMS = 47000.0f
 
static constexpr float LV_BATT_VS_R2_OHMS = 3400.0f
 
static constexpr float LV_BATT_VS_DIVIDER_GAIN = LV_BATT_VS_R2_OHMS / (LV_BATT_VS_R1_OHMS + LV_BATT_VS_R2_OHMS)
 
static constexpr float LV_BATT_CS_SHUNT_OHMS = 0.002f
 
static constexpr float LV_BATT_CS_AMP_GAIN = 100.0f
 
static constexpr float LV_BATT_MAX_VOLTAGE_V = ADC_VREF_V / LV_BATT_VS_DIVIDER_GAIN
 
static constexpr float LV_BATT_MAX_CURRENT_A = ADC_VREF_V / (LV_BATT_CS_SHUNT_OHMS * LV_BATT_CS_AMP_GAIN)
 
static constexpr float LV_BATT_PACK_SERIES = 7.0f
 
static constexpr float LV_BATT_PACK_PARALLEL = 3.0f
 
static constexpr uint32_t LV_BATT_TASK_PERIOD_MS = 20
 

Detailed Description

LV battery voltage, current, and state of charge monitoring.

Author
Millan Kumar (kumar.nosp@m.798@.nosp@m.purdu.nosp@m.e.ed.nosp@m.u)
Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)

Function Documentation

◆ lv_batt_adc_to_current()

static float lv_batt_adc_to_current ( uint16_t adc_value)
inlinestatic
Here is the caller graph for this function:

◆ lv_batt_adc_to_voltage()

static float lv_batt_adc_to_voltage ( uint16_t adc_value)
inlinestatic
Here is the caller graph for this function:

◆ lv_batt_init()

void lv_batt_init ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lv_batt_periodic()

void lv_batt_periodic ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ LV_BATT_CS_AMP_GAIN

float LV_BATT_CS_AMP_GAIN = 100.0f
staticconstexpr

◆ LV_BATT_CS_SHUNT_OHMS

float LV_BATT_CS_SHUNT_OHMS = 0.002f
staticconstexpr

◆ LV_BATT_MAX_CURRENT_A

float LV_BATT_MAX_CURRENT_A = ADC_VREF_V / (LV_BATT_CS_SHUNT_OHMS * LV_BATT_CS_AMP_GAIN)
staticconstexpr

◆ LV_BATT_MAX_VOLTAGE_V

float LV_BATT_MAX_VOLTAGE_V = ADC_VREF_V / LV_BATT_VS_DIVIDER_GAIN
staticconstexpr

◆ LV_BATT_PACK_PARALLEL

float LV_BATT_PACK_PARALLEL = 3.0f
staticconstexpr

◆ LV_BATT_PACK_SERIES

float LV_BATT_PACK_SERIES = 7.0f
staticconstexpr

◆ LV_BATT_TASK_PERIOD_MS

uint32_t LV_BATT_TASK_PERIOD_MS = 20
staticconstexpr

◆ LV_BATT_VS_DIVIDER_GAIN

float LV_BATT_VS_DIVIDER_GAIN = LV_BATT_VS_R2_OHMS / (LV_BATT_VS_R1_OHMS + LV_BATT_VS_R2_OHMS)
staticconstexpr

◆ LV_BATT_VS_R1_OHMS

float LV_BATT_VS_R1_OHMS = 47000.0f
staticconstexpr

◆ LV_BATT_VS_R2_OHMS

float LV_BATT_VS_R2_OHMS = 3400.0f
staticconstexpr