/*!
 * @file        main.c
 *
 * @brief       Main program body
 *
 * @version     V2.5
 *
 * @date        2024-08-08
 *
 * @attention
 *
 *  Copyright (C) 2020-2022 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */
#include "include.h"
#include "lcd.h"
#include "pic.h"
/*!
 * @brief       Main program,LCD-ST7789
 *
 * @param       None
 *
 * @retval      None
 *
 */

int main(void)
{
    printf("Hello GW3323 SPI LCD!\n");
    bsp_sys_init();                     /*System initialization*/
    set_sys_clk(SYS_160M);

    LCD_Init();
    LCD_Fill(0,0,LCD_W,LCD_H,WHITE);

    while (1)
    {
        LCD_Fill(130,0,240,9,GBLUE);                        //填充矩形
        LCD_ShowString(130,10,"Geehy_GW3323",GRAYBLUE,WHITE,FONT_SIZE_16,1);
        LCD_DrawLine(130,30,240,30,BLACK);                  //画线
        LCD_ShowIntNum(130,35,12345,5,BLACK,WHITE,FONT_SIZE_24);      //显示整形数据
        LCD_Fill(130,60,240,90,GREEN);                      //填充矩形
        LCD_ShowFloatNum(130,95,12.345,5,BLACK,WHITE,FONT_SIZE_24);    //显示浮点型数据
        LCD_Fill(130,180,240,240,GRAY);                      //填充矩形

        //显示汉字,不覆盖
        LCD_ShowChinese(130,125,"电子",RED,WHITE,FONT_SIZE_12,LCD_UNFILLED);
        LCD_ShowChinese(155,125,"电子",RED,WHITE,FONT_SIZE_16,LCD_UNFILLED);
        LCD_ShowChinese(190,125,"电子",RED,WHITE,FONT_SIZE_24,LCD_UNFILLED);
        //显示汉字,覆盖
        LCD_ShowChinese(130,150,"电子",RED,WHITE,FONT_SIZE_12,LCD_FILLED);
        LCD_ShowChinese(150,150,"电子",RED,WHITE,FONT_SIZE_16,LCD_FILLED);
        LCD_ShowChinese(160,150,"电子",RED,WHITE,FONT_SIZE_24,LCD_FILLED);

        /*画矩形，不填充*/
        LCD_DrawRectangle(0, 150, 20, 20, BLACK, LCD_UNFILLED);
        LCD_DrawRectangle(22, 150, 20, 20, BLACK, LCD_FILLED);/*填充*/

        /*画直线*/
        LCD_DrawLine(180, 150, 240, 170,BLACK);
        LCD_DrawLine(180, 170, 240, 150,BLACK);

        /*画三角形，未填充*/
        LCD_DrawTriangle(120, 150, 120, 190, 100, 170, BLACK, LCD_UNFILLED);
        LCD_DrawTriangle(100, 150, 100, 190, 80, 170, BLACK, LCD_FILLED);/*填充*/

        /*画圆，未填充*/
        LCD_DrawCircle(50,150,10,BLACK,LCD_UNFILLED);
        LCD_DrawCircle(80,150,10,BLACK,LCD_FILLED);/*填充*/

        /*画椭圆，未填充*/
        LCD_DrawEllipse(50, 190, 12, 8 ,BRRED, LCD_UNFILLED);
        LCD_DrawEllipse(80, 190, 12, 8 ,BRRED, LCD_FILLED);/*填充*/

        /*画圆弧，未填充*/
        LCD_DrawArc(10, 190, 10, 25, 125, BLACK, LCD_UNFILLED);
        LCD_DrawArc(30, 210, 10, 25, 125, BLACK, LCD_FILLED);/*填充*/

        /*动图显示*/
        LCD_ShowPicture(0,0,128,128,gImage_pkq1);
        LCD_ShowPicture(0,0,128,128,gImage_pkq3);
        LCD_ShowPicture(0,0,128,128,gImage_pkq4);
        LCD_ShowPicture(0,0,128,128,gImage_pkq5);
        LCD_ShowPicture(0,0,128,128,gImage_pkq6);
        LCD_ShowPicture(0,0,128,128,gImage_pkq7);
        LCD_ShowPicture(0,0,128,128,gImage_pkq8);
        LCD_ShowPicture(0,0,128,128,gImage_pkq9);

    }

    return 0;
}
