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 "../../../Inc/Utils/Updateable.h"
#include "../../../Inc/Utils/Common.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...
 
int updateIMD (Updateable *updateable)
 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 27 of file Imd.c.

27 {
28 IMDValues* IMD = (IMDValues*) imdValues;
29 return IMD->IMDStatus;
30}
@ 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 42 of file Imd.c.

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

◆ 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 32 of file Imd.c.

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

◆ 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 37 of file Imd.c.

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

◆ 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 6 of file Imd.c.

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

◆ updateIMD()

int updateIMD ( Updateable updateable)

Updates the IMD values.

Parameters
updateablePointer to the Updateable structure to update.

Definition at line 16 of file Imd.c.

16 {
17 //TODO: Implement logic to determine IMD status
18 /*if (something){
19 set IMD_ERROR;
20 } else if (something){
21 set IMD_START;
22 } else {*/
23 // set IMD_OK
24 return _FAILURE;
25}
#define _FAILURE
Definition: Common.h:6
Here is the caller graph for this function: