Midnight Sun Firmware
Loading...
Searching...
No Matches
pedal_calib.h
1#pragma once
2
3/************************************************************************************************
4 * @file pedal_calib.h
5 *
6 * @brief Header file to define the pedal calibration data
7 *
8 * @date 2025-05-15
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13#include <stdbool.h>
14
15/* Inter-component Headers */
16#include "global_enums.h"
17#include "gpio.h"
18
19/* Intra-component Headers */
20
28#define NUM_SAMPLES 1000
29
34typedef enum {
35 PEDAL_PRESSED = 0,
36 PEDAL_UNPRESSED,
37 NUM_PEDAL_STATES,
39
41typedef struct PedalCalibBlob {
42 PedalCalibrationData throttle_calib;
43 PedalCalibrationData brake_calib;
45
48 uint16_t min_reading;
49 uint16_t max_reading;
50 volatile uint32_t sample_counter;
52
55
PedalCalibBlob global_calib_blob
A global struct that stores the throttle pedal and calibration data.
PedalState
Stores the possible pedal states that the pedal could be in.
Definition: pedal_calib.h:34
StatusCode pedal_calib_sample(PedalCalibrationStorage *calib_storage, PedalCalibrationData *data, PedalState state, GpioAddress *address)
Reads data from ADC and calculates appropriate pedal calibration values.
Definition: pedal_calib.c:26
StatusCode
StatusCodes for various errors.
Definition: status.h:27
Port and pin data.
Definition: network.h:62
Stores pedal calibration data for the break and the throttle pedals.
Definition: pedal_calib.h:41
Stores data that defines when the pedal is full pressed or unpressed.
Definition: main.c:39
A struct that stores the max and min reading along with a sample counter for the data that is being p...
Definition: pedal_calib.h:47