Zap'Em Blast'Em Robots
robots that play laser tag!
Loading...
Searching...
No Matches
lcd.h File Reference

Header file for I2C 20x4 LCD control functions. More...

#include "stm32f4xx_hal.h"

Go to the source code of this file.

Macros

#define LCD_I2C_ADDR   (0x27 << 1)
 Adjust to match your LCD I2C address (typically 0x27 or 0x3F)

Functions

void lcd_init (void)
 Initializes the LCD in 4-bit I2C mode.
void lcd_clear (void)
 Clears the LCD display.
void lcd_set_cursor (uint8_t row, uint8_t col)
 Sets the LCD cursor to a specific row and column.
void lcd_print (char *str)
 Prints a null-terminated string to the LCD.
void lcd_send_command (uint8_t cmd)
 Sends a command byte to the LCD.
void lcd_send_data (uint8_t data)
 Sends a data byte (character) to the LCD.
void lcd_force_backlight_on (void)
 Forces the LCD backlight to remain on.

Variables

I2C_HandleTypeDef hi2c1
 External handle to use your I2C peripheral.

Detailed Description

Header file for I2C 20x4 LCD control functions.

Author
Andrew Carr and Kai De La Cruz

Created on: May 22, 2025

Function Documentation

◆ lcd_force_backlight_on()

void lcd_force_backlight_on ( void )

Forces the LCD backlight to remain on.

Forces the LCD backlight to remain on.

◆ lcd_init()

void lcd_init ( void )

Initializes the LCD in 4-bit I2C mode.

Initializes the LCD in 4-bit I2C mode.

◆ lcd_print()

void lcd_print ( char * str)

Prints a null-terminated string to the LCD.

Parameters
strPointer to the string to print

Prints a null-terminated string to the LCD.

Parameters
strNull-terminated character string

◆ lcd_send_command()

void lcd_send_command ( uint8_t cmd)

Sends a command byte to the LCD.

Parameters
cmdCommand to send
cmdCommand byte

◆ lcd_send_data()

void lcd_send_data ( uint8_t data)

Sends a data byte (character) to the LCD.

Parameters
dataCharacter to display
dataData byte

◆ lcd_set_cursor()

void lcd_set_cursor ( uint8_t row,
uint8_t col )

Sets the LCD cursor to a specific row and column.

Parameters
rowRow index (0–3)
colColumn index (0–19)

Sets the LCD cursor to a specific row and column.

Parameters
rowRow index (0–3)
colColumn index (0–19)