FastLED 3.9.7
Loading...
Searching...
No Matches
power_mgt.cpp File Reference

Detailed Description

Functions to limit the power used by FastLED.

Definition in file power_mgt.cpp.

#include "FastLED.h"
#include "power_mgt.h"
#include "fl/namespace.h"

Go to the source code of this file.

Macros

#define FASTLED_INTERNAL
 Disables pragma messages and warnings.
 
#define POWER_LED   1
 Debug Option: Set to 1 to enable the power limiting LED.
 
#define POWER_DEBUG_PRINT   0
 Debug Option: Set to enable Serial debug statements for power limit functions.
 

Functions

uint32_t calculate_unscaled_power_mW (const CRGB *ledbuffer, uint16_t numLeds)
 Determines how many milliwatts the current LED data would draw at max brightness (255)
 
uint8_t calculate_max_brightness_for_power_vmA (const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_V, uint32_t max_power_mA)
 Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs.
 
uint8_t calculate_max_brightness_for_power_mW (const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW)
 Determines the highest brightness level you can use and still stay under the specified power budget for a given set of LEDs.
 
uint8_t calculate_max_brightness_for_power_mW (uint8_t target_brightness, uint32_t max_power_mW)
 Determines the highest brightness level you can use and still stay under the specified power budget for all sets of LEDs.
 
void set_max_power_indicator_LED (uint8_t pinNumber)
 Select a pin with an LED that will be flashed to indicate that power management is pulling down the brightness.
 
void set_max_power_in_volts_and_milliamps (uint8_t volts, uint32_t milliamps)
 Set the maximum power used in milliamps for a given voltage.
 
void set_max_power_in_milliwatts (uint32_t powerInmW)
 Set the maximum power used in watts.
 
void show_at_max_brightness_for_power ()
 Similar to CFastLED::show(), but pre-adjusts brightness to keep below the power threshold.
 
void delay_at_max_brightness_for_power (uint16_t ms)
 Similar to CFastLED::delay(), but pre-adjusts brightness to keep below the power threshold.
 

Macro Definition Documentation

◆ FASTLED_INTERNAL

#define FASTLED_INTERNAL

Disables pragma messages and warnings.

Definition at line 5 of file power_mgt.cpp.

◆ POWER_DEBUG_PRINT

#define POWER_DEBUG_PRINT   0

Debug Option: Set to enable Serial debug statements for power limit functions.

Definition at line 52 of file power_mgt.cpp.

◆ POWER_LED

#define POWER_LED   1

Debug Option: Set to 1 to enable the power limiting LED.

See also
set_max_power_indicator_LED()

Definition at line 49 of file power_mgt.cpp.