AVR USB RGB LED Controller  1.1
 All Classes Namespaces Files Functions Variables Typedefs Properties Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
rgbledctrl Class Reference

C++ Wrapper class for C library. More...

#include <rgbledctrl.h>

Public Member Functions

 rgbledctrl ()
 
 ~rgbledctrl ()
 
bool open ()
 
bool open (uint idx)
 
bool open (byte value, eepAddr_t address)
 
void close ()
 
bool poke ()
 
bool reset ()
 
bool setIdleTime (byte time)
 
bool setRGB (s_rgbVal &colour)
 
bool setR (byte value)
 
bool setG (byte value)
 
bool setB (byte value)
 
bool eeprom_write (byte data, eepAddr_t address)
 
bool eeprom_read (byte &data, eepAddr_t address)
 
void getVersion (byte(&version)[2])
 
eepAddr_t getEepromSize ()
 
void getColour (s_rgbVal &colour)
 
byte getIdleTime ()
 
usb_dev_handle * getHandle ()
 

Static Public Member Functions

static void init ()
 
static uint find ()
 
static bool sameDevice (usb_dev_handle *handle1, usb_dev_handle *handle2)
 

Detailed Description

C++ Wrapper class for C library.

Constructor & Destructor Documentation

rgbledctrl::rgbledctrl ( )
rgbledctrl::~rgbledctrl ( )

Closes any handles.

Member Function Documentation

void rgbledctrl::close ( )

Close device.

Returns
(none)
bool rgbledctrl::eeprom_read ( byte data,
eepAddr_t  address 
)

Read device EEPROM

Parameters
[data]Pointer to buffer to write data to
[address]EEPROM address to read
Returns
true on success, false on failure
bool rgbledctrl::eeprom_write ( byte  data,
eepAddr_t  address 
)

Write to device EEPROM

Parameters
[data]Data to write
[address]EEPROM address to write to
Returns
true on success, false on failure
static uint rgbledctrl::find ( )
static

Update list of RGB LED controllers, should be called before opening devices.

Returns
Number of RGB LED controllers found.
void rgbledctrl::getColour ( s_rgbVal colour)

Current colour

Parameters
[colour]s_rgbVal structure to load colour to
eepAddr_t rgbledctrl::getEepromSize ( )

Available EEPROM space

usb_dev_handle* rgbledctrl::getHandle ( )

LibUSB device handle

byte rgbledctrl::getIdleTime ( )

Idle timeout (seconds)

void rgbledctrl::getVersion ( byte(&)  version[2])

Controller firmware version

Parameters
[version]Byte[2] array to load data to
static void rgbledctrl::init ( )
static

Initialise, must be called before anything else!

Returns
(none)
bool rgbledctrl::open ( )

Open whatever device is found first.

Returns
true on success, false on failure
bool rgbledctrl::open ( uint  idx)

Open device using its position/index in the list of devices found by find().

Parameters
[idx]Index
Returns
true on success, false on failure
bool rgbledctrl::open ( byte  value,
eepAddr_t  address 
)

Open device that has the specified value at the specified EEPROM address.

Parameters
[value]Value to check for
[address]EEPROM address to look at
Returns
true on success, false on failure
bool rgbledctrl::poke ( )

Check if the device is still connected.

Returns
true if connected, false if not
bool rgbledctrl::reset ( )

Reset device (makes the watchdog timer timeout).

Returns
true on success, false on failure
static bool rgbledctrl::sameDevice ( usb_dev_handle *  handle1,
usb_dev_handle *  handle2 
)
static

Checks to see if two handles are handles for the same device.

Parameters
[handle1]Handle 1
[handle2]Handle 2
Returns
true if they are handles for the same device, otherwise false
bool rgbledctrl::setB ( byte  value)

Set blue brightness

Parameters
[value]Brightness
Returns
true on success, false on failure
bool rgbledctrl::setG ( byte  value)

Set green brightness

Parameters
[value]Brightness
Returns
true on success, false on failure
bool rgbledctrl::setIdleTime ( byte  time)

Set idle time. Idle time is how long the controller waits (in seconds) before fading out the LEDs when there is no USB activity. RGBLED_IDLETIME_DISABLE = Disabled.

Parameters
[time]Timeout
Returns
true on success, false on failure
bool rgbledctrl::setR ( byte  value)

Set red brightness

Parameters
[value]Brightness
Returns
true on success, false on failure
bool rgbledctrl::setRGB ( s_rgbVal colour)

Set red, green and blue brightnesses in one go

Parameters
[colour]s_rgbVal structure
Returns
true on success, false on failure

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