All checks were successful
Generate Documentation / build (push) Successful in 15s
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
/**
|
|
* @file ledControlls.cpp
|
|
* @author Lyubomir Penev (me@lpenev.com)
|
|
* @brief This file contains all the functions which control the LEDs used to indicate the current max volume
|
|
* @version 0.1
|
|
* @date 2025-10-31
|
|
*
|
|
* @copyright Copyright (c) 2025
|
|
*
|
|
*/
|
|
|
|
#include <Arduino.h>
|
|
#include <constants.h>
|
|
#include <ledControlls.h>
|
|
|
|
/**
|
|
* @brief This function sets all the LEDs to a default(LOW) state
|
|
*
|
|
*/
|
|
void resetLeds()
|
|
{
|
|
digitalWrite(LED_HIGH, LOW);
|
|
digitalWrite(LED_MED, LOW);
|
|
digitalWrite(LED_LOW, LOW);
|
|
}
|
|
|
|
/**
|
|
* @brief This function turns on the correct LED depending on the current max(staff) volume
|
|
*
|
|
* @param volume The current max(staff) volume
|
|
*/
|
|
void updateLeds(int volume)
|
|
{
|
|
switch (volume)
|
|
{
|
|
case 64:
|
|
resetLeds();
|
|
digitalWrite(LED_HIGH, HIGH);
|
|
break;
|
|
case 48:
|
|
resetLeds();
|
|
digitalWrite(LED_MED, HIGH);
|
|
break;
|
|
case 32:
|
|
resetLeds();
|
|
digitalWrite(LED_LOW, HIGH);
|
|
break;
|
|
case 16:
|
|
resetLeds();
|
|
digitalWrite(LED_HIGH, HIGH);
|
|
digitalWrite(LED_MED, HIGH);
|
|
digitalWrite(LED_LOW, HIGH);
|
|
break;
|
|
}
|
|
} |