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

Go to the source code of this file.

Functions

void initIMD (IMDValues *IMD, int hz)
 Initializes the IMD with the specified frequency. More...
 
void updateIMD (void *IMDValues)
 Updates the IMD values. More...
 
int getIMDStatus (void *imdValues, IMDStatus status)
 Gets the status of the IMD. More...
 
float getIsoResistanceNeg (void *imdValues)
 Retrieves the negative isolation resistance value from the given IMD values. More...
 
float getIsoResistancePos (void *imdValues)
 Retrieves the positive isolation resistance value from the IMD values. More...
 
float getIsoResistanceCorrected (void *imdValues)
 Retrieves the positive isolation resistance value from the IMD values. More...
 

Function Documentation

◆ getIMDStatus()

int getIMDStatus ( void *  IMDValues,
IMDStatus  status 
)

Gets the status of the IMD.

FIXME: Update this function to use Updateable ptr

Parameters
IMDValuesA pointer to the structure IMDValues.
statusAn IMDStatus variable to store the retrieved status.
Returns
An integer representing the status of IMD.

Definition at line 25 of file Imd.c.

25 {
26 IMDValues* IMD = (IMDValues*) imdValues;
27 return IMD->IMDStatus;
28}
@ IMD
Definition: Imd.h:13

◆ getIsoResistanceCorrected()

float getIsoResistanceCorrected ( void *  IMDValues)

Retrieves the positive isolation resistance value from the IMD values.

Parameters
IMDValuesPointer to the structure containing IMD values.
Returns
The corrected isolation resistance value.

Definition at line 40 of file Imd.c.

40 {
41 IMDValues* IMD = (IMDValues*) imdValues;
42 return IMD->IsoResistanceCorrected;
43}

◆ getIsoResistanceNeg()

float getIsoResistanceNeg ( void *  IMDValues)

Retrieves the negative isolation resistance value from the given IMD values.

Parameters
IMDValuesPointer to the structure containing IMD values.
Returns
The negative isolation resistance value.

Definition at line 30 of file Imd.c.

30 {
31 IMDValues* IMD = (IMDValues*) imdValues;
32 return IMD->IsoResistanceNeg;
33}

◆ getIsoResistancePos()

float getIsoResistancePos ( void *  IMDValues)

Retrieves the positive isolation resistance value from the IMD values.

Parameters
IMDValuesPointer to the structure containing IMD values.
Returns
The positive isolation resistance value.

Definition at line 35 of file Imd.c.

35 {
36 IMDValues* IMD = (IMDValues*) imdValues;
37 return IMD->IsoResistancePos;
38}

◆ initIMD()

void initIMD ( IMDValues IMD,
int  hz 
)

Initializes the IMD with the specified frequency.

Parameters
IMDPointer to the IMDValues structure to initialize.
hzFrequency in hertz at which the IMD should operate.

Definition at line 4 of file Imd.c.

4 {
5 initExternalSystem(&IMD->base, "IMD", hz, EXTERNAL);
6 IMD->base.system.updateable.update = updateIMD;
7 // IMD->base.system.updateable.status = getIMDStatus; // FIXME: Update getIMDStatus
8 IMD->IMDStatus = IMD_OK;
9 IMD->IsoResistanceNeg = 0;
10 IMD->IsoResistancePos = 0;
11 IMD->IsoResistanceCorrected = 0;
12}
void initExternalSystem(ExternalSystem *external, const char *name, int hz, ExternalType type)
Definition: ExternalSystem.c:3
void updateIMD(void *IMDValues)
Updates the IMD values.
Definition: Imd.c:14
@ IMD_OK
Definition: Imd.h:8
@ EXTERNAL
Definition: System.h:12
Here is the call graph for this function:

◆ updateIMD()

void updateIMD ( void *  IMDValues)

Updates the IMD values.

Parameters
IMDValuesPointer to the IMD values that need to be updated.

Definition at line 14 of file Imd.c.

14 {
15 //TODO: Implement logic to determine IMD status
16 /*if (something){
17 set IMD_ERROR;
18 } else if (something){
19 set IMD_START;
20 } else {*/
21 // set IMD_OK
22 return;
23 }
Here is the caller graph for this function: