#include "api_tft.h"
#include "GUI.h"
#include "TYW_stdint.h"
#include "RTE_ADC.h"
 //#include "Flash_synchronizer.h"
#include "CAN_CH0_CAN_Communication_Matrix.h"
#include <string.h>
#include "GUI.h"    

//#include "Imag_Map.h"
 



/* ****************************************************************************
 *N a m e 		:Draw_Image_Local
 *Function		:单张图片的贴图
 *Text encoding	:UTF_8
 *Incoming Data	:图片关联枚举
 * ***************************************************************************/
void Draw_Image_Local(unsigned char PictureNum [], int Pos_X, unsigned int Pos_Y)
{
    DrawInfo.x_point = Pos_X;
    DrawInfo.y_point = Pos_Y;
    DrawInfo.IMG     = ( unsigned char     *)PictureNum;
    // DrawInfo.IMG =  Image_LampIn_List[].CNAddr;
    DrawInfo.Alpha     = 0;
    DrawInfo.Luminance = 0;
    DrawInfo.Scale     = 1;
    Draw_WindowDirect(&DrawInfo);
}


#define MONO_DIGIT_LEN 10U
 void Draw_Image_Local_Digit_Draw(uint32_t Digit,   uint8_t *Font[], uint8_t Len, uint8_t Blank, const uint16_t *px, uint16_t y)
{
    uint8_t i;
    uint8_t ActLen = 0U;
    uint8_t DigitBuf[MONO_DIGIT_LEN];

    for (i = 0U; i < MONO_DIGIT_LEN; i++)
    {
        DigitBuf[ActLen] = Digit % 10U;
        Digit /= 10;
        ActLen++;
        if (Digit == 0U)
        {
            break;
        }
    }

    if (ActLen == 0)
    {
        ActLen = 1;
        DigitBuf[0] = 0;
    }

    for (i = ActLen; i < Len; i++)
    {
        DigitBuf[i] = 0U;
    }

    i = (Len - 1);
    while ((DigitBuf[i] == 0U) && (i >= (Len - Blank)))
    {
        DigitBuf[i] = 10U;
        i--;
    }

    for (i = 0U; i < Len; i++)
    {
        if (DigitBuf[i] < 10U)
        {
           
            Draw_Image_Local(Font[DigitBuf[i]],*(px + i), y );
            
        }
        // else
        // {
        //     Draw_Image_Local(Font[10],*(px + i), y );
        // }
    }
}







void Draw_GraphCalculateCallBack(unsigned char vramID)
{
    Draw_SetWindow(0, 239, 0, 319);    
   // if ((UESch_Status_Get() != DISP_STARTUP) && (UESch_Status_Get() != DISP_SELF_TEST))
    {
        Draw_TopClearVram(vramID);
        Draw_ClearVram(vramID);    
        GUI_Service( );
    }  
     
}




