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


#include <eCxx/eCxx_LCD.h>

#include "AVR_Common.h"


//
// Instantiate a character LCD driver using TWI as output method
// (the pin numbers below are the pins of the LCD driver board)
//
//                                Slave-address     EN  RW  RS     D4  D5  D6  D7     BL BL
static eCxx::CharacterLCD_TWI lcd(0x27,             2,  1,  0,     4,  5,  6,  7,     3, eCxx::ActiveState::High);


//
// Include common source code for StreamSampler test application
//
#include "../CommonCode/CharacterLCD_Common.h"


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

    // Initialize TWI in master mode
    App::twiMaster().begin(400000UL);

    // Initialize and test the LCD
    eCxx_user_init_lcdInitAndTest();
}


//
// The task function
//
void eCxx_user_task()
{
    // Process event and create animation using the LCD
    eCxx_user_task_lcdAnimate();
}
