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

Go to the source code of this file.

Classes

struct  Esc
 

Functions

void initEsc (Esc *esc, int hz)
 Initializes the ESC with the given frequency. More...
 
float getEscTemp (const Esc *esc)
 Gets the temperature of the ESC. More...
 
float getEscMotorRevolutions (const Esc *esc)
 Gets the motor revolutions of the ESC. More...
 
void updateEsc (void *esc)
 Updates the ESC data. More...
 
char * toStringEsc (const Esc *esc)
 Converts the Esc structure to a string. More...
 

Function Documentation

◆ getEscMotorRevolutions()

float getEscMotorRevolutions ( const Esc esc)

Gets the motor revolutions of the ESC.

Parameters
escPointer to the Esc structure to query.
Returns
The motor revolutions of the ESC.

Definition at line 23 of file Esc.c.

23 {
24 return esc->motor_revolutions;
25}
float motor_revolutions
Definition: Esc.h:9

◆ getEscTemp()

float getEscTemp ( const Esc esc)

Gets the temperature of the ESC.

Parameters
escPointer to the Esc structure to query.
Returns
The temperature of the ESC.

Definition at line 19 of file Esc.c.

19 {
20 return esc->temp;
21}
float temp
Definition: Esc.h:8
Here is the caller graph for this function:

◆ initEsc()

void initEsc ( Esc esc,
int  hz 
)

Initializes the ESC with the given frequency.

Parameters
escPointer to the Esc structure to initialize.
hzThe frequency in Hertz at which the ESC operates.

Definition at line 5 of file Esc.c.

5 {
6 if (esc != NULL) {
7 // initCANSensor(&esc->base, "Esc", hz, 0);
8 esc->temp = 0.0;
9 esc->motor_revolutions = 0.0;
10 // esc->base.sensor.updateable.update = updateEsc;
11 }
12
13 // initCANSensor(&esc->base, "Esc", hz);
14 esc->temp = 0.0;
15 esc->motor_revolutions = 0.0;
16 // esc->base.sensor.updateable.update = updateEsc;
17}

◆ toStringEsc()

char * toStringEsc ( const Esc esc)

Converts the Esc structure to a string.

Parameters
escPointer to the Esc structure to convert.
Returns
Pointer to the string representation of the Esc structure.

Definition at line 44 of file Esc.c.

44 {
45 static char str[100];
46 // sprintf(str, "%f,%f", esc->temp, esc->motor_revolutions);
47 return str;
48}

◆ updateEsc()

void updateEsc ( void *  esc)

Updates the ESC data.

Parameters
escPointer to the Esc structure to update.

Definition at line 27 of file Esc.c.

27 {
28 Esc* myEsc = (Esc*) esc;
29 // int data = myEsc->base.getData(); // Simplified assumption of data retrieval
30 // myEsc->temp = tempTransferFunctionEsc(data);
31 // myEsc->motor_revolutions = motorRevolutionsTransferFunctionEsc(data);
32 // printf("ESC Temp: %f, Motor Revolutions: %f\n", myEsc->temp, myEsc->motor_revolutions);
33 printf("Implement updateEsc logic\n");
34}
Definition: Esc.h:6