Initial commit.

This commit is contained in:
matzman
2014-06-16 11:16:21 +02:00
commit 1768f7b41c
42 changed files with 2656 additions and 0 deletions
@@ -0,0 +1,47 @@
/*
* TfHumidityBricklet.h
*
* Created on: 12.06.2014
* Author: matzman
*/
#ifndef TFHUMIDITYBRICKLET_H_
#define TFHUMIDITYBRICKLET_H_
#include <tfcppsimple/TfBricklet.h>
#include <bricklet_humidity.h>
namespace tfcppsimple {
class TfHumidityBricklet: public TfBricklet {
friend class TfDeviceFactory;
private:
Humidity humidityObj;
TfHumidityBricklet(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();
public:
virtual ~TfHumidityBricklet();
virtual std::string getDeviceName(bool extended = true);
uint16_t getHumidity();
uint16_t getHumidityRaw();
};
} /* namespace tfcppsimple */
#endif /* TFHUMIDITYBRICKLET_H_ */
@@ -0,0 +1,32 @@
/*
* TfIO16Bricklet.h
*
* Created on: 12.06.2014
* Author: matzman
*/
#ifndef TFIO16BRICKLET_H_
#define TFIO16BRICKLET_H_
#include <tfcppsimple/TfBricklet.h>
namespace tfcppsimple {
class TfIO16Bricklet: public TfBricklet {
public:
TfIO16Bricklet(TfConnection& connection,
std::string uid,
std::string connected_uid,
TfDevicePosition position,
TfVersion hardware_version,
TfVersion firmware_version,
TfDevice* parent
);
virtual ~TfIO16Bricklet();
virtual std::string getDeviceName(bool extended = true);
};
} /* namespace tfcppsimple */
#endif /* TFIO16BRICKLET_H_ */
@@ -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_ */
@@ -0,0 +1,51 @@
/*
* TfMasterBrick.h
*
* Created on: 12.06.2014
* Author: matzman
*/
#ifndef TFMASTERBRICK_H_
#define TFMASTERBRICK_H_
#include <brick_master.h>
#include <tfcppsimple/TfBrick.h>
namespace tfcppsimple {
class TfMasterBrick: public TfBrick {
friend class TfDeviceFactory;
private:
Master masterObj;
TfMasterBrick(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();
public:
virtual ~TfMasterBrick();
virtual std::string getDeviceName(bool extended = true);
uint16_t getStackVoltage();
uint16_t getStackCurrent();
uint16_t getUSBVoltage();
int16_t getChipTemperature();
};
} /* namespace tfcppsimple */
#endif /* TFMASTERBRICK_H_ */
@@ -0,0 +1,54 @@
/*
* TfTemperatureBricklet.h
*
* Created on: 12.06.2014
* Author: matzman
*/
#ifndef TFTEMPERATUREBRICKLET_H_
#define TFTEMPERATUREBRICKLET_H_
#include <tfcppsimple/TfBricklet.h>
#include <bricklet_temperature.h>
namespace tfcppsimple {
enum class TfTemperatureI2Cmode : uint8_t {
FAST = 0, // Fast (400kHz, default)
SLOW = 1 // Slow (100kHz)
};
class TfTemperatureBricklet: public TfBricklet {
friend class TfDeviceFactory;
private:
Temperature temperatureObj;
TfTemperatureI2Cmode i2cMode = TfTemperatureI2Cmode::FAST;
TfTemperatureBricklet(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();
public:
virtual ~TfTemperatureBricklet();
virtual std::string getDeviceName(bool extended = true);
int16_t getTemperature();
void setI2Cmode(TfTemperatureI2Cmode mode);
TfTemperatureI2Cmode getI2Cmode();
};
} /* namespace tfcppsimple */
#endif /* TFTEMPERATUREBRICKLET_H_ */
@@ -0,0 +1,36 @@
/*
* TfUnknownBrick.h
*
* Created on: 13.06.2014
* Author: matzman
*/
#ifndef TFUNKNOWNBRICK_H_
#define TFUNKNOWNBRICK_H_
#include <tfcppsimple/TfBrick.h>
namespace tfcppsimple {
class TfUnknownBrick: public TfBrick {
friend class TfDeviceFactory;
private:
TfUnknownBrick(TfConnection& connection,
std::string uid,
std::string connected_uid,
TfDevicePosition position,
TfVersion hardware_version,
TfVersion firmware_version,
uint16_t raw_device_identifier,
TfDevice* parent
);
public:
virtual ~TfUnknownBrick();
virtual std::string getDeviceName(bool extended = true);
};
} /* namespace tfcppsimple */
#endif /* TFUNKNOWNBRICK_H_ */
@@ -0,0 +1,36 @@
/*
* TfUnknownBricklet.h
*
* Created on: 13.06.2014
* Author: matzman
*/
#ifndef TFUNKNOWNBRICKLET_H_
#define TFUNKNOWNBRICKLET_H_
#include <tfcppsimple/TfBricklet.h>
namespace tfcppsimple {
class TfUnknownBricklet: public TfBricklet {
friend class TfDeviceFactory;
private:
TfUnknownBricklet(TfConnection& connection,
std::string uid,
std::string connected_uid,
TfDevicePosition position,
TfVersion hardware_version,
TfVersion firmware_version,
uint16_t raw_device_identifier,
TfDevice* parent
);
public:
virtual ~TfUnknownBricklet();
virtual std::string getDeviceName(bool extended = true);
};
} /* namespace tfcppsimple */
#endif /* TFUNKNOWNBRICKLET_H_ */