I'm late to the party, but we did exactly this for our Christmas tree LED controller, which used a TM040040:

double ComputeAngle(absData_t * touchData)

{

double x = (double) touchData->xValue;

double y = (double) touchData->yValue * 4 / 3;

double angle = atan2 ((1024-y), (x-1024)) * 180 / PI;

angle = angle > 0 ? angle : (360 + angle);

return angle;

}

In this example, we scale Y by 4/3 because our circle sensors have differing resolution in the X and Y axes (Xmax = 2048, Ymax = 1536). This results in new resolution of 2048x2048. We subtract 1024 from each axis so that we are calculating the angle relative to the center of the touch pad.

I hope this helps.