#include "display.h"
#include "../lcd/framebuffer.h"
#include "../lcd/geometry.h"
#include "../lcd/font.h"

static char *functional_selection_array[12]={
    "LED", "Buttom", "LCD","TS","IIC","SPI","RES","DHT11","DS18","HS0038","ts_calibrate"
};

//int bMenu_index=RETURN;

/* 矩形框阵列 */
void rectangle_array(int x, int y, int length, int width, int i, int j, int color)
{
	int a = 0;
	int b = 0;
	int x0=x;
	int y0=y;
	int num=0;

	for (a = 0; a < j; a++)
	{
		for (b = 0; b < i; b++)
		{
			x = x0 + (length + x0) * b;
			y = y0 + (width + y0) * a;
			fb_disp_rectangle(x, y, length, width, color);
			fb_print_string(x+10, y+15,functional_selection_array[num++],0);
			//num++;
		}
	}
}

/*******************************************************************************
* Function Name  : display_init
* Description    : 初始化显示界面，即主界面，返回界面也是这个
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void display_init(void)
{
    /* 清屏 */
	clear_screen(0xffffff);

    /* 显示 */
    rectangle_array(40,20,110,40,3,4,0xff0000);

	
}

