direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RgbLed Class Reference

This class controls connected rgbLeds with PWM (brightness) More...

#include <rgbLed.h>

Collaboration diagram for RgbLed:

List of all members.

Public Slots

void init (void)
bool setBrightness (unsigned char rgbLed, unsigned char bness)
void setRobotState (bool state)

Signals

void message (QString text)

Public Member Functions

unsigned char getBrightness (int rgbLed, unsigned char type=RGBLEDACTUAL)
 RgbLed (InterfaceAvr *i, QMutex *m)
void storeBrightness (int rgbLed, unsigned char type, unsigned char bness)
 ~RgbLed ()

Private Attributes

int brightness [NUMBEROFRGBLEDS]
QString className
int defaultBrightness [NUMBEROFRGBLEDS]
InterfaceAvrinterface1
int maxBrightness [NUMBEROFRGBLEDS]
int minBrightness [NUMBEROFRGBLEDS]
QMutex * mutex
 this will contain the name of this class at runtime.
bool robotState

Static Private Attributes

static const int MAXPWM = 99
 this is analog to the value in microcontroller software
static const int MINPWM = 1
 For motor or robot "OFF".
static const unsigned char NUMBEROFRGBLEDS = 6
 defines the size of the rgbLed[] arrays.
static const bool OFF = false
 For motor or robot "ON".
static const bool ON = true
 the current position of the rgbLed!
static const unsigned char RGBLED1 = 0
 the RGB LED numbers
static const unsigned char RGBLED2 = 1
static const unsigned char RGBLED3 = 2
static const unsigned char RGBLED4 = 3
static const unsigned char RGBLED5 = 4
static const unsigned char RGBLED6 = 5
static const unsigned char RGBLEDACTUAL = 1
static const unsigned char RGBLEDDEFAULT = 0
 this is analog to the value in microcontroller software
static const unsigned char RGBLEDMAX = 3
static const unsigned char RGBLEDMIN = 2
static const unsigned char SET_RGBLED1 = 42
 the command for the microcontroller
static const unsigned char SET_RGBLED2 = 43
static const unsigned char SET_RGBLED3 = 44
static const unsigned char SET_RGBLED4 = 45
static const unsigned char SET_RGBLED5 = 46
static const unsigned char SET_RGBLED6 = 47
static const unsigned long THREADSLEEPTIME = 500

Detailed Description

This class controls connected rgbLeds with PWM (brightness)

Author:
Markus Knapp It has to be a thread because of communicating at the same time with the microcontroller via the class.
See also:
InterfaceAvr() !

Definition at line 38 of file rgbLed.h.


Constructor & Destructor Documentation

RgbLed::RgbLed ( InterfaceAvr i,
QMutex *  m 
)

Definition at line 23 of file rgbLed.cpp.

RgbLed::~RgbLed ( )

Definition at line 45 of file rgbLed.cpp.


Member Function Documentation

unsigned char RgbLed::getBrightness ( int  rgbLed,
unsigned char  type = RGBLEDACTUAL 
)

Returns the rgbLed start, end, default or current position.

Parameters:
rgbLedis the rgbLed number.
typecan be SVMIN, SVMAX, SVSTART, SVEND, SVDEFAULT or SVCURRENT=default
Returns:
the rgbLed position (0 - 255)

Definition at line 147 of file rgbLed.cpp.

Here is the call graph for this function:

void RgbLed::init ( void  )
slot

Inits all RGB LEDs to their default brightness.

Definition at line 134 of file rgbLed.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RgbLed::message ( QString  text)
signal

Emits a message to be displayed in the GUI or be used somewhere else (e.g. error message).

Here is the caller graph for this function:

bool RgbLed::setBrightness ( unsigned char  rgbLed,
unsigned char  bness 
)
slot

Sets the brightness of a RGB LED.

Parameters:
rgbLedis the RGBLED number.
bnessis the brightness.
Returns:
true on success

Definition at line 50 of file rgbLed.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RgbLed::setRobotState ( bool  state)
slot

This slots takes the robot (circuit) state, to know if the robot is ON or OFF. When the class knows this, unnecessary communication with the interface can be avoided.

Parameters:
statecan be ON or OFF

Definition at line 177 of file rgbLed.cpp.

Here is the call graph for this function:

void RgbLed::storeBrightness ( int  rgbLed,
unsigned char  type,
unsigned char  bness 
)

Stores the RGB LEDs minimum and maximum brightness and its default brightness.

