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

Pedal library. More...

Classes

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_ONE_SHOT   1000U
 The number of data samples we should take when calibrating the pedal.
 
#define NUM_SAMPLES_SINGLE_READ   100U
 

Typedefs

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_single (PedalCalibrationStorage *calib_storage, PedalCalibrationData *data, PedalState state, GpioAddress *address, bool first_sample)
 
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.

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