This commit is contained in:
@@ -11,6 +11,21 @@ private:
|
|||||||
int lastPin;
|
int lastPin;
|
||||||
|
|
||||||
public:
|
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);
|
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);
|
bool debounceReadNC(int buttonPin);
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const int DEBOUNCE_DELAY = 200;
|
const int DEBOUNCE_DELAY = 35;
|
||||||
|
|
||||||
const int USER_STEPS = 2;
|
const int USER_STEPS = 2;
|
||||||
const int STAFF_STEPS = 16;
|
const int STAFF_STEPS = 16;
|
||||||
|
|||||||
@@ -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 <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <commonFunctions.h>
|
#include <commonFunctions.h>
|
||||||
#include <constants.h>
|
#include <constants.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 Reader::debounceReadNO(int buttonPin)
|
||||||
{
|
{
|
||||||
bool reading = digitalRead(buttonPin);
|
bool reading = digitalRead(buttonPin);
|
||||||
@@ -35,6 +53,13 @@ bool Reader::debounceReadNO(int buttonPin)
|
|||||||
return buttonPressed;
|
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 Reader::debounceReadNC(int buttonPin)
|
||||||
{
|
{
|
||||||
bool reading = digitalRead(buttonPin);
|
bool reading = digitalRead(buttonPin);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ void mute(int *userVolume, int *oldUserVolume, int maxVolume)
|
|||||||
if (*oldUserVolume > *userVolume)
|
if (*oldUserVolume > *userVolume)
|
||||||
{
|
{
|
||||||
// This is if the user is muted and is asking to be unmuted
|
// This is if the user is muted and is asking to be unmuted
|
||||||
|
|
||||||
// Check if max volume has been lowered since mute
|
// Check if max volume has been lowered since mute
|
||||||
if (*oldUserVolume > maxVolume)
|
if (*oldUserVolume > maxVolume)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user