This repository has been archived by the owner on Nov 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,226 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Change Log | ||
|
||
## [0.1] - 2017-12-19 | ||
- initial version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# HD44780 LCD driver for Android Things | ||
|
||
[![Bintray](https://img.shields.io/bintray/v/leinardi/androidthings/driver-pcf8574-hd44780.svg?style=plastic)](https://bintray.com/leinardi/androidthings/driver-pcf8574-hd44780) | ||
[![Build Status](https://img.shields.io/travis/leinardi/androidthings-drivers/master.svg?style=plastic)](https://travis-ci.org/leinardi/androidthings-drivers) | ||
[![GitHub license](https://img.shields.io/github/license/leinardi/androidthings-drivers.svg?style=plastic)](https://github.com/leinardi/androidthings-drivers/blob/master/LICENSE) | ||
|
||
This driver supports LCD peripherals built on the HD44780 chip and controlled with the PCF8574 chip. | ||
|
||
NOTE: these drivers are not production-ready. They are offered as sample | ||
implementations of Android Things user space drivers for common peripherals | ||
as part of the Developer Preview release. There is no guarantee | ||
of correctness, completeness or robustness. | ||
|
||
This driver is based on the [lcd-pcf8574-androidthings driver from Nilhcem](https://github.com/Nilhcem/lcd-pcf8574-androidthings) | ||
and the [hd44780-i2c driver from gorskima](https://github.com/gorskima/hd44780-i2c) | ||
|
||
## How to use the driver | ||
|
||
### Gradle dependency | ||
|
||
To use the `driver-pcf8574-hd44780` driver, simply add the line below to your project's `build.gradle`, | ||
where `<version>` matches the last version of the driver available on [jcenter][jcenter]. | ||
|
||
``` | ||
dependencies { | ||
implementation 'com.leinardi.androidthings:driver-pcf8574-hd44780:<version>' | ||
} | ||
``` | ||
|
||
### Sample usage | ||
|
||
```java | ||
import com.leinardi.androidthings.driver.pcf8574.hd44780.Hd44780; | ||
|
||
// Access the LCD: | ||
Hd44780 mLcd; | ||
|
||
try { | ||
mLcd = new Hd44780(BoardDefaults.getI2CPort(), Hd44780.I2cAddress.PCF8574AT, Hd44780.Geometry.LCD_20X4); | ||
} catch (IOException e) { | ||
// couldn't configure the LCD... | ||
} | ||
|
||
// Draw on the screen: | ||
|
||
try { | ||
mLcd.setBacklight(true); | ||
mLcd.cursorHome(); | ||
mLcd.clearDisplay(); | ||
mLcd.setText("Hello LCD"); | ||
int[] heart = {0b00000, 0b01010, 0b11111, 0b11111, 0b11111, 0b01110, 0b00100, 0b00000}; | ||
mLcd.createCustomChar(heart, 0); | ||
mLcd.setCursor(10, 0); | ||
mLcd.writeCustomChar(0); | ||
} catch (IOException e) { | ||
// error setting LCD | ||
} | ||
|
||
// Close the LCD when finished: | ||
|
||
try { | ||
mLcd.close(); | ||
} catch (IOException e) { | ||
// error closing LCD | ||
} | ||
``` | ||
|
||
## License | ||
|
||
Copyright 2017 Roberto Leinardi | ||
|
||
Licensed to the Apache Software Foundation (ASF) under one or more contributor | ||
license agreements. See the NOTICE file distributed with this work for | ||
additional information regarding copyright ownership. The ASF licenses this | ||
file to you 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. | ||
|
||
[jcenter]: https://bintray.com/leinardi/androidthings/driver-pcf8574-hd44780/_latestVersion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2017 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.library' | ||
apply from: rootProject.file('checkstyle.gradle') | ||
|
||
android { | ||
compileSdkVersion build_versions.target_sdk | ||
buildToolsVersion build_versions.build_tools | ||
|
||
apply from: 'mavenConfig.gradle' | ||
|
||
defaultConfig { | ||
minSdkVersion build_versions.min_sdk | ||
targetSdkVersion build_versions.target_sdk | ||
versionCode build_versions.version_code | ||
versionName mvn_config.version as String | ||
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 { | ||
compileOnly deps.androidthings | ||
implementation deps.support.annotations | ||
|
||
testImplementation deps.androidthings | ||
testImplementation deps.powermock.module_junit4 | ||
testImplementation deps.powermock.api_mockito | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2017 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.github.dcendents.android-maven' | ||
|
||
install { | ||
repositories.mavenInstaller { | ||
pom.project { | ||
name 'driver-pcf8574-hd44780' | ||
description 'Android Things driver for SH1106' | ||
url 'https://github.com/leinardi/androidthings-drivers' | ||
inceptionYear '2017' | ||
|
||
packaging 'aar' | ||
groupId 'com.leinardi.androidthings' | ||
artifactId 'driver-pcf8574-hd44780' | ||
version '0.1' | ||
|
||
licenses { | ||
license { | ||
name 'The Apache Software License, Version 2.0' | ||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution 'repo' | ||
} | ||
} | ||
scm { | ||
connection 'https://github.com/leinardi/androidthings-drivers.git' | ||
url 'https://github.com/leinardi/androidthings-drivers' | ||
|
||
} | ||
developers { | ||
developer { | ||
name "Roberto Leinardi" | ||
email "[email protected]" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2017 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. | ||
*/ | ||
|
||
def mvn_config = [:] | ||
mvn_config.repository = 'androidthings' | ||
mvn_config.group_id = 'com.leinardi.androidthings' | ||
mvn_config.artifact_id = 'driver-pcf8574-hd44780' | ||
mvn_config.version = '0.1' | ||
mvn_config.licenses = 'Apache-2.0' // Comma separated | ||
mvn_config.website = 'https://github.com/leinardi/androidthings-drivers' | ||
mvn_config.issue_tracker_url = 'https://github.com/leinardi/androidthings-drivers/issues' | ||
mvn_config.vcs_url = 'https://github.com/leinardi/androidthings-drivers.git' | ||
mvn_config.description = 'PCF8574-HD44780 LCD driver for Android Things' | ||
mvn_config.tags = 'pcf8574,hd44780,android-things,android,raspberry-pi' // Comma separated | ||
mvn_config.inception_year = '2017' | ||
mvn_config.dryRun = false | ||
mvn_config.publish = false | ||
mvn_config.override = true | ||
|
||
ext.mvn_config = mvn_config | ||
|
||
apply from: rootProject.file('maven.gradle') | ||
apply from: rootProject.file('bintray.gradle') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- | ||
~ Copyright 2017 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. | ||
--> | ||
|
||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.leinardi.androidthings.driver.pcf8574.hd44780" /> |
Oops, something went wrong.