-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlcd.h
More file actions
32 lines (31 loc) · 975 Bytes
/
lcd.h
File metadata and controls
32 lines (31 loc) · 975 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
// #include <linux/i2c-dev.h>
#include <fcntl.h>
// #include<sys/ioctl.h>
#include<string.h>
#define I2C_BUS "/dev/i2c-2" // I2C bus device
#define I2C_ADDR 0x27 // I2C slave address for the LCD module
#define BINARY_FORMAT " %c %c %c %c %c %c %c %c\n"
#define BYTE_TO_BINARY(byte) \
(byte & 0x80 ? '1' : '0'), \
(byte & 0x40 ? '1' : '0'), \
(byte & 0x20 ? '1' : '0'), \
(byte & 0x10 ? '1' : '0'), \
(byte & 0x08 ? '1' : '0'), \
(byte & 0x04 ? '1' : '0'), \
(byte & 0x02 ? '1' : '0'), \
(byte & 0x01 ? '1' : '0')
static int32_t debug=0;
int32_t lcd_backlight;
static int32_t debug;
char address;
int32_t i2cFile;
unsigned char i2c_ctrl(int32_t backLight,int32_t enable, int32_t read_write, int32_t register_select);
void clearDisplay();
void i2c_init() ;
void i2c_stop();
void i2c_send_byte(unsigned char data) ;
int32_t i2c_msg(const char *str);