Veethree D7 SDK
Loading...
Searching...
No Matches
vsdk::sys::rgb_button_backlight Class Reference

Detailed Description

The rgb_button_backlight class.

This class is responsible for setting a button backlight colour. Once a button colour is set, the class caches the last value set so it is possible to know the button backlight state.

button1 (index 0) is the top most button, button6 (index 5) is the bottom most button. There are 6 buttons in total (use button_count).

void fn()
{
using namespace vsdk::sys;
btn1.set_colour(0, 255, 0);
//...
auto const [r, g, b] = btn1.colour();
}
rgb_button_backlight interface.
rgb_button_backlight(uint32_t id)
The class constructor.
Any entities that belong to the system library.

#include <button_backlight.h>

Public Member Functions

 rgb_button_backlight (uint32_t id)
 The class constructor.
 rgb_button_backlight (rgb_button_backlight &&) noexcept
 The class move constructor.
 ~rgb_button_backlight () noexcept
 The class destructor.
 rgb_button_backlight (const rgb_button_backlight &)=delete
rgb_button_backlight & operator= (const rgb_button_backlight &)=delete
rgb_button_backlight & operator= (rgb_button_backlight &&) noexcept
 The class move assignment operator.
void set_colour (uint8_t red, uint8_t green, uint8_t blue)
 Set all colour components.
std::tuple< uint8_t, uint8_t, uint8_t > colour () const
 Get all colour components as a std::tuple.
uint32_t id () const
 Return the button id assigned to the object on its instantiation.
void set_red (uint8_t r)
 Set individual colour components (0-255).
void set_green (uint8_t g)
 Set individual colour components (0-255).
void set_blue (uint8_t b)
 Set individual colour components (0-255).
uint8_t red () const
 Return an individual colour component (0-255).
uint8_t green () const
 Return an individual colour component (0-255).
uint8_t blue () const
 Return an individual colour component (0-255).

Static Public Attributes

static constexpr uint32_t button_count { 6 }
 button_count Total button available in the device.
static constexpr uint32_t button1 { 0 }
 Button constants.
static constexpr uint32_t button2 { 1 }
 Button constants.
static constexpr uint32_t button3 { 2 }
 Button constants.
static constexpr uint32_t button4 { 3 }
 Button constants.
static constexpr uint32_t button5 { 4 }
 Button constants.
static constexpr uint32_t button6 { 5 }
 Button constants.

Detailed Description

The rgb_button_backlight class.

This class is responsible for setting a button backlight colour. Once a button colour is set, the class caches the last value set so it is possible to know the button backlight state.

button1 (index 0) is the top most button, button6 (index 5) is the bottom most button. There are 6 buttons in total (use button_count).

void fn()
{
using namespace vsdk::sys;
btn1.set_colour(0, 255, 0);
//...
auto const [r, g, b] = btn1.colour();
}

Constructor & Destructor Documentation

◆ rgb_button_backlight()

vsdk::sys::rgb_button_backlight::rgb_button_backlight ( uint32_t id)
explicit

The class constructor.

Parameters
idThe button Id.

Member Function Documentation

◆ colour()

std::tuple< uint8_t, uint8_t, uint8_t > vsdk::sys::rgb_button_backlight::colour ( ) const

Get all colour components as a std::tuple.

It is recommended to use structured binding with this function. For example:

auto [r, g, b] = obj.colour();
Returns
Return all colour components as a std::tuple, use structured binding.

◆ id()

uint32_t vsdk::sys::rgb_button_backlight::id ( ) const

Return the button id assigned to the object on its instantiation.

Returns
Return the button id.

◆ set_colour()

void vsdk::sys::rgb_button_backlight::set_colour ( uint8_t red,
uint8_t green,
uint8_t blue )

Set all colour components.

Parameters
redThe red component (0-255)
greenThe green component (0-255)
blueThe blue component (0-255)

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