RGB LED Lighting Shield Class.
More...
#include <rgb-led-lighting-shield.hpp>
RGB LED Lighting Shield Class.
This class defines the XMC-RGB-LED-Lighting-Shield from Infineon with all its functionality
◆ RGBShield()
RGBShield::RGBShield |
( |
I2CPAL * |
i2c | ) |
|
Constructor of the RGBShield-Class.
This constructor is used to create an object of the RGBShield class. It is getting a class pointer to the I2C-Class which is given to the private IC2-class-pointer. It is also initializing the status of the shield to UNINITED, because the board is not yet initialized.
- Parameters
-
[in] | *i2c | Pointer to a I2C instance |
◆ ~RGBShield()
RGBShield::~RGBShield |
( |
| ) |
|
Destructor of the RGBShield-Class.
This destructor is used to destruct the object of the RGBShield class.
◆ init()
Error_t RGBShield::init |
( |
| ) |
|
Initialization.
This function is initializing the I2C instance given in the constructor as well as all private membervariables of the class. It is also changing the board status to enable, which means the board is ready to operate. Furthermore, the function is setting the maximum current ratings for the shield as well as the off-times of the channels. It is also setting the brightness of the shield to zero.
- Returns
- Error_t
◆ deinit()
Error_t RGBShield::deinit |
( |
| ) |
|
Deinitialization.
This function deinitializes the IC2 instance given in the constructor. It is also setting the shieldstate back to uninitialize.
- Returns
- Error_t
◆ setIntensityRGB()
Error_t RGBShield::setIntensityRGB |
( |
uint16_t |
red, |
|
|
uint16_t |
green, |
|
|
uint16_t |
blue |
|
) |
| |
Set intensity of all channels.
This functions is setting the intensity of the red-, green- and blue-channel. You have to pass a 12-bit value for every channel to the function. The maximum value is therefore 0xFFF (4095 Dec) for every channel.
- Parameters
-
[in] | red | Intensity of the red-channel. Range is 0x000 to 0xFFF |
[in] | green | Intensity of the green-channel. Range is 0x000 to 0xFFF |
[in] | blue | Intensity of the blue-channel. Range is 0x000 to 0xFFF |
- Returns
- Error_t
◆ setIntensityRed()
Error_t RGBShield::setIntensityRed |
( |
uint16_t |
red | ) |
|
Set intensity of the red-channel.
This function is setting the intensity of the red-channel. You have to pass a 12-bit value. Therefore, the maximum value is 0xFFF (4095 Dec)
- Parameters
-
[in] | red | Intensity of the red-channel. Range is 0x000 to 0xFFF. |
- Returns
- Error_t
◆ setIntensityGreen()
Error_t RGBShield::setIntensityGreen |
( |
uint16_t |
green | ) |
|
Set intensity of the green-channel.
This function is setting the intensity of the green-channel. You have to pass a 12-bit value. Therefore, the maximum value is 0xFFF (4095 Dec)
- Parameters
-
[in] | green | Intensity of the green-channel. Range is 0x000 to 0xFFF. |
- Returns
- Error_t
◆ setIntensityBlue()
Error_t RGBShield::setIntensityBlue |
( |
uint16_t |
blue | ) |
|
Set intensity of the blue-channel.
This function is setting the intensity of the blue-channel. You have to pass a 12-bit value. Therefore, the maximum value is 0xFFF (4095 Dec)
- Parameters
-
[in] | blue | Intensity of the blue-channel. Range is 0x000 to 0xFFF. |
- Returns
- Error_t
◆ setDimmingLevel()
Error_t RGBShield::setDimmingLevel |
( |
uint16_t |
level | ) |
|
Set dimming level.
This function is setting the dimming level of the shield. A low value means a low brightness of the LEDs, a high value means bright LEDs. The dimming level is a 12-bit value, therefore the maximum value is 0xFFF (4095 Dec).
- Parameters
-
[in] | level | Brightness of the LEDs. Range is 0x000 to 0xFFF. |
- Returns
- Error_t
◆ setOffTimesRGB()
Error_t RGBShield::setOffTimesRGB |
( |
uint16_t |
red, |
|
|
uint16_t |
green, |
|
|
uint16_t |
blue |
|
) |
| |
Set off-time for the three channels.
This function is setting the off-time for all three channels of the RGB-Shield. The off-time is influencing the current ripple on the channel and should be adjusted to the used LEDs accordingly. For more details take a look into the datasheet on page 23.
- Parameters
-
[in] | red | Off-time of the red channel. Range is 0x000 to 0xFFF. |
[in] | green | Off-time of the green channel. Range is 0x000 to 0xFFF. |
[in] | blue | Off-time of the blue channel. Range is 0x000 to 0xFFF. |
- Returns
- Error_t
◆ setCurrentRGB()
Error_t RGBShield::setCurrentRGB |
( |
uint16_t |
red, |
|
|
uint16_t |
green, |
|
|
uint16_t |
blue |
|
) |
| |
Set peak-current for the three channels.
This function is setting the peak-current value of each channel. This value is limmiting the current that flowing through the LEDs. If one of the channels exceeds the set limitation the channel will turn off. The maximum value for one channel is 0x80, which results in a theoretical peak-current of 781 mA (see board manual page 22 for more details).
- Parameters
-
[in] | red | Peak-Current for the red channel. Range is 0x000 0x80. |
[in] | green | Peak-Current for the green channel. Range is 0x000 0x80. |
[in] | blue | Peak-Current for the blue channel. Range is 0x000 0x80. |
- Returns
- Error_t
◆ setFadeRate()
Error_t RGBShield::setFadeRate |
( |
uint16_t |
fRate | ) |
|
Set the fade rate of the board.
This function is setting the fade rate of the board. The fade rate controlls how fast the LEDs can change the brightness. On page 31 of the board manual is a description how to calculate the time.
- Parameters
-
[in] | fRate | Value of the fade rate. Range is 0x000 to 0x3FF (10-bit). |
- Returns
- Error_t
◆ setWalkTime()
Error_t RGBShield::setWalkTime |
( |
uint16_t |
wTime | ) |
|
Set the walk-time of the board.
This functions is setting the walk-time of the board. The walk-time is setting the length of the linear walk. A linear walk can be used to smoothly change the color intensity. For more information take a look at the manual page 25.
- Parameters
-
[in] | wTime | Walk time of the board. Range is 0x000 to 0xFFF. |
- Returns
- Error_t
◆ saveParameters()
Error_t RGBShield::saveParameters |
( |
| ) |
|
Save the current parameters.
This functions is used to save the current parameters to the flash memory of the board. It can be called if the current settings should be saved for the future.
- Returns
- Error_t
◆ setColor()
Error_t RGBShield::setColor |
( |
uint16_t |
color | ) |
|
Set a predefined color.
This function is setting a predefined color. The available colors can be found in the enum "colors_t" in the rgb-led-lighting-shield-reg.hpp-file.
- Parameters
-
[in] | color | Predefined color. |
- Returns
- Error_t
◆ _shieldState
Variable to store the status of the shield
◆ _boardI2C
Class pointer to the I2CPAL class
◆ _redCurr
uint16_t RGBShield::_redCurr |
|
protected |
Variable to store the peak current reference for the red channel
◆ _greenCurr
uint16_t RGBShield::_greenCurr |
|
protected |
Variable to store the peak current reference for the green channel
◆ _blueCurr
uint16_t RGBShield::_blueCurr |
|
protected |
Variable to store the peak current reference for the blue channel
◆ _redOff
uint16_t RGBShield::_redOff |
|
protected |
Variable to store the off-time of the red channel
◆ _greenOff
uint16_t RGBShield::_greenOff |
|
protected |
Variable to store the off-time of the green channel
◆ _blueOff
uint16_t RGBShield::_blueOff |
|
protected |
Variable to store the off-time of the blue channel
◆ _redInt
uint16_t RGBShield::_redInt |
|
protected |
Variable to store the intensity for the red channel
◆ _greenInt
uint16_t RGBShield::_greenInt |
|
protected |
Variable to store the intensity for the green channel
◆ _blueInt
uint16_t RGBShield::_blueInt |
|
protected |
Variable to store the intensity for the blue channel
◆ _fadeTime
uint16_t RGBShield::_fadeTime |
|
protected |
Variable to store the fadetime
◆ _walk
uint16_t RGBShield::_walk |
|
protected |
Variable to store the walktime
◆ _brightness
uint16_t RGBShield::_brightness |
|
protected |
Variable to store the _brightness
The documentation for this class was generated from the following files: