//带滤波的坐标读取 //最小值不能少于100. u8 Read_ADS(u16 *x,u16 *y) { u16 xtemp,ytemp; xtemp=ADS_Read_XY(CMD_RDX); ytemp=ADS_Read_XY(CMD_RDY); if(xtemp<100||ytemp<100)return 0;//读数失败 *x=xtemp; *y=ytemp; return 1;//读数成功 }
//带滤波的坐标读取 //最小值不能少于100. uint8_t Read_ADS(uint16_t *x, uint16_t *y) { uint16_t xtemp, ytemp; xtemp = ADS_Read_XY(CMD_RDX); ytemp = ADS_Read_XY(CMD_RDY); if(xtemp < 100 || ytemp < 100) { return 0; } //读数失败 *x = xtemp; *y = ytemp; return 1;//读数成功 }
/******************************************** ** Read_ADSY : ** Coordinate reading with smoothing ** The minimum value could not less than 100 ********************************************/ uint8_t Read_ADSY(uint16_t *y) { uint16_t ytemp; ytemp=ADS_Read_XY(0x90); if(ytemp<100)return 0; // Failed to read *y=ytemp; return 1; // Success }
/******************************************** ** Read_ADSX : ** Coordinate reading with smoothing ** The minimum value could not less than 100 ********************************************/ uint8_t Read_ADSX(uint16_t *x) { uint16_t xtemp; xtemp=ADS_Read_XY(0xd0); if(xtemp<100)return 0; // Failed to read *x=xtemp; return 1; // Success }