Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Esc.c
Go to the documentation of this file.
1#include "../../../Inc/Systems/External/Esc.h"
2
3#include <stdio.h> // For printf
4
5void initEsc(Esc* esc, int hz) {
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}
18
19float getEscTemp(const Esc* esc) {
20 return esc->temp;
21}
22
23float getEscMotorRevolutions(const Esc* esc) {
24 return esc->motor_revolutions;
25}
26
27void updateEsc(void* esc) {
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}
35
37 return x + 0.0; // TODO: Implement
38}
39
41 return x + 0.0; // TODO: Implement
42}
43
44char* toStringEsc(const Esc* esc) {
45 static char str[100];
46 // sprintf(str, "%f,%f", esc->temp, esc->motor_revolutions);
47 return str;
48}
float motorRevolutionsTransferFunctionEsc(int x)
Definition: Esc.c:40
void updateEsc(void *esc)
Updates the ESC data.
Definition: Esc.c:27
float getEscMotorRevolutions(const Esc *esc)
Gets the motor revolutions of the ESC.
Definition: Esc.c:23
void initEsc(Esc *esc, int hz)
Initializes the ESC with the given frequency.
Definition: Esc.c:5
float getEscTemp(const Esc *esc)
Gets the temperature of the ESC.
Definition: Esc.c:19
char * toStringEsc(const Esc *esc)
Converts the Esc structure to a string.
Definition: Esc.c:44
float tempTransferFunctionEsc(int x)
Definition: Esc.c:36
Definition: Esc.h:6
float temp
Definition: Esc.h:8
float motor_revolutions
Definition: Esc.h:9