Prusa MINI Firmware overview
LEDColor Struct Reference

#include <leds.h>

Collaboration diagram for LEDColor:

Public Member Functions

 LEDColor ()
 
 LEDColor (uint8_t r, uint8_t g, uint8_t b)
 
 LEDColor (const uint8_t(&rgbw)[4])
 
LEDColoroperator= (const uint8_t(&rgbw)[4])
 
LEDColoroperator= (const LEDColor &right)
 
bool operator== (const LEDColor &right)
 
bool operator!= (const LEDColor &right)
 
bool is_off () const
 

Public Attributes

uint8_t r
 
uint8_t g
 
uint8_t b
 

Detailed Description

LEDcolor type for use with leds.set_color

Constructor & Destructor Documentation

◆ LEDColor() [1/3]

LEDColor::LEDColor ( )
51  : r(255), g(255), b(255)
52  #if HAS_WHITE_LED
53  , w(255)
54  #if ENABLED(NEOPIXEL_LED)
55  , i(NEOPIXEL_BRIGHTNESS)
56  #endif
57  #endif
58  {}

◆ LEDColor() [2/3]

LEDColor::LEDColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
67  : r(r), g(g), b(b)
68  #if HAS_WHITE_LED
69  , w(w)
70  #if ENABLED(NEOPIXEL_LED)
71  , i(i)
72  #endif
73  #endif
74  {}

◆ LEDColor() [3/3]

LEDColor::LEDColor ( const uint8_t(&)  rgbw[4])
76  : r(rgbw[0]), g(rgbw[1]), b(rgbw[2])
77  #if HAS_WHITE_LED
78  , w(rgbw[3])
79  #if ENABLED(NEOPIXEL_LED)
80  , i(NEOPIXEL_BRIGHTNESS)
81  #endif
82  #endif
83  {}

Member Function Documentation

◆ operator=() [1/2]

LEDColor& LEDColor::operator= ( const uint8_t(&)  rgbw[4])
85  {
86  r = rgbw[0]; g = rgbw[1]; b = rgbw[2];
87  #if HAS_WHITE_LED
88  w = rgbw[3];
89  #endif
90  return *this;
91  }

◆ operator=() [2/2]

LEDColor& LEDColor::operator= ( const LEDColor right)
93  {
94  if (this != &right) memcpy(this, &right, sizeof(LEDColor));
95  return *this;
96  }

◆ operator==()

bool LEDColor::operator== ( const LEDColor right)
98  {
99  if (this == &right) return true;
100  return 0 == memcmp(this, &right, sizeof(LEDColor));
101  }
Here is the caller graph for this function:

◆ operator!=()

bool LEDColor::operator!= ( const LEDColor right)
103 { return !operator==(right); }
Here is the call graph for this function:

◆ is_off()

bool LEDColor::is_off ( ) const
105  {
106  return 3 > r + g + b
107  #if HAS_WHITE_LED
108  + w
109  #endif
110  ;
111  }

Member Data Documentation

◆ r

uint8_t LEDColor::r

◆ g

uint8_t LEDColor::g

◆ b

uint8_t LEDColor::b
LEDColor::r
uint8_t r
Definition: leds.h:42
LEDColor::operator==
bool operator==(const LEDColor &right)
Definition: leds.h:98
i
uint8_t i
Definition: screen_test_graph.c:72
LEDColor::b
uint8_t b
Definition: leds.h:42
LEDColor
Definition: leds.h:41
LEDColor::g
uint8_t g
Definition: leds.h:42