void CFastLED::setTemperature(const struct CRGB & temp) { CLEDController *pCur = CLEDController::head(); while(pCur) { pCur->setTemperature(temp); pCur = pCur->next(); } }
void CFastLED::showColor(const struct CRGB & color, uint8_t scale) { CLEDController *pCur = CLEDController::head(); while(pCur) { pCur->showColor(color, scale); pCur = pCur->next(); } }
void CFastLED::clearData() { CLEDController *pCur = CLEDController::head(); while(pCur) { pCur->clearLedData(); pCur = pCur->next(); } }
void CFastLED::show(uint8_t scale) { CLEDController *pCur = CLEDController::head(); while(pCur) { pCur->showLeds(scale); pCur = pCur->next(); } }
void CFastLED::setDither(uint8_t ditherMode) { CLEDController *pCur = CLEDController::head(); while(pCur) { pCur->setDither(ditherMode); pCur = pCur->next(); } }
void CFastLED::setCorrection(const struct CRGB & correction) { CLEDController *pCur = CLEDController::head(); while(pCur) { pCur->setCorrection(correction); pCur = pCur->next(); } }
// sets brightness to // - no more than target_brightness // - no more than max_mW milliwatts uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32_t max_power_mW) { uint32_t total_mW = gMCU_mW; CLEDController *pCur = CLEDController::head(); while(pCur) { total_mW += calculate_unscaled_power_mW( pCur->leds(), pCur->size()); pCur = pCur->next(); } #if POWER_DEBUG_PRINT == 1 Serial.print("power demand at full brightness mW = "); Serial.println( total_mW); #endif uint32_t requested_power_mW = ((uint32_t)total_mW * target_brightness) / 256; #if POWER_DEBUG_PRINT == 1 if( target_brightness != 255 ) { Serial.print("power demand at scaled brightness mW = "); Serial.println( requested_power_mW); } Serial.print("power limit mW = "); Serial.println( max_power_mW); #endif if( requested_power_mW < max_power_mW) { #if POWER_LED > 0 if( gMaxPowerIndicatorLEDPinNumber ) { digitalWrite(gMaxPowerIndicatorLEDPinNumber, LOW); // turn the LED off } #endif #if POWER_DEBUG_PRINT == 1 Serial.print("demand is under the limit"); #endif return target_brightness; } uint8_t recommended_brightness = (uint32_t)((uint8_t)(target_brightness) * (uint32_t)(max_power_mW)) / ((uint32_t)(requested_power_mW)); #if POWER_DEBUG_PRINT == 1 Serial.print("recommended brightness # = "); Serial.println( recommended_brightness); uint32_t resultant_power_mW = (total_mW * recommended_brightness) / 256; Serial.print("resultant power demand mW = "); Serial.println( resultant_power_mW); Serial.println(); #endif #if POWER_LED > 0 if( gMaxPowerIndicatorLEDPinNumber ) { digitalWrite( gMaxPowerIndicatorLEDPinNumber, HIGH); // turn the LED on } #endif return recommended_brightness; }
int CFastLED::count() { int x = 0; CLEDController *pCur = CLEDController::head(); while( pCur) { x++; pCur = pCur->next(); } return x; }
CLEDController & CFastLED::operator[](int x) { CLEDController *pCur = CLEDController::head(); while(x-- && pCur) { pCur = pCur->next(); } if(pCur == NULL) { return *(CLEDController::head()); } else { return *pCur; } }
void CFastLED::showColor(const struct CRGB & color, uint8_t scale) { while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros)); lastshow = micros(); // If we have a function for computing power, use it! if(m_pPowerFunc) { scale = (*m_pPowerFunc)(scale, m_nPowerData); } CLEDController *pCur = CLEDController::head(); while(pCur) { uint8_t d = pCur->getDither(); if(m_nFPS < 100) { pCur->setDither(0); } pCur->showColor(color, scale); pCur->setDither(d); pCur = pCur->next(); } countFPS(); }
void CFastLED::show(uint8_t scale) { // guard against showing too rapidly while(m_nMinMicros && ((micros()-lastshow) < m_nMinMicros)); lastshow = micros(); // If we have a function for computing power, use it! if(m_pPowerFunc) { scale = (*m_pPowerFunc)(scale, m_nPowerData); } CLEDController *pCur = CLEDController::head(); while(pCur) { uint8_t d = pCur->getDither(); if(m_nFPS < 100) { pCur->setDither(0); } pCur->showLeds(scale); pCur->setDither(d); pCur = pCur->next(); } countFPS(); }