- java.lang.Object
-
- com.ibasco.ucgdisplay.drivers.glcd.GlcdConfigBuilder
-
public class GlcdConfigBuilder extends java.lang.Object
Utility class for buildingGlcdConfig
instances- Author:
- Rafael Ibasco
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GlcdConfig
build()
Builds aGlcdConfig
instance containing all the provided configuration options.static GlcdConfigBuilder
create(GlcdDisplay display, GlcdCommProtocol busInterface)
Factory method for creating a new instance of this class together with it's required parameters.GlcdConfigBuilder
mapPin(GlcdPin glcdPin, int value)
Maps aGlcdPin
to a numeric pin of the SoC.<T> GlcdConfigBuilder
option(GlcdOption<T> option, T value)
Adds a new configuration option for the display controller.<T> GlcdConfigBuilder
option(java.lang.String option, T value)
Adds a new configuration option for the display controller.GlcdConfigBuilder
options(java.util.Map<GlcdOption<?>,java.lang.Object> options)
Copies the provided map to this instance.GlcdConfigBuilder
options(java.util.Map<GlcdOption<?>,java.lang.Object> options, boolean clearEntries)
Copies the provided map to this instance.GlcdConfigBuilder
pinMap(GlcdPinMapConfig pinmap)
Set a pin map configuration to be used by the display controller.
-
-
-
Method Detail
-
create
public static GlcdConfigBuilder create(GlcdDisplay display, GlcdCommProtocol busInterface)
Factory method for creating a new instance of this class together with it's required parameters.- Parameters:
display
- The matchingGlcdDisplay
of your display device.busInterface
- The bus interface to be used for communication for your display device.- Returns:
- A new instance of
GlcdConfigBuilder
-
option
public <T> GlcdConfigBuilder option(GlcdOption<T> option, T value)
Adds a new configuration option for the display controller. Existing option entries are replaced.- Type Parameters:
T
- Capture of theGlcdOption
type.- Parameters:
option
- The display configuration option.value
- The value of the configuration option. If null is provided, the option would be deleted from the underlying map.- Returns:
- This instance
- See Also:
GlcdOption
-
options
public GlcdConfigBuilder options(java.util.Map<GlcdOption<?>,java.lang.Object> options)
Copies the provided map to this instance. Existing entries are retained but duplicate entries would be overwritten.- Parameters:
options
- The options map to copy- Returns:
- This instance
-
options
public GlcdConfigBuilder options(java.util.Map<GlcdOption<?>,java.lang.Object> options, boolean clearEntries)
Copies the provided map to this instance.- Parameters:
options
- The options map to copyclearEntries
- Clears the map and overwrites all existing entries- Returns:
- This instance
-
option
public <T> GlcdConfigBuilder option(java.lang.String option, T value)
Adds a new configuration option for the display controller. This is similar tooption(GlcdOption, Object)
but this accepts a String value as key, allowing you to provide other values.- Type Parameters:
T
- The captured type of the configuration option value- Parameters:
option
- The name/key of the configuration option.value
- The value of the configuration option.- Returns:
- This instance
- See Also:
GlcdOption
-
pinMap
public GlcdConfigBuilder pinMap(GlcdPinMapConfig pinmap)
Set a pin map configuration to be used by the display controller.- Parameters:
pinmap
- The pin map configuration- Returns:
- This instance
- See Also:
GlcdPin
-
mapPin
public GlcdConfigBuilder mapPin(GlcdPin glcdPin, int value)
Maps aGlcdPin
to a numeric pin of the SoC. For Raspberry Pi devices, the pin numbering follows the BCM pinout (0 - 53). This is just a shortcut forpinMap(GlcdPinMapConfig)
- Parameters:
glcdPin
- TheGlcdPin
enumerationvalue
- The GPIO pin number on your SoC device.- Returns:
- This instance
- See Also:
pinMap(GlcdPinMapConfig)
-
build
public GlcdConfig build()
Builds aGlcdConfig
instance containing all the provided configuration options.- Returns:
- The
GlcdConfig
to be used by U8g2
-
-