Skip to content

Commit

Permalink
project refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jveverka committed Jan 25, 2021
1 parent 6e7ad56 commit ad1e4fd
Show file tree
Hide file tree
Showing 117 changed files with 414 additions and 360 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
![Build and Test](https://github.com/jveverka/itx-rpi-drivers/workflows/Build%20and%20Test/badge.svg)
![Build and Test](https://github.com/jveverka/rpi-drivers/workflows/Build%20and%20Test/badge.svg)

# Raspberry PI projects and drivers

![banner](docs/graphics-banner.svg)

This project contains various DYI projects, hardware drivers, schematics and code examples for Raspberry PI.

* __[pi4j-drivers](pi4j-drivers)__ - Java APIs for some PRi/[pi4j](https://pi4j.com/) compatible hardware.
* __[rpi-drivers](rpi-drivers)__ - Java APIs for some PRi/[pi4j](https://pi4j.com/) compatible hardware.
* __[rpi-powercontroller](rpi-powercontroller)__ - Control relay power switch via HTTP/REST APIs.
* __[rpi-powercontroller-client](rpi-powercontroller-client)__ - Java Client for __[rpi-powercontroller](rpi-powercontroller)__.
* __[rpi-camera](rpi-camera)__ - Capture images via HTTP/REST APIs.
* __[waveshare-lcd-13-driver](waveshare-lcd-13-driver)__ - Java driver for small LCD display.
* __[sensehat-games](sensehat-games)__ - small compilation of python games for 8x8 [sensehat](https://www.raspberrypi.org/products/sense-hat/) display.
Expand Down
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ subprojects {
}
}

project(':pi4j-drivers') {
project(':rpi-drivers') {
}

project(':rpi-powercontroller-client') {
}

project(':rpi-powercontroller') {
dependencies {
implementation project(':pi4j-drivers')
implementation project(':rpi-drivers')
implementation project(':rpi-powercontroller-client')
}
}
13 changes: 0 additions & 13 deletions pi4j-drivers/src/test/resources/run-gpio-test.sh

This file was deleted.

File renamed without changes.
10 changes: 5 additions & 5 deletions pi4j-drivers/README.md → rpi-drivers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ Written in Java using [pi4j](http://pi4j.com/).
### maven:
```
<dependency>
<groupId>itx.rpi.hardware</groupId>
<artifactId>itx-rpi-drivers</artifactId>
<groupId>one.microproject.rpi</groupId>
<artifactId>rpi-drivers</artifactId>
<version>1.0.0</version>
</dependency>
```

### gradle:
```
implementation 'itx.rpi.hardware:itx-rpi-drivers:1.0.0'
implementation 'one.microproject.rpi:rpi-drivers:1.0.0'
```

### testing:
* install java on raspberry pi
* enable I2C on raspberry pi
* copy pi4j and itx-rpi-drivers jars in tmp directory
* copy pi4j and rpi-drivers jars in tmp directory
* wire hardware as necessary
* start tests in itx.rpi.hardware.gpio.tests
* start tests in one.microproject.rpi.hardware.gpio.tests


8 changes: 4 additions & 4 deletions pi4j-drivers/build.gradle → rpi-drivers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
sourceCompatibility = 1.8
targetCompatibility = 1.8

group = 'itx.rpi.hardware'
group = 'one.microproject.rpi'
version = '1.0.0'

repositories {
Expand All @@ -19,17 +19,17 @@ dependencies {
}

jar {
archiveBaseName = 'itx-rpi-drivers'
archiveBaseName = 'rpi-drivers'
}

task jarSources(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
archiveBaseName = 'itx-rpi-drivers'
archiveBaseName = 'rpi-drivers'
}

task jarJavadoc(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
archiveBaseName = 'itx-rpi-drivers'
archiveBaseName = 'rpi-drivers'
}

artifacts {
Expand Down
1 change: 1 addition & 0 deletions rpi-drivers/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rpi-drivers'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.sensors;
package one.microproject.rpi.hardware.gpio.sensors;

import com.pi4j.io.i2c.I2CBus;
import com.pi4j.io.i2c.I2CDevice;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.sensors;
package one.microproject.rpi.hardware.gpio.sensors;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.sensors;
package one.microproject.rpi.hardware.gpio.sensors;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.sensors;
package one.microproject.rpi.hardware.gpio.sensors;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.sensors;
package one.microproject.rpi.hardware.gpio.sensors;

import com.pi4j.io.i2c.I2CBus;
import com.pi4j.io.i2c.I2CDevice;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.sensors;
package one.microproject.rpi.hardware.gpio.sensors;

import com.pi4j.io.i2c.I2CBus;
import com.pi4j.io.i2c.I2CDevice;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import itx.rpi.hardware.gpio.sensors.BMP180;
import one.microproject.rpi.hardware.gpio.sensors.BMP180;

public class BMP180Test {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import itx.rpi.hardware.gpio.sensors.DS1621;
import one.microproject.rpi.hardware.gpio.sensors.DS1621;

public class DS1621Test {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import itx.rpi.hardware.gpio.sensors.HCSR04;
import one.microproject.rpi.hardware.gpio.sensors.HCSR04;

public class HCSR04Test {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
import com.pi4j.io.gpio.event.GpioPinListenerDigital;

import itx.rpi.hardware.gpio.sensors.HCSR501;
import one.microproject.rpi.hardware.gpio.sensors.HCSR501;

public class HCSR501Test {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import itx.rpi.hardware.gpio.sensors.HTU21DF;
import one.microproject.rpi.hardware.gpio.sensors.HTU21DF;

public class HTU21DTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package itx.rpi.hardware.gpio.tests;
package one.microproject.rpi.hardware.gpio.tests;

import itx.rpi.hardware.gpio.sensors.BMP180;
import itx.rpi.hardware.gpio.sensors.HTU21DF;
import one.microproject.rpi.hardware.gpio.sensors.BMP180;
import one.microproject.rpi.hardware.gpio.sensors.HTU21DF;

public class Test implements Runnable {

Expand Down
13 changes: 13 additions & 0 deletions rpi-drivers/src/test/resources/run-gpio-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

export CLASSPATH=pi4j-core-1.1.jar:gpio-drivers.jar

#java -classpath $CLASSPATH one.microproject.rpi.hardware.gpio.tests.ButtonTest
#java -classpath $CLASSPATH one.microproject.rpi.hardware.gpio.tests.LEDBlinkTest
#java -classpath $CLASSPATH one.microproject.rpi.hardware.gpio.tests.BMP180Test
#java -classpath $CLASSPATH one.microproject.rpi.hardware.gpio.tests.HTU21DTest
#java -classpath $CLASSPATH one.microproject.rpi.hardware.gpio.tests.HCSR04Test
#java -classpath $CLASSPATH one.microproject.rpi.hardware.gpio.tests.HCSR501Test
#java -classpath $CLASSPATH one.microproject.rpi.hardware.gpio.tests.DS1621Test


31 changes: 31 additions & 0 deletions rpi-powercontroller-client/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id 'java'
id 'maven-publish'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'one.microproject.rpi.powercontroller'
version = '1.0.0'

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation 'org.slf4j:slf4j-api:1.7.30'
implementation 'org.slf4j:slf4j-simple:1.7.30'
implementation 'com.fasterxml.jackson.core:jackson-core:2.11.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.3'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.3'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0'
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
one/microproject/rpi/powercontroller/PowerControllerClientBuilder.java
one.microproject.rpi.powercontroller.PowerControllerClientBuilder
one/microproject/rpi/powercontroller/PowerControllerClient.java
one.microproject.rpi.powercontroller.PowerControllerClient
2 changes: 2 additions & 0 deletions rpi-powercontroller-client/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

1 change: 1 addition & 0 deletions rpi-powercontroller-client/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rpi-powercontroller-client'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package one.microproject.rpi.powercontroller;

public interface PowerControllerClient {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package one.microproject.rpi.powercontroller;

public class PowerControllerClientBuilder {
}
2 changes: 1 addition & 1 deletion rpi-powercontroller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ curl -u <client-id>:<client-secret> http://<server>:<port>/uri

## Build & Test on dev PC
RPi Power Controller is designed to be build and tested on PC. In this case
``itx.rpi.powercontroller.services.impl.RPiSimulatedServiceImpl`` is used instead of real RPi hardware.
``RPiSimulatedServiceImpl`` is used instead of real RPi hardware.
### Development Environment
* [OpenJDK 8 or 11](https://adoptopenjdk.net/).
* [Gradle 6.0](https://gradle.org/install/) or later.
Expand Down
4 changes: 2 additions & 2 deletions rpi-powercontroller/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ plugins {

sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'itx.rpi.powercontroller'
group = 'one.microproject.rpi.powercontroller'
version = '1.0.0'
mainClassName = 'itx.rpi.powercontroller.PowerControllerApp'
mainClassName = 'one.microproject.rpi.powercontroller.PowerControllerApp'
applicationDefaultJvmArgs = ['-Xms32m', '-Xmx32m', '-XX:MaxMetaspaceSize=32m']

repositories {
Expand Down
1 change: 1 addition & 0 deletions rpi-powercontroller/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'rpi-powercontroller'

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
package itx.rpi.powercontroller;
package one.microproject.rpi.powercontroller;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.undertow.Handlers;
import io.undertow.Undertow;
import io.undertow.server.handlers.BlockingHandler;
import io.undertow.server.handlers.PathHandler;
import itx.rpi.powercontroller.config.Configuration;
import itx.rpi.powercontroller.dto.JobId;
import itx.rpi.powercontroller.handlers.CancelAllTasksHandler;
import itx.rpi.powercontroller.handlers.CancelTaskHandler;
import itx.rpi.powercontroller.handlers.CleanTaskQueueHandler;
import itx.rpi.powercontroller.handlers.JobInfoHandler;
import itx.rpi.powercontroller.handlers.JobKillAllIdHandler;
import itx.rpi.powercontroller.handlers.MeasurementsHandler;
import itx.rpi.powercontroller.handlers.PortStateHandler;
import itx.rpi.powercontroller.handlers.SubmitTaskHandler;
import itx.rpi.powercontroller.handlers.SystemInfoHandler;
import itx.rpi.powercontroller.handlers.SystemStateHandler;
import itx.rpi.powercontroller.handlers.TasksInfoHandler;
import itx.rpi.powercontroller.handlers.WaitForTaskStartedHandler;
import itx.rpi.powercontroller.handlers.WaitForTaskTerminationHandler;
import itx.rpi.powercontroller.services.AAService;
import itx.rpi.powercontroller.services.PortListener;
import itx.rpi.powercontroller.services.RPiService;
import itx.rpi.powercontroller.services.ShutdownHook;
import itx.rpi.powercontroller.services.SystemInfoService;
import itx.rpi.powercontroller.services.TaskManagerService;
import itx.rpi.powercontroller.services.TaskQueueCleaner;
import itx.rpi.powercontroller.services.impl.AAServiceImpl;
import itx.rpi.powercontroller.services.impl.PortListenerImpl;
import itx.rpi.powercontroller.services.impl.RPiServiceFactory;
import itx.rpi.powercontroller.services.impl.SystemInfoServiceImpl;
import itx.rpi.powercontroller.services.jobs.TaskManagerFactory;
import one.microproject.rpi.powercontroller.config.Configuration;
import one.microproject.rpi.powercontroller.dto.JobId;
import one.microproject.rpi.powercontroller.handlers.CancelAllTasksHandler;
import one.microproject.rpi.powercontroller.handlers.CancelTaskHandler;
import one.microproject.rpi.powercontroller.handlers.CleanTaskQueueHandler;
import one.microproject.rpi.powercontroller.handlers.JobInfoHandler;
import one.microproject.rpi.powercontroller.handlers.JobKillAllIdHandler;
import one.microproject.rpi.powercontroller.handlers.MeasurementsHandler;
import one.microproject.rpi.powercontroller.handlers.PortStateHandler;
import one.microproject.rpi.powercontroller.handlers.SubmitTaskHandler;
import one.microproject.rpi.powercontroller.handlers.SystemInfoHandler;
import one.microproject.rpi.powercontroller.handlers.SystemStateHandler;
import one.microproject.rpi.powercontroller.handlers.TasksInfoHandler;
import one.microproject.rpi.powercontroller.handlers.WaitForTaskStartedHandler;
import one.microproject.rpi.powercontroller.handlers.WaitForTaskTerminationHandler;
import one.microproject.rpi.powercontroller.services.AAService;
import one.microproject.rpi.powercontroller.services.PortListener;
import one.microproject.rpi.powercontroller.services.RPiService;
import one.microproject.rpi.powercontroller.services.ShutdownHook;
import one.microproject.rpi.powercontroller.services.SystemInfoService;
import one.microproject.rpi.powercontroller.services.TaskManagerService;
import one.microproject.rpi.powercontroller.services.TaskQueueCleaner;
import one.microproject.rpi.powercontroller.services.impl.AAServiceImpl;
import one.microproject.rpi.powercontroller.services.impl.PortListenerImpl;
import one.microproject.rpi.powercontroller.services.impl.RPiServiceFactory;
import one.microproject.rpi.powercontroller.services.impl.SystemInfoServiceImpl;
import one.microproject.rpi.powercontroller.services.jobs.TaskManagerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Loading

0 comments on commit ad1e4fd

Please sign in to comment.