foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
ltc.h File Reference

Headers for the driver for the LTC analog front-end. More...

#include "ltc_defs.h"
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for ltc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TEST_LTC_DECLARE_GET(VARIABLE)   extern void TEST_LTC_Get_##VARIABLE(uint8_t data[4])
 

Functions

void LTC_Trigger (LTC_STATE_s *ltc_state)
 trigger function for the LTC driver state machine. More...
 
LTC_RETURN_TYPE_e LTC_SetStateRequest (LTC_STATE_s *ltc_state, LTC_REQUEST_s statereq)
 sets the current state request of the state variable ltc_state. More...
 
bool LTC_IsFirstMeasurementCycleFinished (LTC_STATE_s *ltc_state)
 gets the measurement initialization status. More...
 
void LTC_SaveVoltages (LTC_STATE_s *ltc_state, uint8_t stringNumber)
 stores the measured voltages in the database. More...
 
void LTC_SaveTemperatures (LTC_STATE_s *ltc_state, uint8_t stringNumber)
 stores the measured temperatures and the measured multiplexer feedbacks in the database. More...
 
void LTC_SaveAllGpioMeasurement (LTC_STATE_s *ltc_state)
 stores the measured GPIOs in the database. More...
 
LTC_REQUEST_s LTC_GetStateRequest (LTC_STATE_s *ltc_state)
 gets the current state request. More...
 
LTC_STATEMACH_e LTC_GetState (LTC_STATE_s *ltc_state)
 gets the current state. More...
 
void LTC_InitializeMonitoringPin (void)
 Sets the transceiver pins to enable LTC6820 IC. More...
 
uint8_t TEST_LTC_CheckReEntrance ()
 
void TEST_LTC_SetFirstMeasurementCycleFinished (LTC_STATE_s *ltc_state)
 
 TEST_LTC_DECLARE_GET (ltc_cmdWRCFG)
 
 TEST_LTC_DECLARE_GET (ltc_cmdWRCFG2)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCFG)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVA)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVB)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVC)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVD)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVE)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVF)
 
 TEST_LTC_DECLARE_GET (ltc_cmdWRCOMM)
 
 TEST_LTC_DECLARE_GET (ltc_cmdSTCOMM)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCOMM)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDAUXA)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDAUXB)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDAUXC)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDAUXD)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_normal_DCP0)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_normal_DCP1)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_filtered_DCP0)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_filtered_DCP1)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_fast_DCP0)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_fast_DCP1)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_fast_DCP0_twocells)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_normal_GPIO1)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_filtered_GPIO1)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_fast_GPIO1)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_normal_GPIO2)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_filtered_GPIO2)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_fast_GPIO2)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_normal_GPIO3)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_filtered_GPIO3)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_fast_GPIO3)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_normal_ALLGPIOS)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_filtered_ALLGPIOS)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADAX_fast_ALLGPIOS)
 
 TEST_LTC_DECLARE_GET (ltc_BC_cmdADOW_PUP_normal_DCP0)
 
 TEST_LTC_DECLARE_GET (ltc_BC_cmdADOW_PDOWN_normal_DCP0)
 
 TEST_LTC_DECLARE_GET (ltc_BC_cmdADOW_PUP_filtered_DCP0)
 
 TEST_LTC_DECLARE_GET (ltc_BC_cmdADOW_PDOWN_filtered_DCP0)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVA_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVB_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVC_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVD_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVE_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVF_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVG_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVH_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdRDCVI_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_cmdADCV_normal_Fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_BC_cmdADOW_PUP_100ms_fuelcell)
 
 TEST_LTC_DECLARE_GET (ltc_BC_cmdADOW_PDOWN_100ms_fuelcell)
 

Variables

LTC_STATE_s ltc_stateBase
 

Detailed Description

Headers for the driver for the LTC analog front-end.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2015-09-01 (date of creation)
Updated
2023-02-03 (date of last update)
Version
v1.5.0
Prefix
LTC

Definition in file ltc.h.

Macro Definition Documentation

◆ TEST_LTC_DECLARE_GET

#define TEST_LTC_DECLARE_GET (   VARIABLE)    extern void TEST_LTC_Get_##VARIABLE(uint8_t data[4])

this define is used for creating the declaration of a function for variable extraction deviate from style guide in order to make the variable name better recognizable

Definition at line 189 of file ltc.h.

Function Documentation

◆ LTC_GetState()

LTC_STATEMACH_e LTC_GetState ( LTC_STATE_s ltc_state)

gets the current state.

This function is used in the functioning of the LTC state machine.

Parameters
ltc_statestate of the ltc state machine
Returns
current state, taken from LTC_STATEMACH_e

