Added buttons controls.

This commit is contained in:
Author glitchrain
2024-12-14 02:46:59 -08:00
committed by s.aydarov
parent 03106054c5
commit 13766ca4f2
9 changed files with 267 additions and 40 deletions

View File

@@ -6,18 +6,18 @@
*/
#include "Defines.h"
#include <ShiftRegister74HC595.h>
#include "Settings.h"
class LEDRunner
{
public:
LEDRunner()
{
}
// LEDRunner()
// {
// }
LEDRunner(Settings _Settings)
LEDRunner(Settings* _Settings)
{
m_Settings = _Settings;
this->m_Settings = _Settings;
}
void setup()
@@ -28,6 +28,11 @@ public:
pinMode(PIN_LED_LATCH, OUTPUT);
}
void loop()
{
}
void runTest()
{
// // setting all pins at the same time to either HIGH or LOW
@@ -115,8 +120,27 @@ public:
delay(500);
}
void blink(const uint8_t _LedIndex, unsigned long _Time)
{
sr.setAllLow();
sr.set(_LedIndex, HIGH);
delay(_Time);
sr.setAllLow();
}
void setAndClearOthers(const uint8_t _LedIndex, const uint8_t _Value)
{
sr.setAllLow();
sr.set(_LedIndex, _Value);
}
void set(const uint8_t _LedIndex, const uint8_t _Value)
{
sr.set(_LedIndex, _Value);
}
private:
Settings m_Settings;
Settings* m_Settings;
ShiftRegister74HC595<REGISTER_SIZE> sr = ShiftRegister74HC595<REGISTER_SIZE>::ShiftRegister74HC595(PIN_LED_DATA, PIN_LED_CLOCK, PIN_LED_LATCH);
};