Skip to content

Commit 1b5d163

Browse files
committed
LEDOutput comments
1 parent e1c2de4 commit 1b5d163

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/AudioLibs/LEDOutput.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,23 @@ struct LEDOutputConfig {
4141
};
4242

4343
/**
44-
* @brief LEDOutput using the FastLED library. You write the data to the FFT
45-
* Stream. This displays the result of the FFT to a LED matrix.
46-
* @ingroup io
44+
* @brief LED output using the FastLED library.
4745
* @author Phil Schatzmann
4846
*/
4947
class LEDOutput {
5048
public:
49+
/// @brief Default Constructor
5150
LEDOutput() = default;
5251

53-
/// @brief Default Constructor
52+
/// @brief Constructor for FFT scenario
5453
/// @param fft
5554
LEDOutput(FFTDisplay &fft) {
5655
p_fft = &fft;
5756
cfg.update_callback = fftLEDOutput;
5857
}
5958

59+
/// @brief Constructor for VolumeOutput scenario
60+
/// @param vol
6061
LEDOutput(VolumeOutput &vol) {
6162
p_vol = &vol;
6263
cfg.update_callback = volumeLEDOutput;
@@ -68,10 +69,6 @@ class LEDOutput {
6869
/// Setup Led matrix
6970
bool begin(LEDOutputConfig config) {
7071
cfg = config;
71-
// if (!*p_fft) {
72-
// LOGE("fft not started");
73-
// return false;
74-
// }
7572
if (ledCount() == 0) {
7673
LOGE("x or y == 0");
7774
return false;
@@ -165,11 +162,10 @@ class LEDOutput {
165162
setColumnBar(max_column, currY);
166163
}
167164

168-
/// Provides access to the actual config object. E.g. to change the update
169-
/// logic
165+
/// Provides access to the actual config object. E.g. to change the update logic
170166
LEDOutputConfig &config() { return cfg; }
171167

172-
/// @brief Provodes the max magnitude
168+
///Provodes the max magnitude for both the
173169
virtual float getMaxMagnitude() {
174170
// get magnitude from
175171
if (p_vol != nullptr) {
@@ -187,6 +183,7 @@ class LEDOutput {
187183
return max;
188184
}
189185

186+
/// Provides acces to the FFTDisplay object
190187
FFTDisplay &fftDisplay() { return *p_fft; }
191188

192189
protected:
@@ -268,7 +265,7 @@ void volumeLEDOutput(LEDOutputConfig *cfg, LEDOutput *matrix) {
268265
FastLED.show();
269266
}
270267

271-
/// @brief Default logic to update the color for the indicated x,y position
268+
/// Default logic to update the color for the indicated x,y position
272269
CHSV getDefaultColor(int x, int y, int magnitude) {
273270
int color = map(magnitude, 0, 7, 255, 0);
274271
return CHSV(color, 255, 100); // blue CHSV(160, 255, 255

src/AudioLibs/LEDOutputUnoR4.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ void volumeLEDOutputUnoR4(LEDOutputUnoR4Config *cfg, LEDOutputUnoR4 *matrix);
1818
* @author Phil Schatzmann
1919
*/
2020
struct LEDOutputUnoR4Config {
21-
/// Custom callback logic to update the LEDs - by default we use
22-
/// fftLEDOutputUnoR4()
21+
/// Custom callback logic to update the LEDs when update() is called
2322
void (*update_callback)(LEDOutputUnoR4Config *cfg,
2423
LEDOutputUnoR4 *matrix) = nullptr;
2524
/// Update the leds only ever nth call
@@ -28,29 +27,32 @@ struct LEDOutputUnoR4Config {
2827
int x = 12;
2928
/// Number of LEDs in a column
3029
int y = 8;
30+
/// when true 0,0 is in the lower left corder
3131
bool y_mirror = true;
3232
/// Influences the senitivity
3333
int max_magnitude = 700;
3434
};
3535

3636
/**
37-
* @brief LEDOutputUnoR4 using the FastLED library. You write the data to the
38-
* FFT Stream. This displays the result of the FFT to a LED matrix.
37+
* @brief LED output using the R4 LED matrix library.
3938
* @ingroup io
4039
* @author Phil Schatzmann
4140
*/
4241
class LEDOutputUnoR4 {
4342

4443
public:
44+
/// @brief Default Constructor
4545
LEDOutputUnoR4() = default;
4646

47-
/// @brief Default Constructor
47+
/// @brief Constructor for FFT scenario
4848
/// @param fft
4949
LEDOutputUnoR4(FFTDisplay &fft) {
5050
p_fft = &fft;
5151
cfg.update_callback = fftLEDOutputUnoR4;
5252
}
5353

54+
/// @brief Constructor for VolumeOutput scenario
55+
/// @param vol
5456
LEDOutputUnoR4(VolumeOutput &vol) {
5557
p_vol = &vol;
5658
cfg.update_callback = volumeLEDOutputUnoR4;
@@ -59,6 +61,7 @@ class LEDOutputUnoR4 {
5961
/// Provides the default config object
6062
LEDOutputUnoR4Config defaultConfig() { return cfg; }
6163

64+
/// Starts the processing with the default configuration
6265
bool begin() { return begin(defaultConfig()); }
6366

6467
/// Setup Led matrix
@@ -70,8 +73,7 @@ class LEDOutputUnoR4 {
7073
return true;
7174
}
7275

73-
/// Updates the display by calling the update callback method: call this
74-
/// method in your loop
76+
/// Updates the display by calling the update callback method: call this method in your loop
7577
virtual void update() {
7678
if (cfg.update_callback != nullptr && count++ % cfg.update_frequency == 0) {
7779
// use custom update logic defined in config
@@ -85,7 +87,7 @@ class LEDOutputUnoR4 {
8587
return frame[x + (y * cfg.x)];
8688
}
8789

88-
/// @brief Provodes the max magnitude
90+
/// Provodes the max magnitude for the VolumeOutput and FFT scenario
8991
virtual float getMaxMagnitude() {
9092
// get magnitude from
9193
if (p_vol != nullptr) {
@@ -128,14 +130,15 @@ class LEDOutputUnoR4 {
128130
setColumnBar(max_column, currY);
129131
}
130132

131-
/// Provides access to the actual config object. E.g. to change the update
132-
/// logic
133+
/// Provides access to the actual config object. E.g. to change the update logic
133134
LEDOutputUnoR4Config &config() { return cfg; }
134135

136+
/// Update the led_matrix
135137
void display() {
136138
led_matrix.loadPixels((uint8_t *)frame.data(), cfg.x * cfg.y);
137139
}
138140

141+
/// Provides access to the FFTDisplay object
139142
FFTDisplay& fftDisplay() {
140143
return *p_fft;
141144
}

0 commit comments

Comments
 (0)