Definition at line 568 of file ltc_6806.c.

◆ LTC_GetStateRequest()

LTC_REQUEST_s LTC_GetStateRequest ( LTC_STATE_s ltc_state)

gets the current state request.

This function is used in the functioning of the LTC state machine.

Parameters
ltc_statestate of the ltc state machine
Returns
retval current state request, taken from LTC_STATE_REQUEST_e

Definition at line 548 of file ltc_6806.c.

Here is the call graph for this function:

◆ LTC_InitializeMonitoringPin()

void LTC_InitializeMonitoringPin ( void  )

Sets the transceiver pins to enable LTC6820 IC.

Definition at line 1748 of file ltc_6806.c.

Here is the call graph for this function:

◆ LTC_IsFirstMeasurementCycleFinished()

bool LTC_IsFirstMeasurementCycleFinished ( LTC_STATE_s ltc_state)

gets the measurement initialization status.

Parameters
ltc_statestate of the ltc state machine
Returns
true if a first measurement cycle was made, false otherwise

Definition at line 1729 of file ltc_6806.c.

Here is the call graph for this function:

◆ LTC_SaveAllGpioMeasurement()

void LTC_SaveAllGpioMeasurement ( LTC_STATE_s ltc_state)

stores the measured GPIOs in the database.

This function loops through the data of all modules in the LTC daisy-chain that are stored in the ltc_allgpiovoltage buffer and writes them in the database. At each write iteration, the variable named "state" and related to voltages in the database is incremented.

Parameters
ltc_statestate of the ltc state machine

Definition at line 507 of file ltc_6806.c.

◆ LTC_SaveTemperatures()

void LTC_SaveTemperatures ( LTC_STATE_s ltc_state,
uint8_t  stringNumber 
)

stores the measured temperatures and the measured multiplexer feedbacks in the database.

This function loops through the temperature and multiplexer feedback data of all modules in the LTC daisy-chain that are stored in the LTC_MultiplexerVoltages buffer and writes them in the database. At each write iteration, the variables named "state" and related to temperatures and multiplexer feedbacks in the database are incremented.

Parameters
ltc_statestate of the ltc state machine
stringNumberstring addressed

Definition at line 459 of file ltc_6806.c.

Here is the call graph for this function:

◆ LTC_SaveVoltages()

void LTC_SaveVoltages ( LTC_STATE_s ltc_state,
uint8_t  stringNumber 
)

stores the measured voltages in the database.

This function loops through the data of all modules in the LTC daisy-chain that are stored in the LTC_CellVoltages buffer and writes them in the database. At each write iteration, the variable named "state" and related to voltages in the database is incremented.

Parameters
ltc_statestate of the ltc state machine
stringNumberstring addressed

Definition at line 399 of file ltc_6806.c.

Here is the call graph for this function:

◆ LTC_SetStateRequest()

LTC_RETURN_TYPE_e LTC_SetStateRequest ( LTC_STATE_s ltc_state,
LTC_REQUEST_s  statereq 
)

sets the current state request of the state variable ltc_state.

This function is used to make a state request to the state machine,e.g, start voltage measurement, read result of voltage measurement, re-initialization It calls LTC_CheckStateRequest() to check if the request is valid. The state request is rejected if is not valid. The result of the check is returned immediately, so that the requester can act in case it made a non-valid state request.

Parameters
ltc_statestate of the ltc state machine
statereqstate request to set
Returns
current state request, taken from LTC_STATE_REQUEST_e

Definition at line 606 of file ltc_6806.c.

Here is the call graph for this function:

◆ LTC_Trigger()

void LTC_Trigger ( LTC_STATE_s ltc_state)

trigger function for the LTC driver state machine.

This function contains the sequence of events in the LTC state machine. It must be called time-triggered, every 1ms.

Definition at line 621 of file ltc_6806.c.

Here is the call graph for this function:

◆ TEST_LTC_CheckReEntrance()

uint8_t TEST_LTC_CheckReEntrance ( )

◆ TEST_LTC_DECLARE_GET() [1/51]

TEST_LTC_DECLARE_GET ( ltc_BC_cmdADOW_PDOWN_100ms_fuelcell  )

◆ TEST_LTC_DECLARE_GET() [2/51]

TEST_LTC_DECLARE_GET ( ltc_BC_cmdADOW_PDOWN_filtered_DCP0  )

◆ TEST_LTC_DECLARE_GET() [3/51]

TEST_LTC_DECLARE_GET ( ltc_BC_cmdADOW_PDOWN_normal_DCP0  )

◆ TEST_LTC_DECLARE_GET() [4/51]

TEST_LTC_DECLARE_GET ( ltc_BC_cmdADOW_PUP_100ms_fuelcell  )

◆ TEST_LTC_DECLARE_GET() [5/51]

TEST_LTC_DECLARE_GET ( ltc_BC_cmdADOW_PUP_filtered_DCP0  )

◆ TEST_LTC_DECLARE_GET() [6/51]

TEST_LTC_DECLARE_GET ( ltc_BC_cmdADOW_PUP_normal_DCP0  )

◆ TEST_LTC_DECLARE_GET() [7/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_fast_ALLGPIOS  )

◆ TEST_LTC_DECLARE_GET() [8/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_fast_GPIO1  )

◆ TEST_LTC_DECLARE_GET() [9/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_fast_GPIO2  )

◆ TEST_LTC_DECLARE_GET() [10/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_fast_GPIO3  )

◆ TEST_LTC_DECLARE_GET() [11/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_filtered_ALLGPIOS  )

◆ TEST_LTC_DECLARE_GET() [12/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_filtered_GPIO1  )

◆ TEST_LTC_DECLARE_GET() [13/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_filtered_GPIO2  )

◆ TEST_LTC_DECLARE_GET() [14/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_filtered_GPIO3  )

◆ TEST_LTC_DECLARE_GET() [15/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_normal_ALLGPIOS  )

◆ TEST_LTC_DECLARE_GET() [16/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_normal_GPIO1  )

◆ TEST_LTC_DECLARE_GET() [17/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_normal_GPIO2  )

◆ TEST_LTC_DECLARE_GET() [18/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADAX_normal_GPIO3  )

◆ TEST_LTC_DECLARE_GET() [19/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_fast_DCP0  )

◆ TEST_LTC_DECLARE_GET() [20/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_fast_DCP0_twocells  )

◆ TEST_LTC_DECLARE_GET() [21/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_fast_DCP1  )

◆ TEST_LTC_DECLARE_GET() [22/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_filtered_DCP0  )

◆ TEST_LTC_DECLARE_GET() [23/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_filtered_DCP1  )

◆ TEST_LTC_DECLARE_GET() [24/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_normal_DCP0  )

◆ TEST_LTC_DECLARE_GET() [25/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_normal_DCP1  )

◆ TEST_LTC_DECLARE_GET() [26/51]

TEST_LTC_DECLARE_GET ( ltc_cmdADCV_normal_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [27/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDAUXA  )

◆ TEST_LTC_DECLARE_GET() [28/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDAUXB  )

◆ TEST_LTC_DECLARE_GET() [29/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDAUXC  )

◆ TEST_LTC_DECLARE_GET() [30/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDAUXD  )

◆ TEST_LTC_DECLARE_GET() [31/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCFG  )

◆ TEST_LTC_DECLARE_GET() [32/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCOMM  )

◆ TEST_LTC_DECLARE_GET() [33/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVA  )

◆ TEST_LTC_DECLARE_GET() [34/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVA_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [35/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVB  )

◆ TEST_LTC_DECLARE_GET() [36/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVB_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [37/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVC  )

◆ TEST_LTC_DECLARE_GET() [38/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVC_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [39/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVD  )

◆ TEST_LTC_DECLARE_GET() [40/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVD_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [41/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVE  )

◆ TEST_LTC_DECLARE_GET() [42/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVE_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [43/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVF  )

◆ TEST_LTC_DECLARE_GET() [44/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVF_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [45/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVG_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [46/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVH_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [47/51]

TEST_LTC_DECLARE_GET ( ltc_cmdRDCVI_Fuelcell  )

◆ TEST_LTC_DECLARE_GET() [48/51]

TEST_LTC_DECLARE_GET ( ltc_cmdSTCOMM  )

◆ TEST_LTC_DECLARE_GET() [49/51]

TEST_LTC_DECLARE_GET ( ltc_cmdWRCFG  )

◆ TEST_LTC_DECLARE_GET() [50/51]

TEST_LTC_DECLARE_GET ( ltc_cmdWRCFG2  )

◆ TEST_LTC_DECLARE_GET() [51/51]

TEST_LTC_DECLARE_GET ( ltc_cmdWRCOMM  )

◆ TEST_LTC_SetFirstMeasurementCycleFinished()

void TEST_LTC_SetFirstMeasurementCycleFinished ( LTC_STATE_s ltc_state)

Definition at line 1774 of file ltc_6806.c.

Here is the call graph for this function:

Variable Documentation

◆ ltc_stateBase

LTC_STATE_s ltc_stateBase
extern

This variable contains the internal state of the LTC state machine.

Definition at line 139 of file ltc_6806.c.