// ok no namespace fl
#pragma once

#include "platforms/esp/is_esp.h"

// The WS2812 family of chipsets is special! Why?
// Because it's super cheap. So we optimize it heavily.
//
// After this header is included, the following will be defined:
// FASTLED_WS2812_HAS_SPECIAL_DRIVER (either 1 or 0)
// If FASTLED_WS2812_HAS_SPECIAL_DRIVER is 0, then a default driver
// will be used, otherwise the platform provides a special driver.

#include "fl/stl/int.h"
#include "eorder.h"

#ifndef FASTLED_OVERCLOCK
#error "This needs to be included by chipsets.h when FASTLED_OVERCLOCK is defined"
#endif

// NOTE: FASTLED_ESP32_LCD_DRIVER and FASTLED_USES_ESP32S3_I2S are now handled
// by the channel driver priority system. Define these macros to force the
// I2S LCD_CAM driver to highest priority (see enabled.h for details).
// The old per-controller template overrides have been removed.
#if (defined(PICO_RP2040) || defined(PICO_RP2350) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_RP2350)) && defined(FASTLED_RP2040_CLOCKLESS_PIO_AUTO)
#include "platforms/arm/rp/rpcommon/clockless_rp_pio_auto.h"
// Explicit name for RP2040/RP2350 PIO automatic parallel WS2812 controller
template <fl::u8 DATA_PIN, EOrder RGB_ORDER = fl::EOrder::GRB>
class WS2812RP2040Auto:
	public fl::ClocklessController_RP2040_PIO_WS2812<
		DATA_PIN,
		RGB_ORDER
	> {};
// Default WS2812 controller typedef (selects automatic parallel PIO on RP2040/RP2350)
template <fl::u8 DATA_PIN, EOrder RGB_ORDER = fl::EOrder::GRB>
using WS2812Controller800Khz = WS2812RP2040Auto<DATA_PIN, RGB_ORDER>;
#define FASTLED_WS2812_HAS_SPECIAL_DRIVER 1
#elif defined(FASTLED_USE_ADAFRUIT_NEOPIXEL)
#include "platforms/adafruit/clockless.h"
// Explicit name for Adafruit NeoPixel-based WS2812 controller
template <fl::u8 DATA_PIN, EOrder RGB_ORDER = fl::EOrder::GRB>
class WS2812Adafruit : public fl::AdafruitWS2812Controller<DATA_PIN, RGB_ORDER> {};
// Default WS2812 controller typedef (selects Adafruit driver)
template <fl::u8 DATA_PIN, EOrder RGB_ORDER = fl::EOrder::GRB>
using WS2812Controller800Khz = WS2812Adafruit<DATA_PIN, RGB_ORDER>;
#define FASTLED_WS2812_HAS_SPECIAL_DRIVER 1
#else
#define FASTLED_WS2812_HAS_SPECIAL_DRIVER 0
#endif  // platform-specific WS2812 drivers
