/*
 * 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_InputDevice.h>
#include <eCxx/eCxx_LEDDriver.h>

#include "AVR_Common.h"


//
// Pin numbers
//
static constexpr eCxx::uint8_t PIN_DATA  = 5;
static constexpr eCxx::uint8_t PIN_CLOCK = 6;
static constexpr eCxx::uint8_t PIN_LATCH = 7;

#ifndef __AVR_ARCH_X__

// ATmega328P : these eCxx pin numbers are the same as the pin numbers on the
//              silkscreen of Arduino and compatible boards
static constexpr eCxx::uint8_t INP_SW =  4;

#else

// ATmega4808
static constexpr eCxx::uint8_t INP_SW = 24; // D24 on the silkscreen of Thinary ATmega4808 board

#endif


//
// Include common source code for MAX72XX LED matrix test application
//
#include "../CommonCode/MAX72XXMatrix_Common.h"


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

    // Initialize switch and LED matrix
    eCxx_user_init_initializeSwitchAndMAX72XXLEDMatrix();
}


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