added detectledgame
This commit is contained in:
74
src/led.h
Normal file
74
src/led.h
Normal file
@@ -0,0 +1,74 @@
|
||||
#ifndef LEDH
|
||||
#define LEDH
|
||||
|
||||
#include "arduino.h"
|
||||
#include "vector"
|
||||
|
||||
|
||||
enum e_ledcolor{
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW
|
||||
};
|
||||
|
||||
class c_ledport
|
||||
{
|
||||
const uint32_t _pin;
|
||||
const uint32_t _analogPin;
|
||||
const uint16_t _index;
|
||||
const bool _invert;
|
||||
bool _state;
|
||||
|
||||
public:
|
||||
c_ledport(uint32_t pin, uint32_t analogpin, uint16_t index, bool invert = false)
|
||||
:_pin(pin), _analogPin(analogpin), _index(index), _invert(invert){};
|
||||
|
||||
void begin( void );
|
||||
|
||||
void turnOn( void );
|
||||
|
||||
void turnOff( void );
|
||||
|
||||
void writeLed( bool state );
|
||||
|
||||
uint16_t ledRead( void );
|
||||
|
||||
};
|
||||
|
||||
class c_led
|
||||
{
|
||||
const e_ledcolor _color;
|
||||
const uint16_t _value;
|
||||
const uint16_t _index;
|
||||
|
||||
public:
|
||||
|
||||
c_led(e_ledcolor color,uint16_t value, uint16_t index)
|
||||
:_color(color), _value(value), _index(index) {};
|
||||
|
||||
bool checkThreshold( uint16_t value);
|
||||
bool checkcolor(e_ledcolor color);
|
||||
};
|
||||
|
||||
class c_leds
|
||||
{
|
||||
std::vector<c_ledport> v_ledports;
|
||||
std::vector<c_led> v_leds;
|
||||
|
||||
public:
|
||||
c_leds(){};
|
||||
|
||||
void AddLed( uint32_t pin, uint32_t analogpin, uint16_t index, uint16_t value, e_ledcolor color, bool invert );
|
||||
void begin( void );
|
||||
|
||||
void turnOnLed(e_ledcolor color);
|
||||
void turnOnLed(uint16_t index);
|
||||
|
||||
void turnAllOff( void );
|
||||
};
|
||||
|
||||
|
||||
c_leds* getledlist( void );
|
||||
|
||||
|
||||
#endif //LEDH
|
||||
Reference in New Issue
Block a user