/*******************************************************************************
*	Application: Demo code for IIC using in HHD32F0xx
*	Edition:		Version:1.0
*	Company: 		
*	Time: 			October 2015
*******************************************************************************/
#include "hhd32f0xx.h"
#include "hhd_sys.h"
#include "hhd_iic.h"

#define HT_WRDISPRAM        	0x80
#define HT_DRVMODESET			0x82
#define HT_SYSMODESET 			0x84
#define HT_FRMFREQSET			0x86
#define HT_FLASHRREQSET			0x88
#define HT_IVASET				0x8a

uint8_t LCD_disp_Buf[12];


void delaynstep(int i)
{
	while(1);
}
void		LCD_DISP_BUF_UPDATE()
{
/*
	*/
}

/*****************************************************************************
* Function name:    Main Function
*
* Descriptions:     IIC drive HT1621
*
* parameters:       None
* Returned value:   None
* 
*****************************************************************************/
int main(void)
{
	int i;
	
	/* --------- System initialization -------------------*/
	SYS_SystemInitial();	
	
	/* --------- IIC initiallization ---------------------*/
	IIC_Init(1,50,0x70);
	
	/* --------- LCD Display buffer clear ----------------*/
	for(i=0;i<11;i++)
		LCD_disp_Buf[i]=0;
	
	/* --------- Send command to HT1621 ------------------*/
	IIC_WriteByte(0x70,HT_SYSMODESET,3);
	IIC_WriteByte(0x70,HT_DRVMODESET,0);
	IIC_WriteByte(0x70,HT_FRMFREQSET,1);
	IIC_WriteByte(0x70,HT_IVASET,0x00);

	/* --------- Begin send Content of display to HT1621 -*/
	while (1) 
	{
		delaynstep(10000);
		LCD_DISP_BUF_UPDATE();			
		IIC_WriteArray(0x70,HT_WRDISPRAM,LCD_disp_Buf,11);
		IIC_WriteByte(0x70,HT_SYSMODESET,3);

	}
}



