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

Go to the source code of this file.

Classes

struct  MotorController
 

Functions

void initMotorController (MotorController *mc, Esc *esc, App *app)
 Initializes the MotorController with the given ESC and APP. More...
 
float getPedalPosition (const MotorController *mc)
 Gets the pedal position from the MotorController. More...
 
float getMotorTemp (const MotorController *mc)
 Gets the motor temperature from the MotorController. More...
 

Function Documentation

◆ getMotorTemp()

float getMotorTemp ( const MotorController mc)

Gets the motor temperature from the MotorController.

Parameters
mcPointer to the MotorController structure to query.
Returns
The motor temperature, or 0.0 if no ESC is available.

Definition at line 17 of file MotorController.c.

17 {
18 if (mc && mc->esc) {
19 return getEscTemp(mc->esc);
20 }
21 return 0.0; // Return default value if no esc
22}
float getEscTemp(const Esc *esc)
Gets the temperature of the ESC.
Definition: Esc.c:19
Here is the call graph for this function:

◆ getPedalPosition()

float getPedalPosition ( const MotorController mc)

Gets the pedal position from the MotorController.

Parameters
mcPointer to the MotorController structure to query.
Returns
The pedal position, or 0.0 if no APP is available.

Definition at line 10 of file MotorController.c.

10 {
11 if (mc && mc->app) {
12 return getAppPosition(mc->app);
13 }
14 return 0.0; // Return default value if no app
15}
float getAppPosition(App *app)
Gets the current position of the APP.
Definition: App.c:11
Here is the call graph for this function:

◆ initMotorController()

void initMotorController ( MotorController mc,
Esc esc,
App app 
)

Initializes the MotorController with the given ESC and APP.

Parameters
mcPointer to the MotorController structure to initialize.
escPointer to the Esc structure.
appPointer to the App structure.

Definition at line 3 of file MotorController.c.

3 {
4 if (mc != NULL) {
5 mc->esc = esc;
6 mc->app = app;
7 }
8}