diff --git a/include/commonFunctions.h b/include/commonFunctions.h index 8e0d36e..473d67b 100644 --- a/include/commonFunctions.h +++ b/include/commonFunctions.h @@ -11,6 +11,21 @@ private: int lastPin; public: + /** + * @brief Function used to read state of a normally open(LOW) button + * + * @param buttonPin The pin of the button + * @return true + * @return false + */ bool debounceReadNO(int buttonPin); + + /** + * @brief Function used to read state of a normally closed(HIGH) button + * + * @param buttonPin The pin of the button + * @return true + * @return false + */ bool debounceReadNC(int buttonPin); }; \ No newline at end of file diff --git a/include/constants.h b/include/constants.h index 1bc5be7..ac7d038 100644 --- a/include/constants.h +++ b/include/constants.h @@ -1,6 +1,6 @@ #pragma once -const int DEBOUNCE_DELAY = 200; +const int DEBOUNCE_DELAY = 35; const int USER_STEPS = 2; const int STAFF_STEPS = 16; diff --git a/src/commonFunctions.cpp b/src/commonFunctions.cpp index 83b5438..b04c79c 100644 --- a/src/commonFunctions.cpp +++ b/src/commonFunctions.cpp @@ -1,7 +1,25 @@ +/** + * @file commonFunctions.cpp + * @author Lyubomir Penev (me@lpenev.com, 571147@student.fontys.nl) + * @brief This file contains all the functions used to read buttons + * @version 0.1 + * @date 2025-10-31 + * + * @copyright Copyright (c) 2025 + * + */ + #include #include #include +/** + * @brief Function used to read state of a normally open(LOW) button + * + * @param buttonPin The pin of the button + * @return true + * @return false + */ bool Reader::debounceReadNO(int buttonPin) { bool reading = digitalRead(buttonPin); @@ -35,6 +53,13 @@ bool Reader::debounceReadNO(int buttonPin) return buttonPressed; } +/** + * @brief Function used to read state of a normally closed(HIGH) button + * + * @param buttonPin The pin of the button + * @return true + * @return false + */ bool Reader::debounceReadNC(int buttonPin) { bool reading = digitalRead(buttonPin); diff --git a/src/userFunctions.cpp b/src/userFunctions.cpp index 20b4450..8db0b39 100644 --- a/src/userFunctions.cpp +++ b/src/userFunctions.cpp @@ -25,6 +25,7 @@ void mute(int *userVolume, int *oldUserVolume, int maxVolume) if (*oldUserVolume > *userVolume) { // This is if the user is muted and is asking to be unmuted + // Check if max volume has been lowered since mute if (*oldUserVolume > maxVolume) {