Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
Accumulator.h File Reference
#include "BMS.h"
#include "Imd.h"
Include dependency graph for Accumulator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Accumulator
 

Enumerations

enum  CHARGE_STATE { charge , discharge , standby }
 

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

Enumeration Type Documentation

◆ CHARGE_STATE

Enumerator
charge 
discharge 
standby 

Definition at line 7 of file Accumulator.h.

7 {
8 charge,
CHARGE_STATE
Definition: Accumulator.h:7
@ standby
Definition: Accumulator.h:10
@ discharge
Definition: Accumulator.h:9
@ charge
Definition: Accumulator.h:8

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