diff --git a/sample-epaperdriverhat/.gitignore b/sample-epaperdriverhat/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/sample-epaperdriverhat/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/sample-epaperdriverhat/README.md b/sample-epaperdriverhat/README.md
index 8bffd52..49534ad 100644
--- a/sample-epaperdriverhat/README.md
+++ b/sample-epaperdriverhat/README.md
@@ -1,15 +1,13 @@
-## OLED Screen sample for Android Things
+## E-Paper Driver HAT sample for Android Things
-This sample demonstrates how to control the EPAPERDRIVERHAT OLED display using I2C with
+This sample demonstrates how to control the GDEW075T8 E-Paper display using E-Paper Driver HAT with
Android Things.
## Pre-requisites
- Android Things compatible board
- Android Studio 2.2+
-- 1 [EPAPERDRIVERHAT OLED screen](https://www.elecrow.com/download/EPAPERDRIVERHAT%20datasheet.pdf)
-- jumper wires
-- 1 breadboard
+- 1 [GDEW075T8 + E-Paper Driver HAT](https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT)
# Build and install
@@ -19,14 +17,11 @@ On Android Studio, click on the "Run" button.
If you prefer to run on the command line, from this repository's root directory, type
```bash
-./gradlew sample-epd:installDebug
-adb shell am start com.leinardi.android.things.sample.epd/.OledScreenActivity
+./gradlew sample-epaperdriverhat:installDebug
+adb shell am start com.leinardi.android.things.sample.epaperdriverhat/.EpdScreenActivity
```
-If you have everything set up correctly, you will see a small bitmap slowly
-moving in the screen. If you want to change the pattern displayed, change the
-variable mMode in OledScreenActivity and deploy again. The sample has three
-modes: DOTS, BITMAP (default) and CROSSHAIRS.
+If you have everything set up correctly, you will see an image on the screen.
## License
diff --git a/sample-epaperdriverhat/build.gradle b/sample-epaperdriverhat/build.gradle
new file mode 100644
index 0000000..827946f
--- /dev/null
+++ b/sample-epaperdriverhat/build.gradle
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2018 Roberto Leinardi.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+apply plugin: 'com.android.application'
+apply from: rootProject.file('checkstyle.gradle')
+
+android {
+ compileSdkVersion build_versions.target_sdk
+ buildToolsVersion build_versions.build_tools
+
+ defaultConfig {
+ applicationId "com.leinardi.android.things.sample.epaperdriverhat"
+ minSdkVersion build_versions.min_sdk
+ targetSdkVersion build_versions.target_sdk
+ versionCode build_versions.version_code
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+ }
+
+ compileOptions {
+ sourceCompatibility build_versions.java_version
+ targetCompatibility build_versions.java_version
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ compileOnly deps.androidthings
+ implementation deps.support.annotations
+ implementation project(':driver-epaperdriverhat')
+
+}
diff --git a/sample-epaperdriverhat/proguard-rules.pro b/sample-epaperdriverhat/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/sample-epaperdriverhat/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/sample-epaperdriverhat/src/main/AndroidManifest.xml b/sample-epaperdriverhat/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..89d657a
--- /dev/null
+++ b/sample-epaperdriverhat/src/main/AndroidManifest.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample-epaperdriverhat/src/main/java/com/leinardi/android/things/sample/epaperdriverhat/EpdScreenActivity.java b/sample-epaperdriverhat/src/main/java/com/leinardi/android/things/sample/epaperdriverhat/EpdScreenActivity.java
new file mode 100644
index 0000000..ef9c853
--- /dev/null
+++ b/sample-epaperdriverhat/src/main/java/com/leinardi/android/things/sample/epaperdriverhat/EpdScreenActivity.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2018 Roberto Leinardi.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.leinardi.android.things.sample.epaperdriverhat;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.leinardi.android.things.driver.epaperdriverhat.BitmapHelper;
+import com.leinardi.android.things.driver.epaperdriverhat.Gdew075t8Epd;
+import com.leinardi.android.things.sample.epd.R;
+
+import java.io.IOException;
+
+/**
+ * Activity that tests the EPD.
+ */
+public class EpdScreenActivity extends Activity {
+ private static final String TAG = EpdScreenActivity.class.getSimpleName();
+ Gdew075t8Epd mEpd;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Log.d(TAG, "EPD screen activity created");
+ try {
+ mEpd = new Gdew075t8Epd();
+ Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.monocolor_640x384);
+ BitmapHelper.setBmpData(mEpd, 0, 0, bitmap, false);
+ mEpd.show(); // render the pixel data
+ } catch (IOException e) {
+ Log.e(TAG, "Error initializing EPD", e);
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ Log.d(TAG, "Closing EPD");
+ try {
+ mEpd.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Exception closing EPD", e);
+ } finally {
+ mEpd = null;
+ }
+ }
+}
diff --git a/sample-epaperdriverhat/src/main/res/drawable-nodpi/monocolor_640x384.png b/sample-epaperdriverhat/src/main/res/drawable-nodpi/monocolor_640x384.png
new file mode 100644
index 0000000..09490ef
Binary files /dev/null and b/sample-epaperdriverhat/src/main/res/drawable-nodpi/monocolor_640x384.png differ
diff --git a/sample-epaperdriverhat/src/main/res/values/strings.xml b/sample-epaperdriverhat/src/main/res/values/strings.xml
new file mode 100644
index 0000000..579e54e
--- /dev/null
+++ b/sample-epaperdriverhat/src/main/res/values/strings.xml
@@ -0,0 +1,19 @@
+
+
+
+ Sample E-Paper Driver HAT
+
diff --git a/sample-epaperdriverhat/src/main/res/values/styles.xml b/sample-epaperdriverhat/src/main/res/values/styles.xml
new file mode 100644
index 0000000..51e3dac
--- /dev/null
+++ b/sample-epaperdriverhat/src/main/res/values/styles.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+