电阻屏接在AIN0 – AIN3上,
dts配置
&tscadc {
status = "okay";
tsc {
ti,wires = <4>;
ti,x-plate-resistance = <200>;
ti,coordinate-readouts = <5>;
ti,wire-config = <0x00 0x11 0x22 0x33>;
ti,charge-delay = <0x400>;
};
adc {
ti,adc-channels = <4 5 6 7>;
};
};
在ti_am335x_tsc.c中的中断函数中打印LOG发现输出的偶尔会突然跳点,在屏上也能看到鼠标的箭头跳到没有触摸的地方了。
而且发现我加了打印log后这个跳点的清苦能好一点,不加log跳点发生的概率比较大。
下面是添加log的代码
static irqreturn_t ***(int irq, void *dev)
{
struct *** *ts_dev = dev;
struct input_dev *input_dev = ts_dev->input;
unsigned int fsm, status, irqclr = 0;
unsigned int x = 0, y = 0;
unsigned int z1, z2, z;
status = ***(ts_dev, REG_RAWIRQSTATUS);
if (status & IRQENB_HW_PEN) {
ts_dev->pen_down = true;
irqclr |= IRQENB_HW_PEN;
pm_stay_awake(ts_dev->dev);
}
if (status & IRQENB_PENUP) {
fsm = ***(ts_dev, REG_ADCFSM);
if (fsm == ADCFSM_STEPID) {
ts_dev->pen_down = false;
input_report_key(input_dev, BTN_TOUCH, 0);
input_report_abs(input_dev, ABS_PRESSURE, 0);
input_sync(input_dev);
pm_relax(ts_dev->dev);
} else {
ts_dev->pen_down = true;
}
irqclr |= IRQENB_PENUP;
}
if (status & IRQENB_EOS)
irqclr |= IRQENB_EOS;
/*
* ADC and touchscreen share the IRQ line.
* FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only
*/
if (status & IRQENB_FIFO0THRES) {
***(ts_dev, &x, &y, &z1, &z2);
if (ts_dev->pen_down && z1 != 0 && z2 != 0) {
/*
* Calculate pressure using formula
* Resistance(touch) = x plate resistance *
* x postion/4096 * ((z2 / z1) – 1)
*/
z = z1 – z2;
z *= x;
z *= ts_dev->x_plate_resistance;
z /= z2;
z = (z + 2047) >> 12;
printk("—x=%d—y=%d–z=%d\n",x,y,z);
if (z <= MAX_12BIT) {
input_report_abs(input_dev, ABS_X, x);
input_report_abs(input_dev, ABS_Y, y);
input_report_abs(input_dev, ABS_PRESSURE, z);
input_report_key(input_dev, BTN_TOUCH, 1);
input_sync(input_dev);
}
}
irqclr |= IRQENB_FIFO0THRES;
}
if (irqclr) {
***(ts_dev, REG_IRQSTATUS, irqclr);
if (status & IRQENB_EOS)
am335x_tsc_se_set_cache(ts_dev->mfd_tscadc,
ts_dev->step_mask);
return IRQ_HANDLED;
}
return IRQ_NONE;
}
并且在播放视频的时候滑动触摸时视频会卡顿。
请问这是什么原因造成的,硬件问题不用考虑。有一个版本可以正常运行。
另外dts中我没有配置
&wkup_m3_ipc {
ti,scale-data-fw = "am335x-evm-scale-data.bin";
};
&pruss_soc_bus {
status = "okay";
pruss: pruss@4a300000 {
status = "okay";
};
};
pruss_soc_bus 这个不太明白是干啥用的,配置后调试串口没有输出了 !
yongqing wang:
tslib的触摸矫正程序有测试一下吗?
yongqing wang:
tslib的触摸矫正程序有测试一下吗?
user5862032:
回复 yongqing wang:
校准多次 ,情况还是这样子
yongqing wang:
回复 user5862032:
那个矫正只是矫正坐标,我的意思是你运行这个列程时是否也会触摸乱跳?