Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

dLight Sensor
[Dexter Industries]

Files

file  dexterind-dlight.h
 

Dexter Industries dLight Sensor Driver.


Defines

#define DLIGHT_I2C_ADDR_ALL   0xE0
#define DLIGHT_I2C_ADDR_1   0x04
#define DLIGHT_I2C_ADDR_2   0x14
#define DLIGHT_I2C_ADDR_3   0x24
#define DLIGHT_I2C_ADDR_4   0x34
#define DLIGHT_REG_MODE1   0x80
#define DLIGHT_REG_MODE2   0x81
#define DLIGHT_REG_RED   0x82
#define DLIGHT_REG_GREEN   0x83
#define DLIGHT_REG_BLUE   0x84
#define DLIGHT_REG_EXTERNAL   0x85
#define DLIGHT_REG_BPCT   0x86
#define DLIGHT_REG_BFREQ   0x87
#define DLIGHT_REG_LEDOUT   0x88
#define DLIGHT_CMD_DISABLE_LEDS   0x00
#define DLIGHT_CMD_DISABLE_BLINK   0xAA
#define DLIGHT_CMD_ENABLE_BLINK   0xFF

Functions

bool DLIGHTinit (tSensors link, ubyte addr)
bool DLIGHTsetColor (tSensors link, ubyte addr, ubyte r, ubyte g, ubyte b)
bool DLIGHTsetExternal (tSensors link, ubyte addr, ubyte external)
bool DLIGHTsetBlinking (tSensors link, ubyte addr, float BlinkRate, long DutyCycle)
bool DLIGHTstartBlinking (tSensors link, ubyte addr)
bool DLIGHTstopBlinking (tSensors link, ubyte addr)
bool DLIGHTdisable (tSensors link, ubyte addr)

Variables

tByteArray DLIGHT_I2CRequest

Detailed Description

Dexter Industries dLight Sensor Driver


Define Documentation

#define DLIGHT_CMD_DISABLE_BLINK   0xAA

dLight cmmand to disable blinking

Definition at line 64 of file dexterind-dlight.h.

#define DLIGHT_CMD_DISABLE_LEDS   0x00

dLight cmmand to disable the LEDs completely

Definition at line 63 of file dexterind-dlight.h.

#define DLIGHT_CMD_ENABLE_BLINK   0xFF

dLight cmmand to enable blinking

Definition at line 65 of file dexterind-dlight.h.

#define DLIGHT_I2C_ADDR_1   0x04

dLight I2C device address for device 1 (the NXT adapter)

Definition at line 48 of file dexterind-dlight.h.

#define DLIGHT_I2C_ADDR_2   0x14

dLight I2C device address for device 2

Definition at line 49 of file dexterind-dlight.h.

#define DLIGHT_I2C_ADDR_3   0x24

dLight I2C device address for device 3

Definition at line 50 of file dexterind-dlight.h.

#define DLIGHT_I2C_ADDR_4   0x34

dLight I2C device address for device 4

Definition at line 51 of file dexterind-dlight.h.

#define DLIGHT_I2C_ADDR_ALL   0xE0

dLight I2C device address for all connected devices

Examples:
dexterind-dlight-test1.c.

Definition at line 47 of file dexterind-dlight.h.

#define DLIGHT_REG_BFREQ   0x87

dLight register to configure the blinking frequency

Definition at line 60 of file dexterind-dlight.h.

#define DLIGHT_REG_BLUE   0x84

dLight register to configure the amount of blue, 0-0xFF

Definition at line 57 of file dexterind-dlight.h.

#define DLIGHT_REG_BPCT   0x86

dLight register to configure the blinking duty cycle

Definition at line 59 of file dexterind-dlight.h.

#define DLIGHT_REG_EXTERNAL   0x85

dLight register to configure the external LED, 0-0xFF

Definition at line 58 of file dexterind-dlight.h.

#define DLIGHT_REG_GREEN   0x83

dLight register to configure the amount of green, 0-0xFF

Definition at line 56 of file dexterind-dlight.h.

#define DLIGHT_REG_LEDOUT   0x88

dLight register to configure enable/disable the LEDs and their blinking

Definition at line 61 of file dexterind-dlight.h.

#define DLIGHT_REG_MODE1   0x80

dLight register to configure autoincrement, must be set to 0x01

Definition at line 53 of file dexterind-dlight.h.

#define DLIGHT_REG_MODE2   0x81

dLight register to configure blinking, must be set to 0x25

Definition at line 54 of file dexterind-dlight.h.

#define DLIGHT_REG_RED   0x82

dLight register to configure the amount of red, 0-0xFF

Definition at line 55 of file dexterind-dlight.h.


Function Documentation

bool DLIGHTdisable ( tSensors  link,
ubyte  addr 
)

Turn off the LED

Parameters:
linkthe dLight port number
addrthe dLight I2C address
Returns:
true if no error occured, false if it did
Examples:
dexterind-dlight-test1.c.

Definition at line 193 of file dexterind-dlight.h.

bool DLIGHTinit ( tSensors  link,
ubyte  addr 
)

Initialise the dLight sensor. Turns off blinking.

Parameters:
linkthe dLight port number
addrthe dLight I2C address
Returns:
true if no error occured, false if it did
Examples:
dexterind-dlight-test1.c.

Definition at line 76 of file dexterind-dlight.h.

bool DLIGHTsetBlinking ( tSensors  link,
ubyte  addr,
float  BlinkRate,
long  DutyCycle 
)

Set the dLight to the specified RGB colour

Parameters:
linkthe dLight port number
addrthe dLight I2C address
BlinkRatethe frequency at which to blink the light (Hz)
DutyCycleduty cycle of the light in percentage
Returns:
true if no error occured, false if it did
Examples:
dexterind-dlight-test1.c.

Definition at line 143 of file dexterind-dlight.h.

bool DLIGHTsetColor ( tSensors  link,
ubyte  addr,
ubyte  r,
ubyte  g,
ubyte  b 
)

Set the dLight to the specified RGB colour

Parameters:
linkthe dLight port number
addrthe dLight I2C address
rthe red LED brightness value (0-255)
gthe green LED brightness value (0-255)
bthe blue LED brightness value (0-255)
Returns:
true if no error occured, false if it did
Examples:
dexterind-dlight-test1.c.

Definition at line 106 of file dexterind-dlight.h.

bool DLIGHTsetExternal ( tSensors  link,
ubyte  addr,
ubyte  external 
)

Set the dLight to the specified RGB colour

Parameters:
linkthe dLight port number
addrthe dLight I2C address
externalthe external LED brightness value (0-255)
Returns:
true if no error occured, false if it did

Definition at line 125 of file dexterind-dlight.h.

bool DLIGHTstartBlinking ( tSensors  link,
ubyte  addr 
)

Start blinking the LED

Parameters:
linkthe dLight port number
addrthe dLight I2C address
Returns:
true if no error occured, false if it did
Examples:
dexterind-dlight-test1.c.

Definition at line 163 of file dexterind-dlight.h.

bool DLIGHTstopBlinking ( tSensors  link,
ubyte  addr 
)

Stop blinking the LED

Parameters:
linkthe dLight port number
addrthe dLight I2C address
Returns:
true if no error occured, false if it did
Examples:
dexterind-dlight-test1.c.

Definition at line 178 of file dexterind-dlight.h.


Variable Documentation

Array to hold I2C command data

Definition at line 68 of file dexterind-dlight.h.