Parameters:
rgbLedis the RGB LED number.
typecan be RGBLEDMIN, RGBLEDMAX, RGBLEDSTART, RGBLEDDEFAULT or RGBLEDACTUAL
bnessis the brightness (0 - 255).

Definition at line 110 of file rgbLed.cpp.

Here is the caller graph for this function:


Member Data Documentation

int RgbLed::brightness[NUMBEROFRGBLEDS]
private

Definition at line 107 of file rgbLed.h.

QString RgbLed::className
private

Definition at line 93 of file rgbLed.h.

int RgbLed::defaultBrightness[NUMBEROFRGBLEDS]
private

Definition at line 106 of file rgbLed.h.

InterfaceAvr* RgbLed::interface1
private

Definition at line 95 of file rgbLed.h.

int RgbLed::maxBrightness[NUMBEROFRGBLEDS]
private

Definition at line 105 of file rgbLed.h.

const int RgbLed::MAXPWM = 99
staticprivate

this is analog to the value in microcontroller software

See also:
direcsSTM

Definition at line 113 of file rgbLed.h.

int RgbLed::minBrightness[NUMBEROFRGBLEDS]
private
Todo:
also defined in direcs.h !!!

Definition at line 104 of file rgbLed.h.

const int RgbLed::MINPWM = 1
staticprivate

For motor or robot "OFF".

Definition at line 112 of file rgbLed.h.

QMutex* RgbLed::mutex
mutableprivate

this will contain the name of this class at runtime.

See also:
takeCommandAnswer()

Definition at line 94 of file rgbLed.h.

const unsigned char RgbLed::NUMBEROFRGBLEDS = 6
staticprivate

defines the size of the rgbLed[] arrays.

Definition at line 103 of file rgbLed.h.

const bool RgbLed::OFF = false
staticprivate

For motor or robot "ON".

Definition at line 110 of file rgbLed.h.

const bool RgbLed::ON = true
staticprivate

the current position of the rgbLed!

Definition at line 109 of file rgbLed.h.

const unsigned char RgbLed::RGBLED1 = 0
staticprivate

the RGB LED numbers

Definition at line 122 of file rgbLed.h.

const unsigned char RgbLed::RGBLED2 = 1
staticprivate

Definition at line 123 of file rgbLed.h.

const unsigned char RgbLed::RGBLED3 = 2
staticprivate

Definition at line 124 of file rgbLed.h.

const unsigned char RgbLed::RGBLED4 = 3
staticprivate

Definition at line 125 of file rgbLed.h.

const unsigned char RgbLed::RGBLED5 = 4
staticprivate

Definition at line 126 of file rgbLed.h.

const unsigned char RgbLed::RGBLED6 = 5
staticprivate

Definition at line 127 of file rgbLed.h.

const unsigned char RgbLed::RGBLEDACTUAL = 1
staticprivate

Definition at line 117 of file rgbLed.h.

const unsigned char RgbLed::RGBLEDDEFAULT = 0
staticprivate

this is analog to the value in microcontroller software

See also:
direcsSTM the possible rgbLed data

Definition at line 116 of file rgbLed.h.

const unsigned char RgbLed::RGBLEDMAX = 3
staticprivate

Definition at line 119 of file rgbLed.h.

const unsigned char RgbLed::RGBLEDMIN = 2
staticprivate

Definition at line 118 of file rgbLed.h.

bool RgbLed::robotState
private

Definition at line 96 of file rgbLed.h.

const unsigned char RgbLed::SET_RGBLED1 = 42
staticprivate

the command for the microcontroller

Definition at line 130 of file rgbLed.h.

const unsigned char RgbLed::SET_RGBLED2 = 43
staticprivate

Definition at line 131 of file rgbLed.h.

const unsigned char RgbLed::SET_RGBLED3 = 44
staticprivate

Definition at line 132 of file rgbLed.h.

const unsigned char RgbLed::SET_RGBLED4 = 45
staticprivate

Definition at line 133 of file rgbLed.h.

const unsigned char RgbLed::SET_RGBLED5 = 46
staticprivate

Definition at line 134 of file rgbLed.h.

const unsigned char RgbLed::SET_RGBLED6 = 47
staticprivate

Definition at line 135 of file rgbLed.h.

const unsigned long RgbLed::THREADSLEEPTIME = 500
staticprivate

Definition at line 100 of file rgbLed.h.


The documentation for this class was generated from the following files: