Class ShiftRegisterLcdAdapter
java.lang.Object
com.ibasco.ucgdisplay.drivers.clcd.BaseLcdGpioAdapter
com.ibasco.ucgdisplay.drivers.clcd.adapters.ShiftRegisterLcdAdapter
- All Implemented Interfaces:
LcdGpioAdapter
Shift Register LCD Adapter. Applicable only for Shift Out registers (e.g. 74HC595). Please note that daisy chained
shift-out registers
are not yet supported at this time.
- Author:
- Rafael Ibasco
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A collection of valid Shift Register Output Pins -
Constructor Summary
ConstructorDescriptionShiftRegisterLcdAdapter(com.pi4j.io.gpio.GpioProvider provider, com.pi4j.io.gpio.Pin dataPin, com.pi4j.io.gpio.Pin latchPin, com.pi4j.io.gpio.Pin clockPin, LcdPinMapConfig lcdPinMap)
Default Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform any necessary initialization.void
setEnableState(com.pi4j.io.gpio.PinState state)
Sets the LCD's Enable Pin statevoid
setReadWriteState(LcdReadWriteState state)
Sets the LCD's Read/Write Pin state.void
Sets the LCD's Register Select Pin stateprotected void
validate(LcdPinMapConfig pinMapConfig)
Verify that we have the required lcd pins mappedvoid
write4Bits(byte value)
Sends a 4-bit value to the interface.void
write8Bits(byte value)
Sends an 8-bit value to the interface.Methods inherited from class com.ibasco.ucgdisplay.drivers.clcd.BaseLcdGpioAdapter
getMappedPin, isMapped
-
Constructor Details
-
ShiftRegisterLcdAdapter
public ShiftRegisterLcdAdapter(com.pi4j.io.gpio.GpioProvider provider, com.pi4j.io.gpio.Pin dataPin, com.pi4j.io.gpio.Pin latchPin, com.pi4j.io.gpio.Pin clockPin, LcdPinMapConfig lcdPinMap) throws IllegalArgumentExceptionDefault Constructor.- Parameters:
provider
- TheGpioProvider
that will be driving the Data, Latch and Clock pins of the shift registerdataPin
- The data pin of the Shift RegisterlatchPin
- The latch pin of the Shift RegisterclockPin
- The clock pin of the Shift RegisterlcdPinMap
- TheLcdPinMapConfig
instance containing the pin mapping configuration- Throws:
IllegalArgumentException
- Thrown when pin mapping validation fails
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:LcdGpioAdapter
Perform any necessary initialization. (e.g. Setting pinmodes of digital output pins) -
validate
Description copied from class:BaseLcdGpioAdapter
Verify that we have the required lcd pins mapped- Specified by:
validate
in classBaseLcdGpioAdapter
- Throws:
InvalidPinMappingException
-
write4Bits
public void write4Bits(byte value)Description copied from interface:LcdGpioAdapter
Sends a 4-bit value to the interface.- Parameters:
value
- The 4-bit value to be transmitted over the LCD Interface
-
write8Bits
public void write8Bits(byte value)Description copied from interface:LcdGpioAdapter
Sends an 8-bit value to the interface.- Parameters:
value
- The 8-bit value to be transmitted over the LCD Interface
-
setRegSelectState
Description copied from interface:LcdGpioAdapter
Sets the LCD's Register Select Pin state- Parameters:
state
- The state of the Register Select Pin. Set to eitherLcdRegisterSelectState.COMMAND
orLcdRegisterSelectState.DATA
-
setReadWriteState
Description copied from interface:LcdGpioAdapter
Sets the LCD's Read/Write Pin state. Setting the state to WRITE will set the LCD RW pin to LOW while READ will set the LCD RW pin to HIGH.- Parameters:
state
- The state to set (READ/WRITE) for the LCD RW Pin
-
setEnableState
public void setEnableState(com.pi4j.io.gpio.PinState state)Description copied from interface:LcdGpioAdapter
Sets the LCD's Enable Pin state- Parameters:
state
- ThePinState
to set for the LCD Enable pin.
-