32 lines
958 B
C++
32 lines
958 B
C++
#include "low_level_touch.h"
|
|
#include "low_level_touch_ft6336u.h"
|
|
#include <cstdio>
|
|
|
|
LowLevelTouch* LowLevelTouch::create(TouchType type, int screen_width, int screen_height,
|
|
bool swap_xy, bool invert_x, bool invert_y) {
|
|
LowLevelTouch* touch = nullptr;
|
|
|
|
switch (type) {
|
|
case TOUCH_TYPE_FT6336U:
|
|
printf("Creating FT6336U touch controller...\n");
|
|
touch = new LowLevelTouchFT6336U(screen_width, screen_height, swap_xy, invert_x, invert_y);
|
|
break;
|
|
|
|
case TOUCH_TYPE_NONE:
|
|
printf("No touch controller configured\n");
|
|
return nullptr;
|
|
|
|
default:
|
|
printf("Unknown touch type: %d\n", type);
|
|
return nullptr;
|
|
}
|
|
|
|
if (touch && !touch->init()) {
|
|
printf("Failed to initialize touch controller\n");
|
|
delete touch;
|
|
return nullptr;
|
|
}
|
|
|
|
return touch;
|
|
}
|