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


#include <eCxx/eCxx_ColorSpace.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 WS2812B LED matrix test application
//
#include "../CommonCode/WS2812BMatrix_Common.h"


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

    // Initialize the driver
    ws2812b.begin( PIN_WS2812B, cfx.BufferElementCount, cfx.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 matrix animation
    eCxx_user_task_updateWS2812BLEDMatrixAnimation();
}
