Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unsatisfied dependency #213

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void disableActiveBuzzer(){
}

/**
* Emits an beep sound from the active buzzer.
* Emits a beep sound from the active buzzer.
*/
@Get("/beepTone")
public void playBeepTone(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.opensourcewithslu.inputdevices.PIRSensorHelper;
import com.opensourcewithslu.outputdevices.RGBLEDHelper;
import com.opensourcewithslu.utilities.MultipinConfiguration;
import com.opensourcewithslu.utilities.MultiPinConfiguration;
import com.pi4j.io.gpio.digital.DigitalInput;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
Expand All @@ -24,7 +24,7 @@ public class PIRSensorController {
* @param rgbLed A MultiPinConfiguration object.
*/
public PIRSensorController(@Named("pir-sensor")DigitalInput pirSensor,
@Named("rgb-led-2")MultipinConfiguration rgbLed) {
@Named("rgb-led-2") MultiPinConfiguration rgbLed) {
this.pirSensorHelper = new PIRSensorHelper(pirSensor);
this.rgbledHelper = new RGBLEDHelper(rgbLed);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.opensourcewithslu.components.controllers;

import com.opensourcewithslu.inputdevices.RotaryEncoderHelper;
import com.opensourcewithslu.utilities.MultipinConfiguration;
import com.opensourcewithslu.utilities.MultiPinConfiguration;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import jakarta.inject.Named;
Expand All @@ -11,7 +11,7 @@
public class RotaryEncoderController {
private final RotaryEncoderHelper encoderHelper;

public RotaryEncoderController(@Named("rotary-encoder")MultipinConfiguration rotaryEncoder){
public RotaryEncoderController(@Named("rotary-encoder") MultiPinConfiguration rotaryEncoder){
this.encoderHelper = new RotaryEncoderHelper(rotaryEncoder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public String writeDataAtPos(@PathVariable String text, @PathVariable int line,
return "Text written at line " + line + ", position " + pos + ": " + text + "\n";
}

@Get("/write/character/{charvalue}")
public String writeCharacter(@PathVariable char charvalue) {
lcdHelper.writeCharacter(charvalue);
return "Character '" + charvalue + "' written to LCD\n";
@Get("/write/character/{charValue}")
public String writeCharacter(@PathVariable char charValue) {
lcdHelper.writeCharacter(charValue);
return "Character '" + charValue + "' written to LCD\n";
}

@Get("/backlight/{state}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.opensourcewithslu.components.controllers;

import com.opensourcewithslu.outputdevices.RGBLEDHelper;
import com.opensourcewithslu.utilities.MultipinConfiguration;
import com.opensourcewithslu.utilities.MultiPinConfiguration;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import jakarta.inject.Named;
Expand All @@ -11,7 +11,7 @@
public class rgbController {
private final RGBLEDHelper rgbledHelper;

public rgbController(@Named("rgb-led") MultipinConfiguration rgbLed){
public rgbController(@Named("rgb-led") MultiPinConfiguration rgbLed){
this.rgbledHelper = new RGBLEDHelper(rgbLed);
}

Expand Down
42 changes: 2 additions & 40 deletions components/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,6 @@ pi4j:

# tag::pwm[]
pwm:
red-pwm: # <1>
name: red # <2>
address: 17 # <3>
pwmType: SOFTWARE # <4>
provider: pigpio-pwm # <5>
initial: 0 # <6>
shutdown: 0 # <7>
blue-pwm:
name: blue
address: 18
pwmType: SOFTWARE
provider: pigpio-pwm
initial: 0
shutdown: 0
green-pwm:
name: green
address: 27
pwmType: SOFTWARE
provider: pigpio-pwm
initial: 0
shutdown: 0
active-buzzer:
name: active-buzzer
address: 17
Expand Down Expand Up @@ -165,7 +144,7 @@ pi4j:
provider: pigpio-digital-input
# end::multiInput[]

# tag::multipwm[]
# tag::multiPWM[]
multi-pwm:
rgb-led: # <.>
name: RGB LED # <.>
Expand All @@ -181,22 +160,5 @@ pi4j:
provider: pigpio-pwm
initials: 0, 0, 0
shutdowns: 0, 0, 0
# end::multipwm[]

# end::multiPWM[]

# clk:
# name: CLK Output
# address: 23
# debounce: 500
# pull: PULL_UP
# shutdown: LOW
# initial: HIGH
# provider: pigpio-digital-input
# dt:
# name: DT Output
# address: 24
# debounce: 500
# pull: PULL_UP
# shutdown: LOW
# initial: HIGH
# provider: pigpio-digital-input
4 changes: 2 additions & 2 deletions pi4micronaut-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = 'io.github.oss-slu'
version = 'v1.0'
version = 'v1.1'

apply plugin: 'maven-publish'
apply plugin: 'signing'
Expand Down Expand Up @@ -93,7 +93,7 @@ publishing {
mavenJava(MavenPublication) {
groupId = 'io.github.oss-slu'
artifactId = 'pi4micronaut-utils'
version = 'v1.0'
version = 'v1.1'
from components.java

artifact sourcesJar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.opensourcewithslu.inputdevices;

import com.opensourcewithslu.utilities.MultipinConfiguration;
import com.opensourcewithslu.utilities.MultiPinConfiguration;
import com.pi4j.io.gpio.digital.DigitalInput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -23,10 +23,10 @@ public class RotaryEncoderHelper {

/**
* The RotaryEncoderHelper constructor.
* @param multiPin A {@link com.opensourcewithslu.utilities.MultipinConfiguration} Object.
* @param multiPin A {@link com.opensourcewithslu.utilities.MultiPinConfiguration} Object.
*/
//tag::const[]
public RotaryEncoderHelper(MultipinConfiguration multiPin)
public RotaryEncoderHelper(MultiPinConfiguration multiPin)
//end::const[]
{
DigitalInput[] allPins = (DigitalInput[]) multiPin.getComponents();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.opensourcewithslu.outputdevices;

import com.opensourcewithslu.utilities.MultipinConfiguration;
import com.opensourcewithslu.utilities.MultiPinConfiguration;
import com.pi4j.io.pwm.Pwm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -19,10 +19,10 @@ public class RGBLEDHelper {

/**
* The RGBLEDHelper constructor.
* @param pwm A {@link com.opensourcewithslu.utilities.MultipinConfiguration} Object.
* @param pwm A {@link com.opensourcewithslu.utilities.MultiPinConfiguration} Object.
*/
//tag::const[]
public RGBLEDHelper(MultipinConfiguration pwm)
public RGBLEDHelper(MultiPinConfiguration pwm)
//end::const[]
{
log.info("Init rgb");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public void setName(String name) {

/**
* Gets the current debounce value for the component.
* @return Long type representing the debounce of the component.
* @return Long type representing debounce of the component.
*/
public Long getDebounce() { return debounce; }

/**
* Sets the debounce of the component. Replaces existing debounce.
* Sets debounce of the component. Replaces existing debounce.
* @param debounce New debounce of type Long,
*/
public void setDebounce(Long debounce) { this.debounce = debounce; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.opensourcewithslu.utilities;

import com.pi4j.io.gpio.digital.DigitalOutput;
import com.pi4j.io.gpio.digital.DigitalState;
import io.micronaut.context.annotation.EachProperty;
import io.micronaut.context.annotation.Parameter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import com.pi4j.io.gpio.digital.PullResistance;
import io.micronaut.context.annotation.EachProperty;
import io.micronaut.context.annotation.Parameter;
import io.micronaut.context.annotation.Prototype;

import java.util.Arrays;

/**
* This class handles the configuration of a digital input component that has multiple pins.
*/
@Prototype
@EachProperty("pi4j.multi-digital-input")
public class DigitalInputMultiPinConfiguration {
private final String id;
Expand All @@ -23,7 +25,7 @@ public class DigitalInputMultiPinConfiguration {
* @param id The configuration id as defined in the application.yml
*/
public DigitalInputMultiPinConfiguration(@Parameter String id){
this.id = id + "Multipin";
this.id = id + "MultiPin";
}

/**
Expand Down Expand Up @@ -106,7 +108,7 @@ public long[] getDebounces() {

/**
* Sets the debounces for the component. Replaces all the existing debounces.
* @param debounces String representing the dounces for the component. Each debounce seperated by a comma.
* @param debounces String representing the debounces for the component. Each debounce seperated by a comma.
*/
public void setDebounces(String debounces) {
debounces = debounces.replaceAll("\\s", "");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
package com.opensourcewithslu.utilities.MultiPinConfigs;

import com.opensourcewithslu.utilities.Pi4JMultipinFactory;
import com.pi4j.io.gpio.digital.PullResistance;
import com.pi4j.io.pwm.PwmType;
import io.micronaut.context.annotation.EachProperty;
import io.micronaut.context.annotation.Parameter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.micronaut.context.annotation.Prototype;
import java.util.Arrays;

/**
* This class handles the configuration of a PWM device that has multiple pins.
*/
@Prototype
@EachProperty("pi4j.multi-pwm")
public class PwmMultiPinConfiguration {
private static final Logger log = LoggerFactory.getLogger(PwmMultiPinConfiguration.class);
private final String id;
private String name;
private int[] addresses;
Expand All @@ -29,7 +25,7 @@ public class PwmMultiPinConfiguration {
* @param id The configuration id as defined in the application.yml
*/
public PwmMultiPinConfiguration(@Parameter String id){
this.id = id + "Multipin";
this.id = id + "MultiPin";
}

/**
Expand Down Expand Up @@ -86,26 +82,26 @@ public PwmType[] getPwmTypes() {
* @param pwmTypes String of PWM types separated by commas. Software should be formatted as SOFTWARE. Hardware as HARDWARE.
*/
public void setPwmTypes(String pwmTypes) {
String[] pwms = pwmTypes.split(",");
PwmType[] all_pwms = new PwmType[pwms.length];
String[] PWMs = pwmTypes.split(",");
PwmType[] all_PWMs = new PwmType[PWMs.length];

for(int i = 0; i < pwms.length; i++){
if(pwms[i].trim().equals("SOFTWARE")){
all_pwms[i] = PwmType.SOFTWARE;
for(int i = 0; i < PWMs.length; i++){
if(PWMs[i].trim().equals("SOFTWARE")){
all_PWMs[i] = PwmType.SOFTWARE;
}
else{
all_pwms[i] = PwmType.HARDWARE;
all_PWMs[i] = PwmType.HARDWARE;
}
}

this.pwmTypes = all_pwms;
this.pwmTypes = all_PWMs;
}

/**
* Gets the initial states that the component is in when first initialized.
* @return Array of integers representing the initial state for each pin.
*/
public int[] getInitals() {
public int[] getInitials() {
return initials;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
package com.opensourcewithslu.utilities;

import com.pi4j.io.gpio.digital.DigitalState;
import com.pi4j.io.gpio.digital.PullResistance;
import io.micronaut.context.annotation.EachProperty;
import io.micronaut.context.annotation.Parameter;
import io.micronaut.context.annotation.Prototype;

import java.util.Arrays;
import java.util.List;

/**
* Class for configuring multipin components.
* Class for configuring multiPin components.
*/
@Prototype
public class MultipinConfiguration {
public class MultiPinConfiguration {
private final String id;
private final Object[] components;

/**
* The MultipinConfiguration constructor.
* The MultiPinConfiguration constructor.
* @param id The configuration id as defined in the application.yml
* @param components The array of components that are a part of the multipin component.
* @param components The array of components that are a part of the multiPin component.
*/
public MultipinConfiguration(String id, Object[] components){
public MultiPinConfiguration(@Parameter String id, Object[] components){
this.id = id;
this.components = components;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public Pwm createPwm(PwmConfiguration config, Context pi4jContext) {
.address(config.getAddress())
.pwmType(config.getPwmType())
.provider(config.getProvider())
.initial(config.getInital())
.initial(config.getInitial())
.shutdown(config.getShutdown())
.build()
);
Expand Down
Loading
Loading