From ecdc4d58583c198a0d1859e805a679a64d1abfd3 Mon Sep 17 00:00:00 2001 From: piotr Date: Sat, 10 Nov 2018 17:27:39 +0100 Subject: [PATCH] create new driver for kuman lcd full HD 3.5 inch touch display --- .../driver/touch/demo/ThingsApplication.java | 3 ++- .../driver/touch/driver/KumanDriver.java | 25 +++++++++++++++++ .../touch/profile/KumanDriverProfile.java | 27 +++++++++++++++++++ .../driver/touch/profile/Vendor.java | 3 ++- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 touch/src/main/java/eu/vranckaert/driver/touch/driver/KumanDriver.java create mode 100644 touch/src/main/java/eu/vranckaert/driver/touch/profile/KumanDriverProfile.java diff --git a/demo/src/main/java/eu/vranckaert/driver/touch/demo/ThingsApplication.java b/demo/src/main/java/eu/vranckaert/driver/touch/demo/ThingsApplication.java index 1b9ae7f..37fd525 100644 --- a/demo/src/main/java/eu/vranckaert/driver/touch/demo/ThingsApplication.java +++ b/demo/src/main/java/eu/vranckaert/driver/touch/demo/ThingsApplication.java @@ -2,6 +2,7 @@ import eu.vranckaert.driver.touch.TouchScreenDriverApplication; import eu.vranckaert.driver.touch.profile.DriverProfile; +import eu.vranckaert.driver.touch.profile.KumanDriverProfile; import eu.vranckaert.driver.touch.profile.WaveshareProfile; /** @@ -11,6 +12,6 @@ public class ThingsApplication extends TouchScreenDriverApplication { @Override public DriverProfile getDriverProfile() { - return WaveshareProfile.getInstance(WaveshareProfile.DIMENSION_800_480); + return KumanDriverProfile.getInstance(KumanDriverProfile.DIMENSION_1920_1080); } } diff --git a/touch/src/main/java/eu/vranckaert/driver/touch/driver/KumanDriver.java b/touch/src/main/java/eu/vranckaert/driver/touch/driver/KumanDriver.java new file mode 100644 index 0000000..ea38e15 --- /dev/null +++ b/touch/src/main/java/eu/vranckaert/driver/touch/driver/KumanDriver.java @@ -0,0 +1,25 @@ +package eu.vranckaert.driver.touch.driver; + +import eu.vranckaert.driver.touch.profile.SPIDriverProfile; + +public class KumanDriver extends XPT2046Driver { + + public KumanDriver(SPIDriverProfile driverProfile) { + super(driverProfile, true, true, true, true, true); + } + + @Override + public boolean isPressing(byte[] buffer) { + return buffer[1] != 0; + } + + @Override + public int getSpiChannel() { + return 1; + } + + @Override + public int getVersion() { + return 1; + } +} diff --git a/touch/src/main/java/eu/vranckaert/driver/touch/profile/KumanDriverProfile.java b/touch/src/main/java/eu/vranckaert/driver/touch/profile/KumanDriverProfile.java new file mode 100644 index 0000000..0a591ac --- /dev/null +++ b/touch/src/main/java/eu/vranckaert/driver/touch/profile/KumanDriverProfile.java @@ -0,0 +1,27 @@ +package eu.vranckaert.driver.touch.profile; + +import eu.vranckaert.driver.touch.driver.Driver; +import eu.vranckaert.driver.touch.driver.KumanDriver; + +public class KumanDriverProfile extends SPIDriverProfile { + + public static final ScreenDimension DIMENSION_1920_1080 = new ScreenDimension(1920, 1080, ScreenDimension.Ratio.R_16_10); + + private static KumanDriverProfile INSTANCE; + + private KumanDriverProfile(ScreenDimension screenDimension) { + super(Vendor.KUMAN, screenDimension); + } + + public static KumanDriverProfile getInstance(ScreenDimension screenDimension) { + if(INSTANCE == null) { + INSTANCE = new KumanDriverProfile(screenDimension); + } + return INSTANCE; + } + + @Override + public Driver getDriver() { + return new KumanDriver(this); + } +} diff --git a/touch/src/main/java/eu/vranckaert/driver/touch/profile/Vendor.java b/touch/src/main/java/eu/vranckaert/driver/touch/profile/Vendor.java index daf73cf..21053c4 100644 --- a/touch/src/main/java/eu/vranckaert/driver/touch/profile/Vendor.java +++ b/touch/src/main/java/eu/vranckaert/driver/touch/profile/Vendor.java @@ -3,5 +3,6 @@ public enum Vendor { KEDEI, WAVESHARE, - UNKNOWN; + KUMAN, + UNKNOWN } \ No newline at end of file