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

Go to the source code of this file.

Functions

void initTemperature (Temperature *temp, int hz, int channel)
 Initializes the Temperature sensor with the given frequency and channel. More...
 
void updateTemperature (void *temp)
 Updates the Temperature data. More...
 
double getTemperatureCelsius (Temperature *temp)
 Gets the current temperature in Celsius. More...
 
double getTemperatureFahrenheit (Temperature *temp)
 Gets the current temperature in Fahrenheit. More...
 
double transferFunction (Temperature *temp, int rawVal)
 Converts raw temperature data to a meaningful temperature value. More...
 

Function Documentation

◆ getTemperatureCelsius()

double getTemperatureCelsius ( Temperature temp)

Gets the current temperature in Celsius.

Parameters
tempPointer to the Temperature structure to query.
Returns
The current temperature in Celsius.

Definition at line 15 of file Temperature.c.

15 {
16 return temp->degrees;
17}
double degrees
Definition: Temperature.h:8

◆ getTemperatureFahrenheit()

double getTemperatureFahrenheit ( Temperature temp)

Gets the current temperature in Fahrenheit.

Parameters
tempPointer to the Temperature structure to query.
Returns
The current temperature in Fahrenheit.

Definition at line 19 of file Temperature.c.

19 {
20 return temp->degrees * 9.0 / 5.0 + 32;
21}
Here is the caller graph for this function:

◆ initTemperature()

void initTemperature ( Temperature temp,
int  hz,
int  channel 
)

Initializes the Temperature sensor with the given frequency and channel.

Parameters
tempPointer to the Temperature structure to initialize.
hzThe frequency in Hertz at which the sensor operates.
channelThe analog channel the sensor is connected to.

Definition at line 3 of file Temperature.c.

3 {
4 initAnalogSensor(&temp->base, "Temperature", hz, channel);
6 temp->degrees = 0;
7}
void initAnalogSensor(AnalogSensor *analogSensor, const char *name, int hz, int channel)
Initializes an analog sensor and configures the corresponding GPIO pin.
Definition: AnalogSensor.c:44
void updateTemperature(void *temp)
Updates the Temperature data.
Definition: Temperature.c:9
Sensor sensor
Definition: AnalogSensor.h:28
Updateable updateable
Definition: Sensor.h:15
AnalogSensor base
Definition: Temperature.h:7
void(* update)(void *self)
Definition: Updateable.h:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ transferFunction()

double transferFunction ( Temperature temp,
int  rawValue 
)

Converts raw temperature data to a meaningful temperature value.

Parameters
tempPointer to the Temperature structure.
rawValThe raw data from the temperature sensor.
Returns
The converted temperature value.

Definition at line 23 of file Temperature.c.

23 {
24 return 0.0;
25}
Here is the caller graph for this function:

◆ updateTemperature()

void updateTemperature ( void *  temp)

Updates the Temperature data.

Parameters
tempPointer to the Temperature structure to update.

Definition at line 9 of file Temperature.c.

9 {
10 printf("Implement Temperature::update\n");
11 Temperature *myTemp = (Temperature *)temp;
12 myTemp->degrees = transferFunction(temp, 0);
13}
double transferFunction(Temperature *temp, int rawVal)
Converts raw temperature data to a meaningful temperature value.
Definition: Temperature.c:23
Here is the call graph for this function:
Here is the caller graph for this function: