abstracting display, touch and sd
This commit is contained in:
31
display/low_level_touch_factory.cpp
Normal file
31
display/low_level_touch_factory.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user