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

Go to the source code of this file.

Classes

struct  SteeringColumn
 

Functions

void initSteeringColumn (SteeringColumn *steeringColumn, int hz, int channel, float zeroOffset)
 Initializes the SteeringColumn sensor with the given frequency, channel, and zero offset. More...
 
float getSteeringColumnRotationAngle (SteeringColumn *steeringColumn)
 Gets the current rotation angle of the steering column. More...
 
int updateSteeringColumn (SteeringColumn *steeringColumn)
 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 steeringColumn)

Gets the current rotation angle of the steering column.

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

Definition at line 13 of file SteeringColumn.c.

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

◆ initSteeringColumn()

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

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

Parameters
steeringColumnPointer 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 6 of file SteeringColumn.c.

6 {
7 initAnalogSensor(&steeringColumn->base, "SteeringColumn", hz, channel, steeringColumn);
8 steeringColumn->rotation_angle = -1;
9 steeringColumn->zero_offset = zeroOffset;
11}
void initAnalogSensor(AnalogSensor *analogSensor, const char *name, int hz, int channel, void *child)
Initializes an analog sensor and configures the corresponding GPIO pin.
Definition: AnalogSensor.c:42
int updateSteeringColumn(SteeringColumn *steeringColumn)
Updates the SteeringColumn data.
Sensor sensor
Definition: AnalogSensor.h:23
Updateable updateable
Definition: Sensor.h:15
AnalogSensor base
Definition: SteeringColumn.h:7
int(* update)(struct Updateable *self)
Definition: Updateable.h:27
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 32 of file SteeringColumn.c.

32 {
33 // Placeholder for actual transfer function
34 printf("Implement SteeringColumn::transfer_function\n");
35 return rawVal;
36}
Here is the caller graph for this function:

◆ updateSteeringColumn()

int updateSteeringColumn ( SteeringColumn steeringColumn)

Updates the SteeringColumn data.

Parameters
steeringColumnPointer to the SteeringColumn structure to update.
Returns
_SUCCESS or _FAILURE.

Definition at line 17 of file SteeringColumn.c.

17 {
18 // Check if the pointer is null
19 if (steeringColumn == NULL) {
20 fprintf(stderr, "Error: Null pointer passed to updateSteeringColumn\n");
21 return _FAILURE;
22 }
23
24 float rawData = 0.0f; // This should come from sensor read function or simulation
25 printf("Implement SteeringColumn Update.\n");
26 steeringColumn->rotation_angle
27 = transferFunctionSteeringColumn(rawData + steeringColumn->zero_offset);
28
29 return _SUCCESS;
30}
#define _FAILURE
Definition: Common.h:6
#define _SUCCESS
Definition: Common.h:5
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: