Package com.opensourcewithslu.utilities
Class Pi4JFactory
java.lang.Object
com.opensourcewithslu.utilities.Pi4JFactory
The Pi4JFactory class is responsible for creating all the beans for components that are being used.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.pi4j.io.gpio.digital.DigitalInput
createDigitalInput
(DigitalInputConfiguration config, com.pi4j.context.Context pi4jContext) Creates a DigitalInput object for digital input components.com.pi4j.io.gpio.digital.DigitalOutput
createDigitalOutput
(DigitalOutputConfiguration config, com.pi4j.context.Context pi4jContext) Creates a DigitalOutput object for digital output components.com.pi4j.io.i2c.I2CConfig
createI2C
(i2cConfiguration config, com.pi4j.context.Context pi4jContext) Creates an I2CConfigBuilder Object for components that are I2C.com.pi4j.context.Context
This creates the Pi4J Context that is used to create all the beans for the individual components.com.pi4j.io.pwm.Pwm
createPwm
(PwmConfiguration config, com.pi4j.context.Context pi4jContext) Creates a PWM object for components that are pwm.com.pi4j.io.spi.SpiConfig
createSpi
(SpiConfiguration config, com.pi4j.context.Context pi4jContext) Creates an SpiConfigBuilder object for components that are SPI.
-
Constructor Details
-
Pi4JFactory
public Pi4JFactory()Default constructor for Pi4JFactory.
-
-
Method Details
-
createPi4jContext
@Singleton @Bean(preDestroy="shutdown") public com.pi4j.context.Context createPi4jContext()This creates the Pi4J Context that is used to create all the beans for the individual components.- Returns:
- A Pi4J Context
-
createDigitalOutput
@Singleton @EachBean(DigitalOutputConfiguration.class) public com.pi4j.io.gpio.digital.DigitalOutput createDigitalOutput(DigitalOutputConfiguration config, com.pi4j.context.Context pi4jContext) Creates a DigitalOutput object for digital output components.- Parameters:
config
-DigitalOutputConfiguration
Object.pi4jContext
- The Pi4JContext
.- Returns:
- A DigitalOutput Object.
-
createDigitalInput
@Singleton @EachBean(DigitalInputConfiguration.class) public com.pi4j.io.gpio.digital.DigitalInput createDigitalInput(DigitalInputConfiguration config, com.pi4j.context.Context pi4jContext) Creates a DigitalInput object for digital input components.- Parameters:
config
-DigitalInputConfiguration
Object.pi4jContext
- The Pi4JContext
.- Returns:
- A DigitalInput Object.
-
createPwm
@Singleton @EachBean(PwmConfiguration.class) public com.pi4j.io.pwm.Pwm createPwm(PwmConfiguration config, com.pi4j.context.Context pi4jContext) Creates a PWM object for components that are pwm.- Parameters:
config
-PwmConfiguration
Object.pi4jContext
- The Pi4JContext
.- Returns:
- A PWM Object.
-
createSpi
@Singleton @EachBean(SpiConfiguration.class) public com.pi4j.io.spi.SpiConfig createSpi(SpiConfiguration config, com.pi4j.context.Context pi4jContext) Creates an SpiConfigBuilder object for components that are SPI.- Parameters:
config
-SpiConfiguration
Object.pi4jContext
- The Pi4JContext
.- Returns:
- A SpiConfigBuilder Object.
-
createI2C
@Singleton @EachBean(i2cConfiguration.class) public com.pi4j.io.i2c.I2CConfig createI2C(i2cConfiguration config, com.pi4j.context.Context pi4jContext) Creates an I2CConfigBuilder Object for components that are I2C.- Parameters:
config
-i2cConfiguration
Object.pi4jContext
- The Pi4JContext
.- Returns:
- A I2CConfigBuilder Object.
-