Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Classes | Functions | Variables
DigitalSensor.h File Reference
#include "Sensor.h"
#include "../Utils/Constants.h"
#include <stdint.h>
Include dependency graph for DigitalSensor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DigitalSensor
 

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...
 

Variables

uint8_t digital_in_buffer [NUM_DIGITAL_INPUTS]
 

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:

Variable Documentation

◆ digital_in_buffer

uint8_t digital_in_buffer[NUM_DIGITAL_INPUTS]
extern

Definition at line 119 of file main.c.