upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions | Protected Attributes

API for the generic LCD Keypad Shield. More...

Detailed Description

The LCD Keypad Shield uses 7 digital outputs and 1 analog input (for the keypad). The outputs are used to drive an attached LCM1602 LCD controller. This driver should be compatible with the similar LCD keypad shields from Sainsmart, DFRobot and Sparkfun.

keypadlcd.jpg
// Instantiate a LCDKS (LCD Keypad Shield) using default pins
// NOTE: The default pins do not include support for a gpio
// controlled backlight. If you need one, you will need to specify
// all neccessary pins to the constructor.
lcd.setCursor(0, 0);
lcd.write("LCDKS driver");
lcd.setCursor(1, 2);
lcd.write("Hello World");
// output current key value every second.
while (shouldRun) {
cout << "Button value: " << lcd.getKeyValue() << endl;
upm_delay(1);
}

Public Member Functions

 LCDKS (int rs=8, int enable=9, int d0=4, int d1=5, int d2=6, int d3=7, int keypad=0, int backlight=-1)
 
 ~LCDKS ()
 
upm_result_t write (std::string msg)
 
upm_result_t setCursor (int row, int column)
 
upm_result_t clear ()
 
upm_result_t home ()
 
upm_result_t createChar (uint8_t charSlot, std::vector< uint8_t > charData)
 
upm_result_t displayOn ()
 
upm_result_t displayOff ()
 
upm_result_t cursorOn ()
 
upm_result_t cursorOff ()
 
upm_result_t cursorBlinkOn ()
 
upm_result_t cursorBlinkOff ()
 
upm_result_t backlightOn ()
 
upm_result_t backlightOff ()
 
upm_result_t scrollDisplayLeft ()
 
upm_result_t scrollDisplayRight ()
 
upm_result_t entryLeftToRight ()
 
upm_result_t entryRightToLeft ()
 
upm_result_t autoscrollOn ()
 
upm_result_t autoscrollOff ()
 
float getKeyValue ()
 
float getRawKeyValue ()
 

Protected Attributes

lcdks_context m_lcdks
 

Constructor & Destructor Documentation

LCDKS ( int  rs = 8,
int  enable = 9,
int  d0 = 4,
int  d1 = 5,
int  d2 = 6,
int  d3 = 7,
int  keypad = 0,
int  backlight = -1 
)

LCDKS constructor

As this is a shield, you will not likely have any choice over the pins that are used. For this reason, we provide defaults for all of them – of course they can be changed if your device is different.

Parameters
rsRegister select pin.
enableEnable pin.
d0Data 0 pin.
d1Data 1 pin.
d2Data 2 pin.
d3Data 3 pin.
keypadAnalog pin of the keypad.
backlightOptional GPIO backlight pin. Specify -1 if not in use or not supported on your device.
Exceptions
std::runtime_erroron initialization error.

Here is the caller graph for this function:

~LCDKS ( )

LCDKS destructor

Here is the call graph for this function:

Member Function Documentation

upm_result_t write ( std::string  msg)

Writes a string to the LCD

Parameters
msgstd::string to write to the display; note: only ASCII characters are supported
Returns
Result of the operation

Here is the call graph for this function:

upm_result_t setCursor ( int  row,
int  column 
)

Sets the cursor to specified coordinates

Parameters
rowRow to set the cursor to
columnColumn to set the cursor to
Returns
Result of the operation

Here is the call graph for this function:

upm_result_t clear ( )

Clears the display of all characters

Returns
Result of the operation

Here is the call graph for this function:

upm_result_t home ( )

Returns to the original coordinates (0,0)

Returns
Result of the operation

Here is the call graph for this function:

upm_result_t createChar ( uint8_t  charSlot,
std::vector< uint8_t >  charData 
)

Create a custom character

Parameters
charSlotthe character slot to write, only 8 are available
charDataA vector containing 8 bytes making up the character
Returns
Result of operation

Here is the call graph for this function:

upm_result_t displayOn ( )

Turn the display on

Returns
Result of operation

Here is the call graph for this function:

upm_result_t displayOff ( )

Turn the display off

Returns
Result of operation

Here is the call graph for this function:

upm_result_t cursorOn ( )

Turn the cursor on

Returns
Result of operation

Here is the call graph for this function:

upm_result_t cursorOff ( )

Turn the cursor off

Returns
Result of operation

Here is the call graph for this function:

upm_result_t cursorBlinkOn ( )

Turn cursor blink on

Returns
Result of operation

Here is the call graph for this function:

upm_result_t cursorBlinkOff ( )

Turn cursor blink off

Returns
Result of operation

Here is the call graph for this function:

upm_result_t backlightOn ( )

Turn backlight on

Returns
Result of operation

Here is the call graph for this function:

upm_result_t backlightOff ( )

Turn backlight off

Returns
Result of operation

Here is the call graph for this function:

upm_result_t scrollDisplayLeft ( )

Scroll the display left, without changing the character RAM

Returns
Result of operation

Here is the call graph for this function:

upm_result_t scrollDisplayRight ( )

Scroll the display right, without changing the character RAM

Returns
Result of operation

Here is the call graph for this function:

upm_result_t entryLeftToRight ( )

set the entry mode so that characters are added left to right

Returns
Result of operation

Here is the call graph for this function:

upm_result_t entryRightToLeft ( )

set the entry mode so that characters are added right to left

Returns
Result of operation

Here is the call graph for this function:

upm_result_t autoscrollOn ( )

Right justify text entered from the cursor

Returns
Result of operation

Here is the call graph for this function:

upm_result_t autoscrollOff ( )

Left justify text entered from the cursor

Returns
Result of operation

Here is the call graph for this function:

float getKeyValue ( )

Returns the floating point representation of the key that is being pushed. Each key produces a different value between 0.0 and 1.0, and only one key can be read at a time.

Returns
The floating point value representing a key.

Here is the call graph for this function:

Here is the caller graph for this function:

float getRawKeyValue ( )
inline

Returns the floating point representation of the key that is being pushed. Each key produces a different value between 0.0 and 1.0, and only one key can be read at a time.

Deprecated:
This function is deprecated. Use getKeyValue() instead.
Returns
The floating point value representing a key.

Here is the call graph for this function:

Collaboration diagram for LCDKS:
Collaboration graph
[legend]

The documentation for this class was generated from the following files: