diff --git a/include/commonFunctions.h b/include/commonFunctions.h index 33fa502..faaff28 100644 --- a/include/commonFunctions.h +++ b/include/commonFunctions.h @@ -22,4 +22,10 @@ bool debounceReadNC(int buttonPin); * @brief Sets all the pins to their correct modes * */ -void setPinModes(); \ No newline at end of file +void setPinModes(); + +/** + * @brief Resets the potentiometer by setting the wiper all the way to the A pin + * + */ +void resetPotentiometer(); \ No newline at end of file diff --git a/src/commonFunctions.cpp b/src/commonFunctions.cpp index 9260f7b..a141724 100644 --- a/src/commonFunctions.cpp +++ b/src/commonFunctions.cpp @@ -11,6 +11,7 @@ #include #include +#include #include unsigned long lastDebounceTime = 0; @@ -124,4 +125,17 @@ void setPinModes() pinMode(POT_UD, OUTPUT); // D9 - U/D digitalWrite(POT_CS, HIGH); digitalWrite(POT_UD, LOW); +} + +/** + * @brief Resets the potentiometer by setting the wiper all the way to the A pin + * + */ +void resetPotentiometer() +{ + // Reset the potentiometer + for (int i = 0; i < 64; i++) + { + potIncrement(); + } } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index dae6e56..a2ac09d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,12 +13,7 @@ int oldUserVolume = userVolume; void setup() { setPinModes(); - - // Reset the potentiometer - for (int i = 0; i < 64; i++) - { - potIncrement(); - } + resetPotentiometer(); } void loop()