upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
API for the LCM1602 I2C controller for HD44780-based displays. More...
This supports all sizes of HD44780 displays, from 16x2 to 4x20. The controller has no idea of the actual display hardware, so it lets you write farther than you can see. These displays with such controllers are available from various manufacturers with different I2C addresses. Adafruit* TC1602A-01T seems to be a well-documented example. The driver also supports parallel GPIO connections directly to the HD44780 in case you are not using an I2C expander/backpack.
Example for LCM1602 displays that use the I2C bus
Code sample for GPIO based LCM1602 displays
Public Member Functions | |
Lcm1602 (int bus=0, int address=0x27, bool isExpander=true, uint8_t numColumns=16, uint8_t numRows=2) | |
Lcm1602 (int rs, int enable, int d0, int d1, int d2, int d3, uint8_t numColumns=16, uint8_t numRows=2) | |
~Lcm1602 () | |
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 () |
Protected Member Functions | |
upm_result_t | command (uint8_t cmd) |
upm_result_t | data (uint8_t data) |
Protected Attributes | |
lcm1602_context | m_lcm1602 |
Lcm1602 | ( | int | bus = 0 , |
int | address = 0x27 , |
||
bool | isExpander = true , |
||
uint8_t | numColumns = 16 , |
||
uint8_t | numRows = 2 |
||
) |
Lcm1602 constructor; calls libmraa initialisation functions
bus | I2C bus to use. Default 0 (autodetect). |
address | Slave address the LCD is registered on. Default 0x27 |
isExpander | True if we are dealing with an I2C expander, false otherwise. Default is true. |
numColumns | Number of columns the display has. Default 16. |
numRows | Number of rows the display has. Default 2. |
Lcm1602 | ( | int | rs, |
int | enable, | ||
int | d0, | ||
int | d1, | ||
int | d2, | ||
int | d3, | ||
uint8_t | numColumns = 16 , |
||
uint8_t | numRows = 2 |
||
) |
Lcm1602 alternate constructor, used for GPIO based HD44780 controllers supporting RS, Enable, and 4 data pins in 4-bit mode.
rs | Register select pin |
enable | Enable pin |
d0 | Data 0 pin |
d1 | Data 1 pin |
d2 | Data 2 pin |
d3 | Data 3 pin |
numColumns | Number of columns the display has. Default 16. |
numRows | Number of rows the display has. Default 2. |
upm_result_t write | ( | std::string | msg | ) |
Writes a string to the LCD
msg | std::string to write to the display; note: only ASCII characters are supported |
upm_result_t setCursor | ( | int | row, |
int | column | ||
) |
Sets the cursor to specified coordinates
row | Row to set the cursor to |
column | Column to set the cursor to |
upm_result_t clear | ( | ) |
Clears the display of all characters
upm_result_t home | ( | ) |
Returns to the original coordinates (0,0)
upm_result_t createChar | ( | uint8_t | charSlot, |
std::vector< uint8_t > | charData | ||
) |
Create a custom character
charSlot | the character slot to write, only 8 are available |
charData | A vector containing 8 bytes making up the character |
upm_result_t displayOn | ( | ) |
Turn the display on
upm_result_t displayOff | ( | ) |
Turn the display off
upm_result_t cursorOn | ( | ) |
Turn the cursor on
upm_result_t cursorOff | ( | ) |
Turn the cursor off
upm_result_t cursorBlinkOn | ( | ) |
Turn cursor blink on
upm_result_t cursorBlinkOff | ( | ) |
Turn cursor blink off
upm_result_t backlightOn | ( | ) |
Turn backlight on
upm_result_t backlightOff | ( | ) |
Turn backlight off
upm_result_t scrollDisplayLeft | ( | ) |
Scroll the display left, without changing the character RAM
upm_result_t scrollDisplayRight | ( | ) |
Scroll the display right, without changing the character RAM
upm_result_t entryLeftToRight | ( | ) |
set the entry mode so that characters are added left to right
upm_result_t entryRightToLeft | ( | ) |
set the entry mode so that characters are added right to left
upm_result_t autoscrollOn | ( | ) |
Right justify text entered from the cursor
upm_result_t autoscrollOff | ( | ) |
Left justify text entered from the cursor