#include <usb.h>
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
|
void | rgbledctrl_init (void) |
|
uint | rgbledctrl_find (void) |
|
bool | rgbledctrl_sameDevice (usb_dev_handle *handle1, usb_dev_handle *handle2) |
|
s_rgbled_device * | rgbledctrl_open (void) |
|
s_rgbled_device * | rgbledctrl_open_byIndex (uint idx) |
|
s_rgbled_device * | rgbledctrl_open_byEEPROM (byte value, eepAddr_t address) |
|
void | rgbledctrl_close (s_rgbled_device *device) |
|
bool | rgbledctrl_poke (s_rgbled_device *device) |
|
bool | rgbledctrl_reset (s_rgbled_device *device) |
|
bool | rgbledctrl_setIdleTime (s_rgbled_device *device, byte time) |
|
bool | rgbledctrl_setRGB (s_rgbled_device *device, s_rgbVal *colour) |
|
bool | rgbledctrl_setR (s_rgbled_device *device, byte value) |
|
bool | rgbledctrl_setG (s_rgbled_device *device, byte value) |
|
bool | rgbledctrl_setB (s_rgbled_device *device, byte value) |
|
bool | rgbledctrl_eeprom_write (s_rgbled_device *device, byte data, eepAddr_t address) |
|
bool | rgbledctrl_eeprom_read (s_rgbled_device *device, byte *data, eepAddr_t address) |
|
#define RGBLED_IDLETIME_DISABLE 0 |
Disable LED fade when no USB activity
typedef unsigned char byte |
Typedef for unsigned char
Unsigned 16bit type for EEPROM addresses
typedef unsigned int uint |
Close device.
- Parameters
-
[device] | Device to operate on |
- Returns
- (none)
Read device EEPROM
- Parameters
-
[device] | Device to operate on |
[data] | Pointer to buffer to write data to |
[address] | EEPROM address to read |
- Returns
- true on success, false on failure
Write to device EEPROM
- Parameters
-
[device] | Device to operate on |
[data] | Data to write |
[address] | EEPROM address to write to |
- Returns
- true on success, false on failure
uint rgbledctrl_find |
( |
void |
| ) |
|
Update list of RGB LED controllers, should be called before opening devices.
- Returns
- Number of RGB LED controllers found.
void rgbledctrl_init |
( |
void |
| ) |
|
Initialise, must be called before anything else!
- Returns
- (none)
Open whatever device is found first.
- Returns
- s_rgbled_device pointer if successful, NULL pointer if failed
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
- s_rgbled_device pointer if successful, NULL pointer if failed
Open device using its position/index in the list of devices found by rgbledctrl_find().
- Parameters
-
- Returns
- s_rgbled_device pointer if successful, NULL pointer if failed
Check if the device is still connected.
- Parameters
-
[device] | Device to operate on |
- Returns
- true if connected, false if not
- Todo:
- Optional auto-reconnect
Reset device (makes the watchdog timer timeout).
- Parameters
-
[device] | Device to operate on |
- Returns
- true on success, false on failure
bool rgbledctrl_sameDevice |
( |
usb_dev_handle * |
handle1, |
|
|
usb_dev_handle * |
handle2 |
|
) |
| |
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
Set blue brightness
- Parameters
-
[device] | Device to operate on |
[value] | Brightness |
- Returns
- true on success, false on failure
Set green brightness
- Parameters
-
[device] | Device to operate on |
[value] | Brightness |
- Returns
- true on success, false on failure
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
-
[device] | Device to operate on |
[time] | Timeout |
- Returns
- true on success, false on failure
Set red brightness
- Parameters
-
[device] | Device to operate on |
[value] | Brightness |
- Returns
- true on success, false on failure
Set red, green and blue brightnesses in one go
- Parameters
-
[device] | Device to operate on |
[colour] | Pointer to s_rgbVal structure |
- Returns
- true on success, false on failure