ERIS CORE

◆ besttwoavg()

static int16_t besttwoavg ( int16_t  x,
int16_t  y,
int16_t  z 
)
static

Definition at line 22 of file touch.cpp.

22  {
23  int16_t da, db, dc;
24  int16_t reta = 0;
25  if ( x > y ) da = x - y; else da = y - x;
26  if ( x > z ) db = x - z; else db = z - x;
27  if ( z > y ) dc = z - y; else dc = y - z;
28  if ( da <= db && da <= dc ) reta = (x + y) >> 1;
29  else if ( db <= da && db <= dc ) reta = (x + z) >> 1;
30  else reta = (y + z) >> 1; // else if ( dc <= da && dc <= db ) reta = (x + y) >> 1;
31  return (reta);
32 }

Referenced by Touch::update().

+ Here is the caller graph for this function: