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

Go to the source code of this file.

Functions

void initSteeringColumn (SteeringColumn *sc, int hz, int channel, float zeroOffset)
 Initializes the SteeringColumn sensor with the given frequency, channel, and zero offset. More...
 
float getSteeringColumnRotationAngle (SteeringColumn *sc)
 Gets the current rotation angle of the steering column. More...
 
void updateSteeringColumn (void *sc)
 Updates the SteeringColumn data. More...
 
float transferFunctionSteeringColumn (float rawVal)
 Converts raw steering column data to a meaningful rotation angle. More...
 

Function Documentation

◆ getSteeringColumnRotationAngle()

float getSteeringColumnRotationAngle ( SteeringColumn sc)

Gets the current rotation angle of the steering column.

Parameters
scPointer to the SteeringColumn structure to query.
Returns
The current rotation angle of the steering column.

Definition at line 12 of file SteeringColumn.c.

12 {
13 return sc->rotation_angle;
14}
float rotation_angle
Definition: SteeringColumn.h:8

◆ initSteeringColumn()

void initSteeringColumn ( SteeringColumn sc,
int  hz,
int  channel,
float  zeroOffset 
)

Initializes the SteeringColumn sensor with the given frequency, channel, and zero offset.

Parameters
scPointer to the SteeringColumn structure to initialize.
hzThe frequency in Hertz at which the sensor operates.
channelThe analog channel the sensor is connected to.
zeroOffsetThe zero offset value for the steering column.

Definition at line 5 of file SteeringColumn.c.

5 {
6 initAnalogSensor(&sc->base, "SteeringColumn", hz, channel);
7 sc->rotation_angle = -1;
8 sc->zero_offset = zeroOffset;
10}
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 updateSteeringColumn(void *sc)
Updates the SteeringColumn data.
Sensor sensor
Definition: AnalogSensor.h:28
Updateable updateable
Definition: Sensor.h:15
AnalogSensor base
Definition: SteeringColumn.h:7
void(* update)(void *self)
Definition: Updateable.h:26
Here is the call graph for this function:

◆ transferFunctionSteeringColumn()

float transferFunctionSteeringColumn ( float  rawVal)

Converts raw steering column data to a meaningful rotation angle.

Parameters
rawValThe raw data from the steering column sensor.
Returns
The converted rotation angle.

Definition at line 24 of file SteeringColumn.c.

24 {
25 // Placeholder for actual transfer function
26 printf("Implement SteeringColumn::transfer_function\n");
27 return rawVal;
28}
Here is the caller graph for this function:

◆ updateSteeringColumn()

void updateSteeringColumn ( void *  sc)

Updates the SteeringColumn data.

Parameters
scPointer to the SteeringColumn structure to update.

Definition at line 16 of file SteeringColumn.c.

16 {
17 SteeringColumn *steeringColumn = (SteeringColumn *)sc;
18 float rawData = 0.0f; // This should come from sensor read function or simulation
19 printf("Implement SteeringColumn Update.\n");
20 steeringColumn->rotation_angle
21 = transferFunctionSteeringColumn(rawData + steeringColumn->zero_offset);
22}
float transferFunctionSteeringColumn(float rawVal)
Converts raw steering column data to a meaningful rotation angle.
Here is the call graph for this function:
Here is the caller graph for this function: