Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Functions
Accumulator.c File Reference
#include "../../../Inc/Systems/External/Accumulator.h"
Include dependency graph for Accumulator.c:

Go to the source code of this file.

Functions

void initAccumulator (Accumulator *acc, Bms *bms)
 Initializes the accumulator with the given BMS and IMD. More...
 
void setAccumulatorState (Accumulator *acc, CHARGE_STATE state)
 Sets the state of the accumulator. More...
 
CHARGE_STATE getAccumulatorState (const Accumulator *acc)
 Gets the current state of the accumulator. More...
 

Function Documentation

◆ getAccumulatorState()

CHARGE_STATE getAccumulatorState ( const Accumulator acc)

Gets the current state of the accumulator.

Parameters
accPointer to the Accumulator structure to query.
Returns
The current charge state of the accumulator, or standby if not initialized.

Definition at line 16 of file Accumulator.c.

16 {
17 if (acc != NULL) {
18 return acc->state;
19 }
20 return standby; // Default if not initialized
21}
@ standby
Definition: Accumulator.h:10
CHARGE_STATE state
Definition: Accumulator.h:15

◆ initAccumulator()

void initAccumulator ( Accumulator acc,
Bms bms 
)

Initializes the accumulator with the given BMS and IMD.

Parameters
accPointer to the Accumulator structure to initialize.
bmsPointer to the Bms structure.
imdPointer to the Imd structure.

Definition at line 3 of file Accumulator.c.

3 {
4 if (acc != NULL) {
5 acc->bms = bms;
6 acc->state = standby; // Default state
7 }
8}

◆ setAccumulatorState()

void setAccumulatorState ( Accumulator acc,
CHARGE_STATE  state 
)

Sets the state of the accumulator.

Parameters
accPointer to the Accumulator structure to update.
stateThe desired charge state to set.

Definition at line 10 of file Accumulator.c.

10 {
11 if (acc != NULL) {
12 acc->state = state;
13 }
14}