Midnight Sun Firmware
Loading...
Searching...
No Matches
Pedal

Pedal library. More...

Classes

struct  PedalCalibrationData
 Stores data that defines when the pedal is full pressed or unpressed. More...
 
struct  PedalCalibBlob
 Stores pedal calibration data for the break and the throttle pedals. More...
 
struct  PedalCalibrationStorage
 A struct that stores the max and min reading along with a sample counter for the data that is being passed in from ADC. More...
 

Macros

#define NUM_SAMPLES   1000
 The number of data samples we should take when calibrating the pedal.
 

Typedefs

typedef struct PedalCalibrationData PedalCalibrationData
 Stores data that defines when the pedal is full pressed or unpressed. More...
 
typedef struct PedalCalibBlob PedalCalibBlob
 Stores pedal calibration data for the break and the throttle pedals.
 
typedef struct PedalCalibrationStorage PedalCalibrationStorage
 A struct that stores the max and min reading along with a sample counter for the data that is being passed in from ADC.
 

Enumerations

enum  PedalState { PEDAL_PRESSED = 0 , PEDAL_UNPRESSED , NUM_PEDAL_STATES }
 Stores the possible pedal states that the pedal could be in. More...
 

Functions

StatusCode pedal_calib_sample (PedalCalibrationStorage *calib_storage, PedalCalibrationData *data, PedalState state, GpioAddress *address)
 Reads data from ADC and calculates appropriate pedal calibration values. More...
 

Variables

PedalCalibBlob global_calib_blob
 A global struct that stores the throttle pedal and calibration data.
 

Detailed Description

Pedal library.

Typedef Documentation

◆ PedalCalibrationData

Stores data that defines when the pedal is full pressed or unpressed.

The lower_value is the value at which the pedal is considered fully unpressed whereas the upper_value is the value at which the pedal is fully pressed

Enumeration Type Documentation

◆ PedalState

enum PedalState

Stores the possible pedal states that the pedal could be in.

This struct also has a NUM_PEDAL_STATES enum which stores how many possible pedal states there are

Function Documentation

◆ pedal_calib_sample()

StatusCode pedal_calib_sample ( PedalCalibrationStorage calib_storage,
PedalCalibrationData data,
PedalState  state,
GpioAddress address 
)

Reads data from ADC and calculates appropriate pedal calibration values.

Parameters
calib_storage- A struct for storing the max and min reading while looping through adc reading for a given number of samples
data- A struct that stores the final calculated values for the upper and lower values for the pedal
state- An enum that describes the current state that he pedal is in when calling the function
address- The GPIO address for the adc of the pedal
Returns
STATUS_CODE_OK on success