-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathep_lcd.h
68 lines (63 loc) · 1.93 KB
/
ep_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
63
64
65
66
67
68
#include <driver/gpio.h>
#include <driver/i2c.h>
#include "freertos/portmacro.h"
#include "hal/i2c_types.h"
#include <unistd.h>
#include <esp_log.h>
#define _LCD_I2C_H
#define CURSOR_SHIFT_LEFT 1
#define CURSOR_SHIFT_RIGHT 0
#define SLAVE_ADDRESS_LCD 0x26
/**
* GPIO pins used for 4 bit mode operations
* reserved for non i2c uses
*/
typedef union {
struct {
int enable_pin;
int register_select;
int data_4;
int data_5;
int data_6;
int data_7;
} pins_t;
int pin_array[6];
} lcd_pins_t;
esp_err_t i2c_master_init(void);
/**
*@brief sends command or data depending on the register select state
*@param rs_state register select state 0 for command 1 for data
*@param comm command coded in hexadecimal (0x)
*/
void i2c_lcd_send_command(int rs_state, int comm, int address);
/**
*@brief initialization sequence for the LCD screen
*@param address i2c address of lcd to send instructions to
*/
void i2c_lcd_init_sequence(int address);
/**
*@brief writes message to lcd
*@param message message to be written (duh)
*@param address i2c address of lcd to send instructions to
*/
void i2c_lcd_write_message(char* msg,int address);
/**
*@brief clears lcd screen
*@param message message to be written (duh)
*@param address i2c address of lcd to send instructions to
*/
void i2c_lcd_clear_screen(int address);
/**
*@brief defines custom character from an 8x8 bit matrix
*@param pattern pattern to be drawn as custom character
*@param location location to store custom characters in (max 4 custom characters)
*/
void i2c_lcd_custom_char(int* pattern[], int location,int address);
/**
*@brief moves cursor to specified coordinates
*@param x x position (columns)
*@param y y position (rows)
*@param direction either CURSOR_SHIFT_LEFT or CURSOR_SHIFT_RIGHT
*@param address i2c address of lcd to send instructions to
*/
void i2c_lcd_shift_cursor(int x,int y, int direction, int address);