From http://bbs.driverdevelop.com/htm_data/48/0909/118452.html
Harktrip
Not tested. The results will be written after the test.
# Define tsp_sample_num 20
# Define tsp_adc_delay = 4000;
As for the call timer interruption, the number of times per second can be reduced to 50.
# Define tsp_sample_rate_low (50) // 50 samples per sec
# Define tsp_sample_rate_high (50) // 50 samples per sec
(Check whether the number of interruptions per second calculated by pclk and pwm_regs is 50)
In this way, the system is not shaken, and the response is fast enough and takes a short time.
When I caught touch, it would interfere with the serial port, So I forced the touch driver to be well watched,
I found that everyone's (official) practices have doubts:
Tsp_adc_delay all use the values 40000 and parameters,
In fact, this is wrong. Extend the ADC delay time, which may mean to make the signal time more stable,
However, the ADC conversion itself has an error. Extending the time does not make the signal more stable, but it only consumes the system time.
Therefore, I shortened tsp_adc_delay and increased the average number of reads (tsp_sample_num,
Let the CPU read several times more; accumulate more data on average, try Bingo !!
In addition, it effectively reduces the interruption time of touch,
The above settings occupy 2.1 msec (from interruption to disconnection)
However, if it is changed:
# Define tsp_sample_num 10
# Define tsp_adc_delay = 2000;
The occupied space can be reduced to 0.15 msec. Although it does not shake, sometimes location separation may occur.
If you don't care about the time-consuming brothers, you can first set the top priority to optimize it.
So, have you changed it?
Isn't tocuh even shaking,
If it still shakes, your hand is shaking ^_^