-
Notifications
You must be signed in to change notification settings - Fork 0
/
i2c_lcd.h
62 lines (52 loc) · 1.52 KB
/
i2c_lcd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef I2C_LCD_H
#define I2C_LCD_H
#include "stm32f1xx_hal.h"
/**
* @brief Structure to hold LCD instance information
*/
typedef struct {
I2C_HandleTypeDef *hi2c; // I2C handler for communication
uint8_t address; // I2C address of the LCD
} I2C_LCD_HandleTypeDef;
/**
* @brief Initializes the LCD.
* @param lcd: Pointer to the LCD handle
*/
void lcd_init(I2C_LCD_HandleTypeDef *lcd);
/**
* @brief Sends a command to the LCD.
* @param lcd: Pointer to the LCD handle
* @param cmd: Command byte to send
*/
void lcd_send_cmd(I2C_LCD_HandleTypeDef *lcd, char cmd);
/**
* @brief Sends data (character) to the LCD.
* @param lcd: Pointer to the LCD handle
* @param data: Data byte to send
*/
void lcd_send_data(I2C_LCD_HandleTypeDef *lcd, char data);
/**
* @brief Sends a single character to the LCD.
* @param lcd: Pointer to the LCD handle
* @param ch: Character to send
*/
void lcd_putchar(I2C_LCD_HandleTypeDef *lcd, char ch);
/**
* @brief Sends a string to the LCD.
* @param lcd: Pointer to the LCD handle
* @param str: Null-terminated string to send
*/
void lcd_puts(I2C_LCD_HandleTypeDef *lcd, char *str);
/**
* @brief Moves the cursor to a specific position on the LCD.
* @param lcd: Pointer to the LCD handle
* @param col: Column number (0-15)
* @param row: Row number (0 or 1)
*/
void lcd_gotoxy(I2C_LCD_HandleTypeDef *lcd, int col, int row);
/**
* @brief Clears the LCD display.
* @param lcd: Pointer to the LCD handle
*/
void lcd_clear(I2C_LCD_HandleTypeDef *lcd);
#endif /* I2C_LCD_H */