On the Pi Pico, if you prefer to work in C a reasonably complete subset of the program interface is available here with almost all of the functionality of the C++ version. The advanced buffering commands are not available. Even without them, substantial speed improvements are still achieved. (But C++ is still recommended.)
|
Set up the lcd display. The I2C pins are not initialized. See LCD_I2C_Setup().
|
void | lcd_init (byte address, byte columns, byte rows, i2c_inst_t *I2C) |
| Initialize the lcd display. More...
|
|
|
These are the simplist output routines for writing characters to the LCD screen. They are in the spirit of the example in the Pi Pico SDK.
Also see the Theory of Operation for hints on maximizing display speed.
|
void | lcd_writeChar (byte val) |
| Output a character to the screen. More...
|
|
void | lcd_writeString (const char str[]) |
| Output a string to the screen. Naming is more in the style of the Pico SDK, and the Enable_Buffering parameter can be utilized. More...
|
|
void | lcd_writeBuffer (const uint8_t *buffer, size_t size) |
| Write array of bytes. More...
|
|
|
The cursor can be displayed on the screen as an underscore at the current location, or as a blinking inversion of the character at the cursor location. Both of these modes can be enabled at once, or they can both be turned off, making the cursor invisible!
|
void | lcd_cursor (void) |
| Display the underline cursor at the current cursor location. More...
|
|
void | lcd_noCursor (void) |
| Hides the underline cursor at the current cursor location. More...
|
|
void | lcd_blink (void) |
| Display the blinking inverted cursor at the current cursor location. More...
|
|
void | lcd_noBlink (void) |
| Disable the blinking inverted cursor at the current cursor location. More...
|
|
|
void | lcd_scrollDisplayLeft (void) |
| Scrolls the display and cursor one position to the left. home() will restore it to its original position. More...
|
|
void | lcd_scrollDisplayRight (void) |
| Scrolls the display and cursor one position to the right. home() will restore it to its original position. More...
|
|
void | lcd_autoscroll (void) |
| Turns on automatic scrolling of the display. More...
|
|
void | lcd_noAutoscroll (void) |
| Turns off automatic scrolling of the display. More...
|
|
void | lcd_leftToRight (void) |
| Sets the text direction to left to right. Each character output advances the cursor one position to the right. This is the default condition. More...
|
|
void | lcd_rightToLeft (void) |
| Sets the text direction to right to left. Each character output advances the cursor one position to the left. More...
|
|
|
The display can store 8 user defined custom characters. They are stored at "memory addresses" 0-7. They are displayed when character codes 0-7 are written to the display. Of course, character value "0" cannot be included in a string because it would be the string terminator. A 0 can be written using the write single character routines, or the write() method with an array of characters and a character count. As an alternative, the display controller also duplicates the special characters as character codes 8-15 (0x8-0xf), which can be encoded and written as strings.
|
void | lcd_createChar (byte charnum, const byte char_map[]) |
| Create a custom character. More...
|
|
◆ lcd_autoscroll()
void lcd_autoscroll |
( |
void |
| ) |
|
|
noexcept |
Turns on automatic scrolling of the display.
◆ lcd_backlight()
void lcd_backlight |
( |
void |
| ) |
|
|
noexcept |
Turn on the display backlight.
◆ lcd_blink()
Display the blinking inverted cursor at the current cursor location.
◆ lcd_clear()
◆ lcd_createChar()
void lcd_createChar |
( |
byte |
charnum, |
|
|
const byte |
char_map[] |
|
) |
| |
|
noexcept |
Create a custom character.
Load a custom character into the display by specifying the location in memory to be stored (8 locations maximum, starting from 0) and an array of 8 bytes. The bytes contain a bit map of the 5x7 dot matrix to display. Each byte specifies one row of character dots starting with the top-most row. The lsb of each byte is the right-most dot on its corresponding line of the character.
- Parameters
-
charnum | The memory address (character code) 0-7 |
char_map | The byte array |
◆ lcd_cursor()
Display the underline cursor at the current cursor location.
◆ lcd_display()
void lcd_display |
( |
void |
| ) |
|
|
noexcept |
Turns the display on without modifying data on it.
The display is unblanked, and all data sent to the display is displayed.
◆ lcd_home()
"Home" the display.
Moves cursor to 0,0 and removes any shifts.
◆ lcd_init()
void lcd_init |
( |
byte |
address, |
|
|
byte |
columns, |
|
|
byte |
rows, |
|
|
i2c_inst_t * |
I2C |
|
) |
| |
Initialize the lcd display.
- Parameters
-
address | The I2C address |
columns | The LCD's number of columns |
rows | The LCD's number of rows (lines) |
I2C | The I2C instance |
- Note
- If called more than once, the existing LCD class object will be
-
discarded (and destroyed), and a new one created and initialized with the given
-
parameters. Use with care!
- Warning
- The Pi Pico pins and the I2C bus are not initialized! (But see See LCD_I2C_Setup().)
◆ lcd_leftToRight()
void lcd_leftToRight |
( |
void |
| ) |
|
|
noexcept |
Sets the text direction to left to right. Each character output advances the cursor one position to the right. This is the default condition.
◆ lcd_noAutoscroll()
void lcd_noAutoscroll |
( |
void |
| ) |
|
|
noexcept |
Turns off automatic scrolling of the display.
◆ lcd_noBacklight()
void lcd_noBacklight |
( |
void |
| ) |
|
|
noexcept |
Turn off the display backlight
◆ lcd_noBlink()
void lcd_noBlink |
( |
void |
| ) |
|
|
noexcept |
Disable the blinking inverted cursor at the current cursor location.
◆ lcd_noCursor()
void lcd_noCursor |
( |
void |
| ) |
|
|
noexcept |
Hides the underline cursor at the current cursor location.
◆ lcd_noDisplay()
void lcd_noDisplay |
( |
void |
| ) |
|
|
noexcept |
Turns the display off without modifying data on it.
The display is blanked as though it had been cleared, but the data and cursor position are not changed.
◆ lcd_rightToLeft()
void lcd_rightToLeft |
( |
void |
| ) |
|
|
noexcept |
Sets the text direction to right to left. Each character output advances the cursor one position to the left.
◆ lcd_scrollDisplayLeft()
void lcd_scrollDisplayLeft |
( |
void |
| ) |
|
|
noexcept |
Scrolls the display and cursor one position to the left. home() will restore it to its original position.
◆ lcd_scrollDisplayRight()
void lcd_scrollDisplayRight |
( |
void |
| ) |
|
|
noexcept |
Scrolls the display and cursor one position to the right. home() will restore it to its original position.
◆ lcd_setCursor()
void lcd_setCursor |
( |
byte |
line, |
|
|
byte |
position |
|
) |
| |
|
noexcept |
Move the input cursor to a location on the screen.
All output to the screen is placed at the current cursor position. In the default mode, the cursor then advances one position to the right. The cursor does not scroll to the next line.
- Parameters
-
line | Specifies the row (or line) on the display |
position | Specifies the position on the row (or column) on the display |
◆ lcd_writeBuffer()
void lcd_writeBuffer |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
Write array of bytes.
- Parameters
-
buffer | The array of bytes to output |
size | The number of bytes to write |
◆ lcd_writeChar()
void lcd_writeChar |
( |
byte |
val | ) |
|
|
noexcept |
Output a character to the screen.
- Parameters
-
val | is the character to display |
◆ lcd_writeString()
void lcd_writeString |
( |
const char |
str[] | ) |
|
|
noexcept |
Output a string to the screen. Naming is more in the style of the Pico SDK, and the Enable_Buffering parameter can be utilized.
- Parameters
-
str | is pointer to the string to display |