FastLED  3.1
power_mgt.h
1 #ifndef POWER_MGT_H
2 #define POWER_MGT_H
3 
4 #include "FastLED.h"
5 
6 #include "pixeltypes.h"
7 
8 FASTLED_NAMESPACE_BEGIN
9 
13 
14 // Power Control setup functions
15 //
16 // Example:
17 // set_max_power_in_volts_and_milliamps( 5, 400);
18 //
19 
22 void set_max_power_in_volts_and_milliamps( uint8_t volts, uint32_t milliamps);
24 void set_max_power_in_milliwatts( uint32_t powerInmW);
25 
29 void set_max_power_indicator_LED( uint8_t pinNumber); // zero = no indicator LED
30 
31 
32 // Power Control 'show' and 'delay' functions
33 //
34 // These are drop-in replacements for FastLED.show() and FastLED.delay()
35 // In order to use these, you have to actually replace your calls to
36 // FastLED.show() and FastLED.delay() with these two functions.
37 //
38 // Example:
39 // // was: FastLED.show();
40 // // now is:
41 // show_at_max_brightness_for_power();
42 //
43 
51 void delay_at_max_brightness_for_power( uint16_t ms);
52 
53 
54 // Power Control internal helper functions
55 
59 uint32_t calculate_unscaled_power_mW( const CRGB* ledbuffer, uint16_t numLeds);
60 
67 uint8_t calculate_max_brightness_for_power_mW(const CRGB* ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW);
68 
75 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);
76 
82 uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32_t max_power_mW);
83 
84 FASTLED_NAMESPACE_END
86 // POWER_MGT_H
87 
88 #endif
Representation of an RGB pixel (Red, Green, Blue)
Definition: pixeltypes.h:90
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)
calculate_max_brightness_for_power_mW tells you the highest brightness level you can use and still st...
Definition: power_mgt.cpp:80
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.
Definition: power_mgt.cpp:164
void delay_at_max_brightness_for_power(uint16_t ms)
Similar to FastLED.delay, but pre-adjusts brightness to keep below the power threshold.
Definition: power_mgt.cpp:180
void set_max_power_indicator_LED(uint8_t pinNumber)
Select a ping with an led that will be flashed to indicate that power management is pulling down the ...
Definition: power_mgt.cpp:159
uint8_t calculate_max_brightness_for_power_mW(const CRGB *ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW)
calculate_max_brightness_for_power_mW tells you the highest brightness level you can use and still st...
Definition: power_mgt.cpp:84
uint32_t calculate_unscaled_power_mW(const CRGB *ledbuffer, uint16_t numLeds)
calculate_unscaled_power_mW tells you how many milliwatts the current LED data would draw at brightne...
Definition: power_mgt.cpp:50
central include file for FastLED, defines the CFastLED class/object
void show_at_max_brightness_for_power()
Similar to FastLED.show, but pre-adjusts brightness to keep below the power threshold.
Definition: power_mgt.cpp:174
void set_max_power_in_milliwatts(uint32_t powerInmW)
Set the maximum power used in watts.
Definition: power_mgt.cpp:169