/*
 * Atm_led_mcp.cpp
 *
 *  Created on: 09.12.2017
 *      Author: ian
 */

#ifdef FASTLED_INTERNAL

#include <Atm_led_WS2812.h>
#include <Atm_led.hpp>

Atm_led_WS2812::Atm_led_WS2812(CRGB& _leds ):
	Atm_led(),
	leds(_leds) {
	// nothing to see here
}

void Atm_led_WS2812::initLED() {
	leds = CRGB::White;
	FastLED.show() ;
	//Serial.printf("WS2812 init  %x\n", pin);
}

void Atm_led_WS2812::switchOn() {
	color.val = pwm_max ;
	leds = color ;
	FastLED.show() ;
}

void Atm_led_WS2812::switchOff() {
	color.val = pwm_min ;
	leds = color ;
	FastLED.show() ;
}

void Atm_led_WS2812::setBrightness(int value) {
	color.val = value ;
	leds = color ;
	// leds[pin].r = r;
	// leds[pin].g = g;
	// leds[pin].b = b;
	FastLED.show() ;
}

Atm_led_WS2812& Atm_led_WS2812::setMinMax(int min, int max) {
	this->pwm_min = min ;
	this->pwm_max = max ;
	return *this;
}

Atm_led_WS2812& Atm_led_WS2812::setHueSat(int hue, int sat) {
	this->color.hue = hue ;
	this->color.sat = sat ;
	return *this;
}

#endif