This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
231 additions
and
45 deletions.
There are no files selected for viewing
10 changes: 5 additions & 5 deletions
10
Project/DAQ_System/Program/Src/Sensor/LinearPotentiometer/ilinear_potentiometer.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
/* | ||
* Linear Potentiometer | ||
* Authors: Cristian Cruz | ||
* Manuel DJC | ||
* Linear Potentiometer SLS1300 | ||
* Author: Manuel DJC | ||
* Cristian Cruz | ||
* | ||
* Email: [email protected] | ||
* [email protected] | ||
* Email: [email protected] | ||
* [email protected] | ||
* | ||
* (c) 2022 Dallas Formula Racing - Embedded Firmware Team | ||
* Formula SAE International Collegiate Chapter | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
/* | ||
* Linear Potentiometer SLS1300 | ||
* Author: Manuel DJC | ||
* Modified By: Cristian Cruz | ||
* Author: Manuel DJC | ||
* Cristian Cruz | ||
* | ||
* Email: [email protected] | ||
* [email protected] | ||
* Email: [email protected] | ||
* [email protected] | ||
* | ||
* (c) 2022 Dallas Formula Racing - Embedded Firmware Team | ||
* Formula SAE International Collegiate Chapter | ||
|
@@ -28,16 +28,16 @@ float SLS1322::DisplacementMillimeters() { | |
return displacement_ratio * kMaxLengthMillimeters; | ||
} | ||
|
||
float SLS1322::DisplacementRatio() { | ||
uint32_t quantized_count = ReadQuantizedInput(); | ||
float retraction_ratio = (float)(quantized_count) / kMaxResolution; | ||
return 1 - retraction_ratio; | ||
} | ||
|
||
uint32_t SLS1322::ReadQuantizedInput() { | ||
HAL_ADC_Start(&adc_); | ||
HAL_ADC_PollForConversion(&adc_, 1); | ||
return HAL_ADC_GetValue(&adc_); | ||
} | ||
|
||
float SLS1322::DisplacementRatio() { | ||
uint32_t quantized_count = ReadQuantizedInput(); | ||
float retraction_ratio = (float)(quantized_count) / kMaxResolution; | ||
return 1 - retraction_ratio; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
/* | ||
* Linear Potentiometer SLS1300 | ||
* Author: Manuel DJC | ||
* Modified By: Cristian Cruz | ||
* Author: Manuel DJC | ||
* Cristian Cruz | ||
* | ||
* Email: [email protected] | ||
* [email protected] | ||
* Email: [email protected] | ||
* [email protected] | ||
* | ||
* (c) 2022 Dallas Formula Racing - Embedded Firmware Team | ||
* Formula SAE International Collegiate Chapter | ||
|
@@ -23,32 +23,39 @@ | |
|
||
namespace sensor { | ||
|
||
/// SLS1322 | ||
class SLS1322 : public ILinearPotentiometer { | ||
public: | ||
SLS1322(); | ||
SLS1322(ADC_HandleTypeDef& hadc); | ||
|
||
/// @param hadc An ADC peripheral from ST's HAL. | ||
SLS1322(ADC_HandleTypeDef &hadc); | ||
virtual ~SLS1322(); | ||
|
||
/// DisplacementInches | ||
/// @param None | ||
/// @return Displacement as inches HAHAHA HUHH?! | ||
/// Converts the ADC signal to the measured displacement of the potentiometer. | ||
/// @return 0.0 to 3.0 inches. | ||
float DisplacementInches() override; | ||
|
||
// Converts the ADC signal to the measured displacement of the potentiometer. | ||
/// @return 0.0 to 76.2 millimeters. | ||
float DisplacementMillimeters() override; | ||
|
||
private: | ||
// Returns an ADC reading after the sampling undergoes quantization. | ||
// Range: 0 to ADC resolution | ||
// That is, 0 to 2^(n bits)-1 | ||
/// Provides the ADC reading after the sampling undergoes quantization. | ||
/// The accuracy and range varies on the hardware resolution. | ||
/// @return ADC reading in a range of 0 to 2^(n bits)-1. | ||
uint32_t ReadQuantizedInput(); | ||
// Returns an ADC reading within a range of 0.0 to 1.0. | ||
|
||
/// Represents the quantized input as a ratio. | ||
/// @return ADC reading in a range of 0.0 to 1.0. | ||
float DisplacementRatio(); | ||
|
||
ADC_HandleTypeDef& adc_; | ||
|
||
static constexpr uint16_t kMaxResolution = 0x0FFF; // 2^(12 bits) - 1 | ||
/// Resolution for a 12-bit ADC, 2^(12 bits) - 1 | ||
static constexpr uint16_t kMaxResolution = 0x0FFF; | ||
static constexpr uint8_t kMaxLengthInches = 3; | ||
static constexpr float kMaxLengthMillimeters = 25.4f * kMaxLengthInches; | ||
|
||
/// The ADC peripheral from ST's HAL library. | ||
ADC_HandleTypeDef& adc_; | ||
}; | ||
|
||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* -- breathe specific styles ----------------------------------------------- */ | ||
|
||
/* So enum value descriptions are displayed inline to the item */ | ||
.breatheenumvalues li tt + p { | ||
display: inline; | ||
} | ||
|
||
/* So parameter descriptions are displayed inline to the item */ | ||
.breatheparameterlist li tt + p { | ||
display: inline; | ||
} | ||
|
||
:root { | ||
--color-brand-primary-light: hsl(205deg, 52%, 39%); | ||
--color-brand-primary-dark: hsl(205deg, 65%, 65%); | ||
--breathe-str-char-color-dark: hsl(41, 85%, 46%); | ||
--breathe-str-char-color-light: hsl(41, 89%, 37%); | ||
--breathe-keyword-type-color-dark: hsl(256, 100%, 65%); | ||
--breathe-keyword-type-color-light: hsl(276, 85%, 29%); | ||
--breathe-number-color-dark: hsl(157, 81%, 50%); | ||
--breathe-number-color-light: hsl(157, 93%, 32%); | ||
--breathe-name-color-dark: hsl(88, 72%, 56%); | ||
--breathe-name-color-light: hsl(88, 100%, 28%); | ||
} | ||
|
||
/* ************************************************** */ | ||
/* rules to uniform color scheme with breathe-doc.org */ | ||
|
||
body { | ||
--color-brand-primary: var(--color-brand-primary-light); | ||
--color-brand-content: var(--color-brand-primary-light); | ||
--breathe-str-char-color: var(--breathe-str-char-color-light); | ||
--breathe-keyword-type-color: var(--breathe-keyword-type-color-light); | ||
--breathe-number-color: var(--breathe-number-color-light); | ||
--breathe-name-color: var(--breathe-name-color-light); | ||
} | ||
|
||
/* Enable dark-mode, if requested. */ | ||
body[data-theme="dark"] { | ||
--color-brand-primary: var(--color-brand-primary-dark); | ||
--color-brand-content: var(--color-brand-primary-dark); | ||
--breathe-str-char-color: var(--breathe-str-char-color-dark); | ||
--breathe-keyword-type-color: var(--breathe-keyword-type-color-dark); | ||
--breathe-number-color: var(--breathe-number-color-dark); | ||
--breathe-name-color: var(--breathe-name-color-dark); | ||
} | ||
|
||
/* Enable dark mode, unless explicitly told to avoid. */ | ||
@media (prefers-color-scheme: dark) { | ||
body:not([data-theme="light"]) { | ||
--color-brand-primary: var(--color-brand-primary-dark); | ||
--color-brand-content: var(--color-brand-primary-dark); | ||
--breathe-str-char-color: var(--breathe-str-char-color-dark); | ||
--breathe-keyword-type-color: var(--breathe-keyword-type-color-dark); | ||
--breathe-number-color: var(--breathe-number-color-dark); | ||
--breathe-name-color: var(--breathe-name-color-dark); | ||
} | ||
} | ||
|
||
.mobile-header { | ||
/* background-color: var(--color-header-background); */ | ||
background-color: #003c66; | ||
} | ||
|
||
.mobile-header .toc-overlay-icon .icon { | ||
/* color: var(--color-foreground-secondary); */ | ||
color: white; | ||
} | ||
|
||
.mobile-header .header-center a { | ||
/* color: var(--color-header-text); */ | ||
color: white; | ||
} | ||
|
||
.mobile-header .theme-toggle svg { | ||
/* color: var(--color-foreground-primary); */ | ||
color: white; | ||
} | ||
|
||
/* C++ specific styling */ | ||
|
||
.highlight { | ||
/* desaturate that ugly yellow color used by most other theme's code snippets */ | ||
background-color: var(--color-api-background); /* for light theme only */ | ||
} | ||
|
||
.sig.c .k, .sig.c .kt, | ||
.sig.cpp .k, .sig.cpp .kt { | ||
color: var(--breathe-keyword-type-color); | ||
} | ||
|
||
.sig.c .m, | ||
.sig.cpp .m { | ||
color: var(--breathe-number-color); | ||
} | ||
|
||
.sig.c .s, .sig.c .sc, | ||
.sig.cpp .s, .sig.cpp .sc { | ||
color: var(--breathe-str-char-color); | ||
} | ||
|
||
.sig > .n { | ||
color: var(--breathe-name-color); | ||
} | ||
|
||
/* | ||
bugfix for multi-lined signatures | ||
(see https://github.com/pradyunsg/furo/discussions/427 ) | ||
*/ | ||
.sig { | ||
padding-left: 0.5em; | ||
text-indent: revert; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,59 @@ | ||
.. Data Acquisition 2.0 documentation master file, created by | ||
sphinx-quickstart on Wed Dec 6 10:23:23 2023. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
.. Data Acquisition 2.0 documentation root file | ||
Welcome to Data Acquisition 2.0's documentation! | ||
================================================ | ||
Welcome to DFR's Data Acquisition API documentation! | ||
==================================================== | ||
|
||
.. image:: _static/autocross_2023.png | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Application Layer | ||
:hidden: | ||
|
||
data_logger/index | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Sensor Layer | ||
:hidden: | ||
|
||
linear_potentiometer/index | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Platform Layer | ||
:hidden: | ||
|
||
peripherals/index | ||
|
||
These pages are auto-generated from our source code. Each firmware component is organized as the following. For high-level design and development documentation, go to our repository's `wiki <https://github.com/DallasFormulaRacing/DataAcquisition2.0/wiki/>`_. | ||
|
||
|
||
Indices and tables | ||
================== | ||
Index Table | ||
----------- | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
||
Firmware Architecture | ||
--------------------- | ||
|
||
Application Layer | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
- High-level code. | ||
- Will mostly consist of logic rather than nitty-gritty details. | ||
- Will not be constrained to a particular product. | ||
|
||
Sensor Layer | ||
^^^^^^^^^^^^ | ||
|
||
- Low-level code. | ||
- Consists of drivers. That is, libraries to support sensors and external devices. | ||
- Product-specific code. | ||
|
||
Platform Layer | ||
^^^^^^^^^^^^^^ | ||
|
||
- Low-level code. | ||
- Access to microcontroller peripherals. | ||
- Platform-specific code. Such as, making use of I2C on an STM32 with the HAL library vs. on a TI microcontroller. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
|
||
Interface | ||
========= | ||
|
||
.. doxygenfile:: ilinear_potentiometer.hpp | ||
:project: Data Acquisition 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.. _peripherals: | ||
|
||
Pin Map | ||
Peripherals | ||
==================== | ||
.. toctree:: | ||
:maxdepth: 2 | ||
|