博士
最后登录1970-1-1
在线时间 小时
注册时间2015-3-6
|
发表于 2016-1-11 08:43:41
|
显示全部楼层
- SPI_FLASH_BufferRead(&cal_flag,0,1);
- if( cal_flag == 0x55 )
- {
- SPI_FLASH_BufferRead((void*)cal_p,1, sizeof(cal_p));
- SPI_FLASH_CS_HIGH();
- for( k=0; k<6; k++ )
- printf("\r\n rx = %LF \r\n",cal_p[k]);
- }
- else
- {
- /* µÈ´ý´¥ÃþÆÁУÕýÍê±Ï */
- while(Touch_Calibrate()!=0);
- }
复制代码
是开机读取SPI flash里边触摸屏校准参数,
你需要在Touch_Calibrate()函数修改:
cal_p[0] = (touch_para.An*1.0)/touch_para.Divider; // aa1
cal_p[1] = (touch_para.Bn*1.0)/touch_para.Divider; // bb1
cal_p[2] = (touch_para.Cn*1.0)/touch_para.Divider; // cc1
cal_p[3] = (touch_para.Dn*1.0)/touch_para.Divider; // aa2
cal_p[4] = (touch_para.En*1.0)/touch_para.Divider; // bb2
cal_p[5] = (touch_para.Fn*1.0)/touch_para.Divider; // cc2
{
cal_flag = 0x55;
SPI_FLASH_SectorErase(0);
SPI_FLASH_BufferWrite(&cal_flag,0, 1);
SPI_FLASH_BufferWrite((void*)cal_p,1, sizeof(cal_p));
for( k=0; k<6; k++ )
printf("\r\n tx = %LF \r\n",cal_p[k]);
}
LCD_DispStr(100, 100, (uint8_t *)"Calibrate Succed", RED);
Delay_ms(1000);
Touch_Succeed=0;
return 0; |
|