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

Go to the source code of this file.

Functions

void initDigitalSensor (DigitalSensor *digitalSensor, const char *name, int hz, int port, void *child)
 Initializes a digital sensor with the given parameters. More...
 
int getDigitalSensorReading (DigitalSensor *digitalSensor)
 Gets the reading from the digital sensor. More...
 

Function Documentation

◆ getDigitalSensorReading()

int getDigitalSensorReading ( DigitalSensor digitalsensor)

Gets the reading from the digital sensor.

Parameters
digitalsensorPointer to the Sensor structure to get the reading from.
Returns
int The reading from the digital sensor.

Definition at line 10 of file DigitalSensor.c.

10 {
11 return digital_in_buffer[digitalSensor->port];
12}
uint8_t digital_in_buffer[NUM_DIGITAL_INPUTS]
Definition: main.c:119
Here is the caller graph for this function:

◆ initDigitalSensor()

void initDigitalSensor ( DigitalSensor digitalsensor,
const char *  name,
int  hz,
int  port,
void *  child 
)

Initializes a digital sensor with the given parameters.

Parameters
digitalsensorPointer to the Sensor structure to initialize.
namePointer to a string containing the name of the sensor.
hzThe frequency in Hertz at which the sensor operates.
portLocation of the digital sensor on board.
childPointer to the child struct.

Definition at line 3 of file DigitalSensor.c.

4 {
5 initSensor(&digitalSensor->sensor, name, hz, s_DIGITAL, digitalSensor);
6 digitalSensor->port = port;
7 digitalSensor->child = child;
8}
@ s_DIGITAL
Definition: Sensor.h:11
void initSensor(Sensor *sensor, const char *name, int hz, SensorType type, void *child)
Initializes a sensor with the given parameters.
Definition: Sensor.c:4
Here is the call graph for this function:
Here is the caller graph for this function: