/*
 * Copyright (C) 2020-2021 Aloysius Indrayanto
 *
 * This file is part of the eCxx library, see LICENSE file for the license details.
 */


#include <eCxx/eCxx_ColorAnimator1D.h>
#include <eCxx/eCxx_LEDDriver.h>

#include "AVR_Common.h"


//
// Pin number
//
static constexpr eCxx::uint8_t PIN_WS2812B = 5;


//
// Include common source code for 1-dimensional animation using WS2812B LED strip test application
//
#include "../CommonCode/Anim1DWS2812B_Common.h"


//
// The init function
//
void eCxx_user_init()
{
    // Initialize application
    initBasicAVRApp();

    // Initialize the animation
    eCxx_user_init_initializeAnimation();

    // Initialize the driver
    ws2812b.begin( PIN_WS2812B, cfxLEDStrip.BufferElementCount, cfxLEDStrip.colorBufferData() );

    // Update the WS2812B for the first time (turn off all LEDs)
    ws2812b.update();
}


//
// The task function
//
void eCxx_user_task()
{
    // Process event and update the LED strip animation
    eCxx_user_task_updateAnimation();
}
