Initial commit.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* TfLCD204Bricklet.h
|
||||
*
|
||||
* Created on: 12.06.2014
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#ifndef TFLCD20X4BRICKLET_H_
|
||||
#define TFLCD20X4BRICKLET_H_
|
||||
|
||||
#include <tfcppsimple/TfBricklet.h>
|
||||
#include <bricklet_lcd_20x4.h>
|
||||
|
||||
namespace tfcppsimple {
|
||||
|
||||
class TfLCD20x4Bricklet;
|
||||
|
||||
class TfLCD20x4Listener {
|
||||
public:
|
||||
virtual ~TfLCD20x4Listener() {}
|
||||
|
||||
virtual void buttonStateCallback(TfLCD20x4Bricklet& lcd, uint8_t button, bool state) {}
|
||||
};
|
||||
|
||||
class TfLCD20x4Bricklet: public TfBricklet {
|
||||
friend class TfDeviceFactory;
|
||||
private:
|
||||
LCD20x4 lcdObj;
|
||||
bool backlightFlag = false;
|
||||
bool cursorFlag = false;
|
||||
bool blinkingFlag = false;
|
||||
ObservableTemplate<TfLCD20x4Listener> lcdListeners;
|
||||
|
||||
TfLCD20x4Bricklet(TfConnection& connection,
|
||||
std::string uid,
|
||||
std::string connected_uid,
|
||||
TfDevicePosition position,
|
||||
TfVersion hardware_version,
|
||||
TfVersion firmware_version,
|
||||
TfDevice* parent
|
||||
);
|
||||
|
||||
virtual void doConfigureDevice();
|
||||
virtual void doReconfigureDevice();
|
||||
virtual void doConnectionLost();
|
||||
virtual void doShutdown();
|
||||
|
||||
static void __buttonPressed(uint8_t button, void *user_data);
|
||||
static void __buttonReleased(uint8_t button, void *user_data);
|
||||
void buttonStateCallBack(uint8_t button, bool state);
|
||||
|
||||
public:
|
||||
virtual ~TfLCD20x4Bricklet();
|
||||
|
||||
virtual std::string getDeviceName(bool extended = true);
|
||||
|
||||
void writeLine(uint8_t line, uint8_t position, std::string txt);
|
||||
|
||||
void clearDisplay();
|
||||
|
||||
void setBacklight(bool backlight);
|
||||
|
||||
bool getBacklight() { return false; }
|
||||
|
||||
void setCursor(bool cursor, bool blinking = false);
|
||||
|
||||
bool addLcdListener(TfLCD20x4Listener& listener);
|
||||
|
||||
bool removeLcdListener(TfLCD20x4Listener& listener);
|
||||
};
|
||||
|
||||
} /* namespace tfcppsimple */
|
||||
|
||||
#endif /* TFLCD20X4BRICKLET_H_ */
|
||||
Reference in New Issue
Block a user