modified games
This commit is contained in:
67
src/led.h
67
src/led.h
@@ -4,11 +4,14 @@
|
||||
#include "arduino.h"
|
||||
#include "vector"
|
||||
|
||||
|
||||
enum e_ledcolor{
|
||||
enum e_ledcolor
|
||||
{
|
||||
YELLOW,
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
YELLOW2,
|
||||
RED2,
|
||||
GREEN2,
|
||||
NONE
|
||||
};
|
||||
|
||||
@@ -22,18 +25,19 @@ class c_ledport
|
||||
|
||||
public:
|
||||
c_ledport(uint32_t pin, uint32_t analogpin, uint16_t index, bool invert = false)
|
||||
:_pin(pin), _analogPin(analogpin), _index(index), _invert(invert){};
|
||||
: _pin(pin), _analogPin(analogpin), _index(index), _invert(invert){};
|
||||
|
||||
void begin( void );
|
||||
void begin(void);
|
||||
|
||||
void turnOn( void );
|
||||
void turnOn(void);
|
||||
|
||||
void turnOff( void );
|
||||
void turnOff(void);
|
||||
|
||||
void writeLed( bool state );
|
||||
void writeLed(bool state);
|
||||
|
||||
uint16_t ledRead( void );
|
||||
uint16_t ledRead(void);
|
||||
|
||||
uint16_t getIndex(void) { return _index; }
|
||||
};
|
||||
|
||||
class c_led
|
||||
@@ -42,37 +46,50 @@ class c_led
|
||||
const uint16_t _value;
|
||||
const uint16_t _index;
|
||||
|
||||
public:
|
||||
public:
|
||||
c_led(e_ledcolor color, uint16_t value, uint16_t index)
|
||||
: _color(color), _value(value), _index(index){};
|
||||
|
||||
c_led(e_ledcolor color,uint16_t value, uint16_t index)
|
||||
:_color(color), _value(value), _index(index) {};
|
||||
|
||||
bool checkThreshold( uint16_t value);
|
||||
bool checkThreshold(uint16_t value);
|
||||
bool checkcolor(e_ledcolor color);
|
||||
bool checkIndex(uint16_t index);
|
||||
};
|
||||
|
||||
class c_leds
|
||||
{
|
||||
std::vector<c_ledport> v_ledports;
|
||||
std::vector<c_led> v_leds;
|
||||
|
||||
public:
|
||||
|
||||
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 init();
|
||||
|
||||
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 turnOffLed(e_ledcolor color);
|
||||
|
||||
void turnOnLed(uint16_t index);
|
||||
c_ledport* getLed(e_ledcolor color);
|
||||
void turnOffLed(e_ledcolor color);
|
||||
void turnOffLed(uint16_t index);
|
||||
|
||||
void turnAllOff( void );
|
||||
c_ledport *getLed(e_ledcolor color);
|
||||
c_ledport *getLed(uint16_t index);
|
||||
|
||||
bool verifyLed(e_ledcolor color);
|
||||
bool verifyLed(uint16_t index);
|
||||
|
||||
|
||||
void turnAllOff(void);
|
||||
};
|
||||
|
||||
c_leds *getledlist(void);
|
||||
void initLeds(void);
|
||||
|
||||
c_leds* getledlist( void );
|
||||
|
||||
void turnOnLed(e_ledcolor color);
|
||||
void turnOffLed(e_ledcolor color);
|
||||
void turnOffLed(uint16_t index);
|
||||
void turnOnLed(uint16_t index);
|
||||
void turnOffAllLed();
|
||||
|
||||
#endif //LEDH
|
||||
Reference in New Issue
Block a user