![]() |
Midnight Sun Firmware
|
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. | |
Pedal library.
| typedef struct PedalCalibrationData 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
| 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
| StatusCode pedal_calib_sample | ( | PedalCalibrationStorage * | calib_storage, |
| PedalCalibrationData * | data, | ||
| PedalState | state, | ||
| GpioAddress * | address | ||
| ) |
Reads data from ADC and calculates appropriate pedal calibration values.
| 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 |