roneos
Operating System for the r-one robot
 All Data Structures Files Functions Variables Typedefs Groups
leds.h File Reference

Interface function for LEDs on the robot. More...

Go to the source code of this file.

Functions

void ledsInit (void)
 Initializes the LEDs. More...
 
void ledsSetSingle (uint32 led_idx, uint32 dimmer)
 Sets the brightness of a specified dimmer. More...
 
void ledSetGroup (uint32 led_color, uint32 dimmer)
 Sets the brightness of all dimmers of a specified color. More...
 
void ledsSetBinary (uint8 r, uint8 g, uint8 b)
 Turns LEDS on or off depending on the input values for each grouping. More...
 
void ledsSetAll (uint32 dimmer)
 Sets the brightness of all dimmers on the robot. More...
 
void ledsSetPattern (uint8 color, uint8 pattern, uint8 brightness, uint8 rate)
 Sets the properties of the LED animation if remote control mode is off. More...
 
uint8 ledStartIdx (uint8 color)
 Gets the start index of the LEDs for the input color group. More...
 
void ledsUpdate (void)
 Updates LED animation. More...
 
void ledsBuildMessage (uint8 *msg)
 Build LED message. More...
 

Detailed Description

Interface function for LEDs on the robot.

Since
Mar 22, 2011
Author
James McLurkin

Function Documentation

void ledsBuildMessage ( uint8 *  msg)

Build LED message.

Blue, green, red.

Parameters
msgpointer for the message
Returns
void
void ledSetGroup ( uint32  led_color,
uint32  dimmer 
)

Sets the brightness of all dimmers of a specified color.

If the specified color does not match the existing colors, does nothing.

Parameters
led_colorspecifies the dimmer color to be set
dimmerbrightness to be set
Returns
void
void ledsInit ( void  )

Initializes the LEDs.

Configure the LED_MODE pin as output. Turns off all dimmer. Latches dimmer data. Latches on/off data with a mask (FFFF). Sets the LED properties - color red, pattern circle, brightness high, and rate fast.

Returns
void
void ledsSetAll ( uint32  dimmer)

Sets the brightness of all dimmers on the robot.

Parameters
dimmerthe brightness to be set
Returns
void
void ledsSetBinary ( uint8  r,
uint8  g,
uint8  b 
)

Turns LEDS on or off depending on the input values for each grouping.

For example, a 1 for the red leds indicates the first led will be on. A 3 for the blue leds will turn on the second led. A 5 for the green will turn on the first and third leds.

Parameters
rbinary pattern for red leds
gbinary pattern for green leds
bbinary pattern for blue leds
Returns
void
void ledsSetPattern ( uint8  color,
uint8  pattern,
uint8  brightness,
uint8  rate 
)

Sets the properties of the LED animation if remote control mode is off.

Sets the color, patter, brightness, and rate of the LED animation.

Parameters
colorwhich color group to set
patternlights can run in patterns such as circle/all/etc.
brightnessthe brightness to set the pattern
ratethe speed at which the pattern cycles
Returns
void
void ledsSetSingle ( uint32  led_idx,
uint32  dimmer 
)

Sets the brightness of a specified dimmer.

If the index exceeds the number of elements in the LED (16), does nothing. If the value exceeds the maximum brightness(7F), uses the maximum as the value instead.

Parameters
led_idxindicates which dimmer's brightness is to be set
dimmerbrightness to be set
Returns
void
uint8 ledStartIdx ( uint8  color)

Gets the start index of the LEDs for the input color group.

Default will return the red LED start index

Parameters
colorto find the start index of
Returns
the start index of the LEDs
void ledsUpdate ( void  )

Updates LED animation.

Updates LED animation according to the color, pattern, brightness, and rate previously set. Sets properties using the ledsSetPattern function.

Returns
void