commit 15f62c5845247de4216800385f630f155fa7a2b3
parent 8986d51fda25fdbe6cedc14e65fbe37ffdf97822
Author: Manuel Geissbühler <manuel@debian>
Date: Fri, 27 Dec 2024 17:14:06 +0100
testing..
Diffstat:
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -4,4 +4,4 @@
CMakeFiles/
*.png
*.cmake
-./build/*
+build/**
diff --git a/src/cash2ecash.cpp b/src/cash2ecash.cpp
@@ -6,7 +6,6 @@
#include "cashacceptors.hpp"
-#include "gui/screenWelcomme.hpp"
#include "utils.hpp"
#include "gui.hpp"
@@ -35,6 +34,7 @@ int main(int argc, char *argv[]){
while (true) {
switch (state) {
case INIT:
+ gui.setActiveScreen(dynamic_cast<Screen*>(&welcome));
state = ACCEPTCASH;
timer1.start();
//cashacceptor.startMoneyAcceptance();
diff --git a/src/gui/gui.hpp b/src/gui/gui.hpp
@@ -3,6 +3,8 @@
#include "lvgl.h"
#include <cstdint>
#include <src/drivers/display/drm/lv_linux_drm.h>
+#include <src/drivers/evdev/lv_evdev.h>
+#include <src/indev/lv_indev.h>
#include "screen.hpp"
class Gui {
@@ -13,9 +15,15 @@ class Gui {
bool maximize = 0;
void displayInit(){
+ //display
const char *device = "/dev/dri/card1";
lv_display_t *disp = lv_linux_drm_create();
lv_linux_drm_set_file(disp, device, -1);
+
+ //touch input device
+ const char *inputDevice = "/dev/input/by-path/platform-fe205000.i2c-event";
+ lv_indev_t *touch = lv_evdev_create(LV_INDEV_TYPE_POINTER, inputDevice);
+ lv_indev_set_display(touch, disp);
}
diff --git a/src/gui/screenWelcomme.hpp b/src/gui/screenWelcomme.hpp
@@ -26,7 +26,7 @@ private:
* Create a button with a label and react on click event.
*/
- lv_obj_t * btn = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/
+ lv_obj_t * btn = lv_btn_create(screenPointer); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 120, 50); /*Set its size*/
lv_obj_add_event_cb(btn, this->btn_event_cb, LV_EVENT_ALL, NULL); /*Assign a callback to the button*/