41 #error XPT2046 is not defined 52 int tft_is_calibrated = 0;
63 if(!tft_is_calibrated)
96 tft_is_calibrated = 0;
107 MatX.
data[0][0] = w / 4;
108 MatY.
data[0][0] = h / 4;
110 MatX.
data[1][0] = w * 3 / 4;
111 MatY.
data[1][0] = h / 4;
113 MatX.
data[2][0] = w / 4;
114 MatY.
data[2][0] = h * 3 / 4;
116 MatX.
data[3][0] = w * 3 / 4;
117 MatY.
data[3][0] = h * 3 / 4;
119 MatX.
data[4][0] = w / 2;
120 MatY.
data[4][0] = h / 2;
131 X1 = MatX.
data[i][0];
132 Y1 = MatY.
data[i][0];
140 tft_printf(win,
"touch point %3d,%3d", (
int)X1, (
int)Y1);
147 MatA.
data[i][0] = (float)X2;
148 MatA.
data[i][1] = (float)Y2;
149 MatA.
data[i][2] = 1.0;
161 tft_calX =
MatMul(MatAI,MatX);
162 tft_calY =
MatMul(MatAI,MatY);
183 return( (tft_is_calibrated = 1) );
208 printf(
"tft_touch_map: raw: X:%.0f,Y:%.0f\n", (
double)XF, (
double)YF);
213 printf(
"tft_touch_map: cal: X:%3d,Y:%3d\n", (
int)X2, (
int)Y2);
250 for(i=0;i<points;++i)
MEMSPACE int tft_touch_map(window *win, int16_t *X, int16_t *Y)
MEMSPACE void tft_set_textpos(window *win, int16_t x, int16_t y)
Set current window text pointer in characters (per current rotation) - overall font bounding box...
Master include file for project Includes all project includes and defines here.
MEMSPACE void MatPrint(mat_t matrix)
Print a matrix.
Cordic_T X
Main Cordic routine - used for basic trig and vector rotations We use fixed point numbers...
MEMSPACE void tft_set_font(window *win, uint16_t index)
Set current font size (per current rotation)
MEMSPACE int tft_touch_xy_raw(window *win, uint16_t *X, uint16_t *Y)
void optimistic_yield(uint32_t interval_us)
MEMSPACE mat_t MatAlloc(int rows, int cols)
Allocate a matrix.
MEMSPACE int tft_check_calibrated(window *win)
int XPT2046_xy_raw(uint16_t *X, uint16_t *Y)
MEMSPACE void tft_clip_xy(window *win, int16_t *X, int16_t *Y)
Clip X,Y to fix inside specifiied window.
MEMSPACE int tft_map_test(window *win, int points)
void tft_drawPixel(window *win, int16_t x, int16_t y, int16_t color)
Pixel functions
MEMSPACE int XPT2046_xy_filtered(uint16_t *X, uint16_t *Y)
MEMSPACE int XPT2046_key(uint16_t *X, uint16_t *Y)
MEMSPACE int tft_touch_xy(window *win, uint16_t *X, uint16_t *Y)
void tft_fillWin(window *win, uint16_t color)
Fill functions
MEMSPACE void MatFree(mat_t matF)
Free a matrix.
MEMSPACE int printf(const char *format,...)
MEMSPACE mat_t MatMul(mat_t MatA, mat_t MatB)
Multiply two matrix.
MEMSPACE void tft_cleareol(window *win)
Character and String functions
MEMSPACE void tft_fillCircle(window *win, int16_t x0, int16_t y0, int16_t r, uint16_t color)
Fill circle.
ili9341 driver inspired by Adafruit ili9341 code All code in this file has been rewritten by Mike Gor...
MEMSPACE int tft_printf(window *win, const char *fmt,...)
tft_printf function
MEMSPACE int tft_touch_key(window *win, uint16_t *X, uint16_t *Y)
MEMSPACE int tft_touch_calibrate(window *win)
MEMSPACE mat_t PseudoInvert(mat_t MatA)
Calculate Pseudo Matrix Inverse Used for least square fitting of non square matrix with excess soluti...