Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
SteeringColumn.c
Go to the documentation of this file.
1#include "../../../Inc/Sensors/AnalogSensors/SteeringColumn.h"
2
3#include <stdio.h>
4
5void initSteeringColumn(SteeringColumn* sc, int hz, int channel, float zeroOffset) {
6 initAnalogSensor(&sc->base, "SteeringColumn", hz, channel);
7 sc->rotation_angle = -1;
8 sc->zero_offset = zeroOffset;
10}
11
13 return sc->rotation_angle;
14}
15
16void updateSteeringColumn(void* sc) {
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}
23
24float transferFunctionSteeringColumn(float rawVal) {
25 // Placeholder for actual transfer function
26 printf("Implement SteeringColumn::transfer_function\n");
27 return rawVal;
28}
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
float getSteeringColumnRotationAngle(SteeringColumn *sc)
Gets the current rotation angle of the steering column.
void initSteeringColumn(SteeringColumn *sc, int hz, int channel, float zeroOffset)
Initializes the SteeringColumn sensor with the given frequency, channel, and zero offset.
Definition: SteeringColumn.c:5
float transferFunctionSteeringColumn(float rawVal)
Converts raw steering column data to a meaningful rotation angle.
void updateSteeringColumn(void *sc)
Updates the SteeringColumn data.
Sensor sensor
Definition: AnalogSensor.h:28
Updateable updateable
Definition: Sensor.h:15
float rotation_angle
Definition: SteeringColumn.h:8
AnalogSensor base
Definition: SteeringColumn.h:7
void(* update)(void *self)
Definition: Updateable.h:26