Fast LCD I2C driver 1.0
Fast driver for LCDs on I2C for Pi-Pico and Arduino
LCD_I2C-C.h
Go to the documentation of this file.
1
19#pragma once
20#include <stdint.h>
21#include <hardware/i2c.h>
22
24 typedef uint8_t byte;
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
48
63 void lcd_init(byte address, byte columns, byte rows, i2c_inst_t *I2C) ;
65
66
74
79 void lcd_writeChar(byte val) ;
80
88 void lcd_writeString(const char str[]) ;
89
90
97 void lcd_writeBuffer(const uint8_t *buffer, size_t size) ;
98
100
105
118 void lcd_setCursor(byte line, byte position) ;
119
124 void lcd_clear(void) ;
125
131 void lcd_home(void) ;
132
133
138 void lcd_backlight(void) ;
139
144 void lcd_noBacklight(void) ;
145
151 void lcd_display(void) ;
152
160 void lcd_noDisplay(void) ;
161
163
170
173 void lcd_cursor(void) ;
174
178 void lcd_noCursor(void) ;
179
183 void lcd_blink(void) ;
184
188 void lcd_noBlink(void) ;
189
191
197
203 void lcd_scrollDisplayLeft(void) ;
204
209 void lcd_scrollDisplayRight(void) ;
210
214 void lcd_autoscroll(void) ;
215
219 void lcd_noAutoscroll(void) ;
220
226 void lcd_leftToRight(void) ;
227
232 void lcd_rightToLeft(void) ;
234
249
262 void lcd_createChar(byte charnum, const byte char_map[]) ;
263
270
271#ifndef I2C_Setup_defined
272 #define I2C_Setup_defined
273
274 /*
275 * @brief Helper function to set up the I2C bus on Pi Pico
276 *
277 * Sets up the I2C bus given instance on the given pins with a specified
278 * clock rate. Defines the pins for the pico tools.
279 *
280 * @param I2C is the I2C bus instance to use. Either i2c0 or i2c1.
281 * @param SDA is the Pi Pico Pin for the I2C SDA (data) line.
282 * @param SCL is the Pi Pico Pin for the I2C SCL (clock) line.
283 * @param I2C_Clock is the I2C bus speed. Typically 100000 or 400000.
284 *
285 * @return (int) The actual *(theoretical)* I2C speed from i2c_init
286 *
287 */
288
289 int LCD_I2C_Setup(i2c_inst_t* I2C, uint SDA_Pin, uint SCL_Pin, uint I2C_Clock) ;
290;
291#endif
292
294
295#ifdef __cplusplus
296}
297#endif
298
void lcd_leftToRight(void)
Sets the text direction to left to right. Each character output advances the cursor one position to t...
Definition: LCD_I2C-C.cpp:179
void lcd_noDisplay(void)
Turns the display off without modifying data on it.
Definition: LCD_I2C-C.cpp:143
void lcd_setCursor(byte line, byte position)
Move the input cursor to a location on the screen.
Definition: LCD_I2C-C.cpp:75
void lcd_blink(void)
Display the blinking inverted cursor at the current cursor location.
Definition: LCD_I2C-C.cpp:125
void lcd_noAutoscroll(void)
Turns off automatic scrolling of the display.
Definition: LCD_I2C-C.cpp:167
void lcd_home(void)
"Home" the display.
Definition: LCD_I2C-C.cpp:68
void lcd_autoscroll(void)
Turns on automatic scrolling of the display.
Definition: LCD_I2C-C.cpp:161
void lcd_init(byte address, byte columns, byte rows, i2c_inst_t *I2C)
Initialize the lcd display.
void lcd_scrollDisplayLeft(void)
Scrolls the display and cursor one position to the left. home() will restore it to its original posit...
Definition: LCD_I2C-C.cpp:149
void lcd_writeChar(byte val)
Output a character to the screen.
Definition: LCD_I2C-C.cpp:88
void lcd_noCursor(void)
Hides the underline cursor at the current cursor location.
Definition: LCD_I2C-C.cpp:119
void lcd_writeBuffer(const uint8_t *buffer, size_t size)
Write array of bytes.
void lcd_rightToLeft(void)
Sets the text direction to right to left. Each character output advances the cursor one position to t...
Definition: LCD_I2C-C.cpp:173
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 ...
Definition: LCD_I2C-C.cpp:82
void lcd_cursor(void)
Display the underline cursor at the current cursor location.
Definition: LCD_I2C-C.cpp:113
void lcd_createChar(byte charnum, const byte char_map[])
Create a custom character.
Definition: LCD_I2C-C.cpp:185
void lcd_backlight(void)
Turn on the display backlight.
Definition: LCD_I2C-C.cpp:101
void lcd_clear(void)
Clear the display.
Definition: LCD_I2C-C.cpp:62
void lcd_display(void)
Turns the display on without modifying data on it.
Definition: LCD_I2C-C.cpp:137
void lcd_noBlink(void)
Disable the blinking inverted cursor at the current cursor location.
Definition: LCD_I2C-C.cpp:131
void lcd_noBacklight(void)
Turn off the display backlight
Definition: LCD_I2C-C.cpp:107
void lcd_scrollDisplayRight(void)
Scrolls the display and cursor one position to the right. home() will restore it to its original posi...
Definition: LCD_I2C-C.cpp:155
int LCD_I2C_Setup(i2c_inst_t *I2C, uint SDA_Pin, uint SCL_Pin, uint I2C_Clock)
Helper function to set up the I2C bus on Pi Pico.
Definition: LCD_I2C.cpp:314