/*******************************************************************************
MPLAB Harmony Graphics Composer Generated Implementation File

File Name:
libaria_events.c

Summary:
Build-time generated implementation from the MPLAB Harmony
Graphics Composer.

Description:
Build-time generated implementation from the MPLAB Harmony
Graphics Composer.

Created with MPLAB Harmony Version 2.04
*******************************************************************************/
// DOM-IGNORE-BEGIN
/*******************************************************************************
Copyright (c) 2013-2014 released Microchip Technology Inc. All rights reserved.

Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).

You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.

SOFTWARE AND DOCUMENTATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************/
// DOM-IGNORE-END

#include "gfx/libaria/libaria_events.h"
#include "stdio.h"


SYS_TMR_HANDLE handleTimer3;
bool notFirst;
bool Flag;
char charBuff1[32];
char charBuff2[32];

laString str1,str2;

char How_are_you[] = "How are you ?";
char I_am_fine[] = "I am fine.";
int Count;

void Func1(void) //
{
Count++;
sprintf(charBuff1, "%s N=%d",How_are_you,Count );

str1 = laString_CreateFromCharBuffer(charBuff1,
GFXU_StringFontIndexLookup(&stringTable, string_LabelStr1, 0));

laLabelWidget_SetText(LabelWidget1, str1);

laTextFieldWidget_SetText(TextFieldWidget1, str1);
}

void Func2(void) //
{
Count++;
sprintf(charBuff2, "%s N=%d", I_am_fine, Count);

str1 = laString_CreateFromCharBuffer(charBuff2,
GFXU_StringFontIndexLookup(&stringTable, string_LabelStr1, 0));
laLabelWidget_SetText(LabelWidget1, str1);

laTextFieldWidget_SetText(TextFieldWidget1, str1);
}

void Timer_Callback3 ( uintptr_t context, uint32_t currTick )
{
if(Flag == false)
{
Flag = true;
Func1();
}
else
{
Flag = false;
Func2();
}
}


void Screen1_LcdFlicker(void)
{
Flag = true;
handleTimer3 = SYS_TMR_CallbackPeriodic(2000, 1, Timer_Callback3);//LCD表示切り替えコールバックタイマ起動
}


void MyLibariaEvents(void) //APP_Tasks ()からの呼び出し
{
if(notFirst == false) //ブート直後の場合
{
notFirst = true;
Screen1_LcdFlicker();//LCD表示切り替えコールバックタイマ起動
}

}