From f6452e5009acca2a4cea2ccc8aaf74cf2a8f7284 Mon Sep 17 00:00:00 2001 From: Lyubomir Penev Date: Thu, 23 Oct 2025 12:42:33 +0200 Subject: [PATCH] Added javadoc comment to userFunctions --- include/userFunctions.h | 34 ++++++++++++++++++++++++++++++++++ src/userFunctions.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/include/userFunctions.h b/include/userFunctions.h index 7874deb..ab05028 100644 --- a/include/userFunctions.h +++ b/include/userFunctions.h @@ -1,6 +1,40 @@ #pragma once +/** + * This function is used to increase the volume + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * @param maxVolume The highest point that the volume can be set to. + * + */ void volumeUp(int *userVolume, int *oldUserVolume, int maxVolume); + +/** + * This function is used to decrease the volume + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * + */ void volumeDown(int *userVolume, int *oldUserVolume); + +/** + * This function is used to significantly lower the volume. If the function is called while in a lowered state it will revert the volume to what it previously was. + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * @param maxVolume The highest point that the volume can be set to. + * + */ void lowerVolume(int *userVolume, int *oldUserVolume, int maxVolume); + +/** + * This function is used to mute the volume. If the function is called while in a muted state it will revert the volume to what it previously was. + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * @param maxVolume The highest point that the volume can be set to. + * + */ void mute(int *userVolume, int *oldUserVolume, int maxVolume); \ No newline at end of file diff --git a/src/userFunctions.cpp b/src/userFunctions.cpp index 5f3fe46..7db7c08 100644 --- a/src/userFunctions.cpp +++ b/src/userFunctions.cpp @@ -2,6 +2,14 @@ #include #include +/** + * This function is used to mute the volume. If the function is called while in a muted state it will revert the volume to what it previously was. + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * @param maxVolume The highest point that the volume can be set to. + * + */ void mute(int *userVolume, int *oldUserVolume, int maxVolume) { // Check if we are in a muted state @@ -43,6 +51,14 @@ void mute(int *userVolume, int *oldUserVolume, int maxVolume) } } +/** + * This function is used to significantly lower the volume. If the function is called while in a lowered state it will revert the volume to what it previously was. + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * @param maxVolume The highest point that the volume can be set to. + * + */ void lowerVolume(int *userVolume, int *oldUserVolume, int maxVolume) { // Check if we volume is already lowered @@ -85,6 +101,14 @@ void lowerVolume(int *userVolume, int *oldUserVolume, int maxVolume) } } +/** + * This function is used to increase the volume + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * @param maxVolume The highest point that the volume can be set to. + * + */ void volumeUp(int *userVolume, int *oldUserVolume, int maxVolume) { if ((*userVolume + USER_STEPS) > maxVolume) @@ -109,6 +133,13 @@ void volumeUp(int *userVolume, int *oldUserVolume, int maxVolume) } } +/** + * This function is used to decrease the volume + * + * @param userVolume Pointer to the variable used to keep track of the current user volume. It is being passed in so the function can increment it with the potentiometer steps. + * @param oldUserVolume Pointer to the variable used to keep track of the user volume while muted or lowered. It is being passed in so the function can increment it with the potentiometer steps. + * + */ void volumeDown(int *userVolume, int *oldUserVolume) { if ((*userVolume - USER_STEPS) < 0)