Linux I2C驱动分析4 - GPIO模拟I2C

一. 前言

        在嵌入式开发中,由于芯片的I2C接口有限,或者出于硬件画板的方便,我们都需要将普通的GPIO模拟I2C接口使用。出于对这样的需求,Linux-2.6.x已经有相关代码了,Linux-3.x有标准的内核选项支持该功能,内核的代码位于linux_kernel/drivers/i2c/busses/i2c-gpio.c,本文主要介绍怎么使用i2c-gpio模块。本文的内核使用的是内核版本是linux-3.18.45,CPU是MT7620。

二. 详细步骤

1. 开启内核选项

        开启CONFIG_I2C_GPIO选项。示例如下

CONFIG_I2C_GPIO:
                                                                                                                                                                                                                
This is a very simple bitbanging I2C driver utilizing the                                                                                                                                                                           
arch-neutral GPIO API to control the SCL and SDA lines.    
                                                                                                                                                                         
Symbol: I2C_GPIO [=y]                                                                                                                                                                                                               
Type  : tristate                                                                                                                                                                                                                    
Prompt: GPIO-based bitbanging I2C                                                                                                                                                                                                   
  Location:                                                                                                                                                                                                                         
    -> Device Drivers                                                                                                                                                                                                               
      -> I2C support                                                                                                                                                                                                                
        -> I2C support (I2C [=y])                                                                                                                                                                                                   
          -> I2C Hardware Bus support                                                                                                                                                                                               
  Defined at drivers/i2c/busses/Kconfig:497                                                                                                                                                                                         
  Depends on: I2C [=y] && HAS_IOMEM [=y] && GPIOLIB [=y]                                                                                                                                                                            

2. 设置使用的Pin为普通GPIO

        本例中,我使用的引脚分别是:MDIO(GPIO#22) - SDA,MDC(GPIO#23) - SCL。所以,需要先将MT7620的MDIO接口复用模式设置为普通GPIO,通过修改设备树文件,示例如下:

pinctrl {
		state_default: pinctrl0 {
			default {
				ralink,group = "pa", "spi refclk", "wdt", "uartf", "nd_sd", "mdio", "i2c";
				ralink,function = "gpio";
			};
		};
		
		i2c_pins: i2c_pins {
			i2c_pins {
					ralink,group = "i2c";
					ralink,function = "i2c";
			};
		};
	};

        注意:ralink,group里面要加入mdio,表示将mdio作为普通GPIO使用。

3. 编写设备树描述i2c-gpio设备

        使用的GPIO以上有说明,这里直接给出示例,如下

i2c-gpio {
		compatible = "i2c-gpio";
		gpios = <&gpio0 22 0 /* sda */
			&gpio0 23 0 /* scl */
		>;
		i2c-gpio,sda-open-drain;
		i2c-gpio,scl-open-drain;
		i2c-gpio,delay-us = <2>;    /* ~100 kHz */
		#address-cells = <1>;
		#size-cells = <0>;

		oled {
			compatible = "oled0.98";
			reg = <0x3c>;
		};
	};

gpios:表示SDA和SCL分别使用什么GPIO。

i2c-gpio,sda-open-drain:SDA引脚设置为开漏极

i2c-gpio,scl-open-drain:SCL引脚设置为开漏极

i2c-gpio,delay-us:指定I2C接口速率。  

oled:表示该总线下挂的设备,0.98寸的oled。

设备树编写可以参考linux-3.18.45/Documentation/devicetree/bindings/i2c/i2c-gpio.txt。

4. 编写驱动

        驱动程序直接使用前面博客使用的驱动,示例如下:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
 
static int major;
static struct class *class;
static struct i2c_client *at24c02_client; 
	
ssize_t at24c02_read(struct file *file, char __user *buf, size_t size, loff_t *offset)
{
	unsigned char addr, data;
 
	copy_from_user(&addr, buf, 1);
	data = i2c_smbus_read_byte_data(at24c02_client, addr);
	copy_to_user(buf, &data, 1);
 
	return 1;
}
 
ssize_t at24c02_write(struct file *file, const char __user *buf, size_t size, loff_t *offset)
{
	unsigned char ker_buf[1024] = "";
	unsigned char addr, cmd;
	unsigned char data[1024] = ""; 
 
	copy_from_user(ker_buf, buf, size);
	cmd = ker_buf[0];
	
	if (0 == cmd) /* 0 - cmd, 1 - data */
	{
		i2c_smbus_write_byte_data(at24c02_client, 0x00, *(ker_buf + 1));
	}
	else
	{
		i2c_smbus_write_byte_data(at24c02_client, 0x40, *(ker_buf + 1));
	}
}
 
 
struct file_operations i2c_fops = {
	.owner = THIS_MODULE,
	.read  = at24c02_read,
	.write = at24c02_write, 
};
 
static int i2c_drv_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
	printk("i2c client %s, id %ld probed\n", client->name, id->driver_data);
	at24c02_client = client;
	
	major = register_chrdev(0, "at24c02", &i2c_fops);
	if (major > 0)
	{
		class = class_create(THIS_MODULE, "at24c02");
		if (class)
		{
			device_create(class, NULL, MKDEV(major, 0), NULL, "at24c02");
		}
	}	
	
	return 0;
}
 
static int i2c_drv_remove(struct i2c_client *client)
{
	printk("i2c client %s removed\n", client->name);
	device_destroy(class, MKDEV(major, 0));
	class_destroy(class);
	unregister_chrdev(major, "at24c02");
	return 0;
}
 
static const struct i2c_device_id i2c_dev_id[] = {
	{ "oled0.98", 0x3c },
	{ },
};
 
 
static struct i2c_driver i2c_drv = {
	.probe		= i2c_drv_probe,
	.remove		= i2c_drv_remove,
	.id_table	= i2c_dev_id,
	.driver 	= {
		.name = "oled",
		.owner = THIS_MODULE,
	},
};
		
static int i2c_driver_init(void)
{
	i2c_add_driver(&i2c_drv);
 
    return 0;
}
 
 
void i2c_driver_exit(void)
{
	i2c_del_driver(&i2c_drv);
		
    return;
}
 
module_init(i2c_driver_init);
module_exit(i2c_driver_exit);
MODULE_LICENSE("GPL");
 

5. 测试程序

        测试程序也参考之前写的博客,如下:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
 
 
#define OLED_WRITE_ADDR    0x78
#define SSD1306_WIDTH  128
#define SSD1306_HEIGHT 64
#define WRITE_CMD      			 0X00
#define WRITE_DATA     			 0X40
 
#define CONTROL_TYPE    0x00
 
#define I2C_OLED_MASTER_NUM             I2C_NUM_0
 
 
#define WRITE_BIT                          I2C_MASTER_WRITE /*!< I2C master write */
#define READ_BIT                           I2C_MASTER_READ  /*!< I2C master read */
#define ACK_CHECK_EN                       0x1              /*!< I2C master will check ack from slave*/
#define ACK_CHECK_DIS                      0x0              /*!< I2C master will not check ack from slave */
#define ACK_VAL                            0x0              /*!< I2C ack value */
#define NACK_VAL                           0x1              /*!< I2C nack value */
 
 
#define I2C_OLED_MASTER_SCL_IO          22             
#define I2C_OLED_MASTER_SDA_IO          21  
 
static uint8_t g_oled_buffer1[SSD1306_WIDTH * SSD1306_HEIGHT / 8] = {0};
 
uint8_t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xF1,0xF9,0x3C,0x1C,0x0F,0x0F,0x0F,0x03,0x01,
    0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x07,0x03,0x03,0x03,0x3F,0xFE,0xFC,0xF0,0xC1,0x07,0x1F,0xFF,0x03,0x01,0xFB,0xFE,
    0xFE,0xCF,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0xCF,0xFF,0xFF,0x7F,0x00,0x81,0xFF,
    0xFF,0xFF,0x7F,0x3F,0x00,0xCF,0xDF,0xFF,0xFD,0xF0,0xE0,0xE0,0x80,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,
    0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x1E,0x7F,0xFF,0xF3,0xE0,0xE8,0xFE,0xEF,0x9C,0x3C,0x31,0x73,
    0x67,0x6F,0x4E,0x4F,0x58,0x18,0xB0,0xB0,0xB0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,
    0xC0,0x80,0x80,0x80,0x80,0x80,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xE0,0xC0,0xC0,0x40,0x60,0x60,0x60,
    0x60,0x30,0x30,0xB0,0xFC,0xB8,0xDC,0xCE,0xEF,0xE7,0xF3,0xF9,0xFD,0xFC,0xFF,0xFF,
    0xFF,0xE0,0xC0,0xCF,0xDF,0xDF,0xD9,0xD8,0xD9,0xDD,0xCF,0xE7,0xE3,0xF1,0xFB,0xFB,
    0xFA,0xFA,0xEE,0xC6,0xDE,0xDE,0xDC,0xD4,0xDC,0xDC,0xDC,0xCE,0xE6,0xE6,0xE7,0x87,
    0x1F,0x3F,0xFF,0xFF,0xF7,0xC7,0xC3,0xC3,0xC3,0xC3,0xC3,0x43,0x63,0x73,0x73,0xF3,
    0x63,0x63,0x63,0x23,0x23,0x23,0x31,0x31,0x31,0x31,0x71,0x31,0xF1,0xF1,0xD1,0xB1,
    0xF1,0xF1,0xFB,0x1F,0x19,0xD9,0xDF,0xDB,0x19,0x09,0x8B,0xFA,0xFC,0x7C,0x1C,0x00,
    0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x80,0xF8,0xFF,0x7F,0x1F,0x01,0xF0,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xF0,0x00,0x37,0x7F,0x7F,0x78,0x00,0x00,0x08,0x1F,0xFF,0xFF,0xC1,0x03,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x47,0x7F,0x7F,
    0x1F,0x0F,0x7F,0x7E,0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0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0x07,0xC1,0xF8,0xFF,0x3E,0x0F,
    0x03,0x03,0x01,0x01,0xFF,0xFF,0xFE,0x9B,0x00,0xEF,0xFB,0xF9,0xF9,0xBE,0x0E,0x06,
    0xC6,0xFF,0xFC,0xF8,0x01,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0x3F,0x3F,
    0xBF,0xBF,0x9F,0xDF,0xDF,0x5F,0x5F,0x4F,0x6F,0x6F,0x6F,0x6F,0xEF,0x6F,0x6F,0x6F,
    0x6F,0x6F,0xEF,0x6F,0x6F,0x6F,0x6F,0x6F,0x6F,0x6F,0x6F,0xCF,0xDF,0xDF,0xDF,0x9F,
    0xBF,0x3F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0x7F,0x3F,0xFF,0x9F,0xDF,0xCF,0xCF,0x67,0x67,0x37,0x33,0x3F,0x3B,0x1B,0x19,0x0D,
    0x0D,0x0D,0x0C,0x0C,0x06,0x0F,0x0E,0x0E,0x06,0x06,0x02,0x03,0x03,0x03,0x00,0x00,
    0x00,0x00,0x00,0x00,0x03,0x03,0x03,0x02,0x03,0x03,0x03,0x07,0x07,0x07,0x06,0x06,
    0x0F,0x0F,0x0D,0x1C,0x38,0x3B,0x33,0x7F,0xE7,0xCF,0xCF,0x1F,0x3F,0x7F,0xFF,0xFF,
    0xFF,0xFF,0xFF,0x7F,0x0F,0xC7,0xE7,0xF3,0x79,0x7D,0x3C,0x2E,0x06,0x07,0x07,0x03,
    0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x03,0x01,
    0x03,0x03,0x8F,0x8E,0xFE,0xFC,0xF1,0x53,0x07,0xFF,0xFF,0xFF,0x03,0x01,0xFA,0xFE,
    0xFE,0xCF,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC7,0xFF,0xFF,0x7F,0x20,0x81,0xFF,
    0xFF,0xFF,0xFF,0x40,0x00,0xFF,0xFF,0xF9,0xE0,0xC0,0xC0,0x40,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,
    0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x18,0x1C,0x7F,0x7F,0xF7,0xF1,0xE1,0xEF,0xEF,0xEF,0x9C,0x3C,0x31,0x73,
    0x67,0x6F,0x4E,0x4E,0xD8,0x98,0xF0,0xF0,0xB0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,
    0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0xC0,0xE0,0xC0,0xC0,0x40,0x60,0x60,0x60,
    0x60,0x30,0x30,0xB0,0xBC,0xB8,0xDC,0xCE,0xEF,0xE7,0xF3,0xF9,0xFF,0xFC,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xF8,0xEF,0xCF,0xDF,0xDF,0xD9,0xD9,0xFF,0xDF,0xCF,0xC3,0xF7,0xF6,
    0xF7,0xF6,0xE6,0xE4,0xCC,0xDC,0x9C,0x9C,0xBC,0xBC,0xBC,0x9E,0x8E,0xCE,0xE7,0x83,
    0x1F,0x3F,0xFF,0xFF,0xF6,0x4F,0xC3,0xC3,0xC3,0xC3,0xC3,0x43,0x63,0x73,0x73,0xE3,
    0x63,0x63,0x63,0x23,0x23,0x23,0x31,0x31,0x31,0x31,0x71,0x31,0xF1,0xF1,0xD1,0xB1,
    0xF1,0xF1,0xD9,0x1F,0x19,0xD9,0xD9,0xDB,0x19,0x09,0x8B,0xF8,0xFC,0x7C,0x18,0x00,
    0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x80,0xF8,0xFF,0x7F,0x1F,0x01,0xF0,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0x70,0x00,0x17,0x7F,0x7F,0xF8,0x00,0x00,0x0C,0x1F,0xFF,0xFF,0xC1,0x01,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x7F,0x7F,
    0x0F,0x0F,0xFF,0x7E,0x70,0x01,0x33,0x78,0x78,0x7F,0x1F,0x07,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x70,0x7E,0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B,0x79,0x39,0x1D,0x0C,0x06,
    0xC6,0xF6,0xFE,0x7C,0x19,0x81,0xE3,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xCB,0xCB,0x99,0x9D,0xBD,0xBD,0x35,0x25,0x65,0x65,0x65,0x6D,0x6D,0x6C,
    0xEC,0xCC,0xF9,0x79,0x3B,0x3B,0x1B,0x0F,0x0F,0x0E,0x06,0x06,0x42,0xC3,0x83,0x83,
    0xA3,0xE3,0xC1,0xC1,0x41,0x61,0x61,0x71,0x63,0x23,0x21,0x23,0x01,0x01,0x01,0x01,
    0x03,0x09,0x09,0x09,0x0D,0x0D,0x0D,0x0F,0x3D,0x07,0x07,0x07,0x03,0x02,0x06,0x86,
    0x86,0x8C,0xCD,0xF9,0x79,0x73,0x33,0x33,0x33,0x1B,0x1B,0x19,0x0D,0x0D,0x0D,0x0C,
    0x04,0x06,0x06,0x06,0x06,0x07,0x02,0x02,0x02,0x03,0x03,0x03,0x00,0x00,0x00,0x00,
    0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x06,0x06,0x06,0x06,0x0F,
    0x0F,0x1D,0x19,0x39,0x32,0x77,0xF7,0xDF,0x8F,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x81,0x00,0x3C,0xFF,
    0xFF,0xFF,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x03,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFC,0xFE,0xCF,
    0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC7,0xFF,0xFF,0x7E,0x00,0x83,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xFC,
    0xFB,0xF3,0xF3,0xE7,0xE6,0xCC,0xCC,0xD8,0xD8,0xB8,0x98,0xB0,0xB0,0x30,0x20,0x60,
    0xE0,0xE0,0xF0,0xE0,0x60,0x60,0x60,0x60,0x70,0x70,0x60,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x08,0x1C,0x3D,0x7F,0xF7,0xE7,
    0x8E,0x0C,0x1C,0x38,0x38,0x30,0x30,0x20,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,
    0xC0,0x80,0x80,0x80,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x80,0x80,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0x40,0x60,0x60,0x60,0x20,0x30,
    0xB0,0xB8,0x98,0xD8,0xDC,0xFE,0xE7,0xF7,0xF7,0xF8,0xF8,0xFE,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,
    0x1F,0x7F,0xFF,0xFF,0x1F,0x1F,0x3F,0x33,0x73,0xE3,0xE3,0x62,0xE2,0x66,0x46,0x4E,
    0x46,0x46,0x46,0x46,0x44,0x44,0x44,0x46,0x46,0x46,0x46,0x67,0x67,0xE7,0xE7,0xF7,
    0x67,0xE3,0xE3,0xA3,0x33,0x33,0xB1,0x31,0x39,0xF9,0xF8,0xFC,0x78,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0xE8,0xFC,0xFF,0x1F,0x01,0xE0,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,
    0x00,0x00,0x1F,0x3F,0x7F,0x22,0x00,0x00,0x02,0x3F,0xFF,0x7F,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x3F,0x7F,
    0x7C,0x33,0x7F,0x7F,0x7C,0x00,0xC4,0xFC,0x7E,0x3F,0x0F,0x01,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x78,0x7F,0x3F,0x07,0x00,0x18,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0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xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0x7F,0x3F,0x3F,0x9F,0xDF,0xCF,0xEF,0x67,0x67,0x37,0x33,0x13,0x1B,0x1B,0x1B,
    0x09,0x0D,0x0D,0x0D,0x0D,0x04,0x0C,0x1F,0x1F,0x1F,0x00,0x08,0x3B,0x3F,0xBF,0xFF,
    0xCE,0xF6,0x66,0x66,0x76,0x36,0x3C,0x1C,0x1C,0x1F,0x0F,0x0C,0x0C,0x0C,0x07,0x07,
    0x07,0x06,0x0E,0x02,0x02,0x02,0x02,0x02,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,
    0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x06,0x06,0x06,0x06,0x0F,0x0F,0x1F,
    0x1D,0x3D,0x70,0x72,0xF7,0xCF,0xCF,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x01,0x01,
    0xFC,0xFE,0xFF,0x37,0x07,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x28,0xFC,0xFE,0x9E,0x0F,0x0F,0x89,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0x7C,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0xF0,
    0xE7,0xC7,0x9F,0x9F,0xF8,0xB0,0xF0,0xE0,0xE0,0xF0,0xC0,0xE0,0x80,0x80,0x80,0x80,
    0x80,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x03,0x03,0x07,0x0F,0x0F,
    0x1C,0x18,0x38,0x30,0xB0,0xA0,0xE0,0xF8,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,
    0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0xC0,0xF0,0xC0,0xC0,0xC0,0x60,0x70,0x70,0x60,0x60,0x30,0xB0,0xB0,0x98,
    0x98,0xDC,0xCC,0xCE,0xE7,0xF3,0xF1,0xF8,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0x3F,0x01,0xC8,0xFC,0xFF,0x3F,0x1F,0x3F,0x39,0xF1,0xE1,0x63,0xC3,0xCF,0xCF,
    0xCD,0x8D,0x8D,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x8B,0x88,0x88,0x8C,0xCC,0xCC,
    0xCC,0xC4,0xE6,0xE6,0xE6,0xF3,0x73,0xB1,0xFD,0xF9,0xFB,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x60,0xFC,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0x3F,0x00,0x10,0x7F,0x7F,0x79,0x00,0x00,0x00,0x87,0xFF,0x7F,0x70,0x40,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,
    0xFF,0x7F,0xFE,0xFF,0xFF,0x17,0xE0,0x7F,0x7F,0x1F,0x07,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x33,0x3F,0x7F,0x0F,0x00,0x18,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF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F,0xFF,
    0xFF,0xFF,0xFF,0x7F,0x3F,0x9F,0xDF,0xDF,0xCF,0xEF,0x67,0x67,0x37,0x33,0x13,0x1B,
    0x3B,0x3B,0x09,0x0D,0x0D,0x0D,0x0D,0x05,0x04,0x3E,0x3E,0x3E,0x0F,0x0F,0xE6,0xE3,
    0xF3,0xF1,0x79,0x7C,0x7C,0x3E,0x3F,0x1F,0x1F,0x1C,0x0C,0x0D,0x0D,0x04,0x04,0x06,
    0x06,0x06,0x0E,0x0A,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,
    0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x06,0x06,0x06,0x06,0x0F,0x0F,0x1F,
    0x1D,0x3D,0x70,0x72,0xF7,0xCF,0xCF,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0x0D,0x09,0xFC,0xFF,0xFF,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x28,0xFC,0xFE,0x9F,0x0F,0x0F,0x09,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0xFF,0x7C,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xF8,0xF0,0xE3,0xCF,0x1F,0x1E,0xB8,0xF0,0xF0,0x60,0x60,0xC0,0xC0,0xC0,0x80,0x80,
    0xC0,0xC0,0x80,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x07,0x07,0x03,0x07,0x0F,0x0C,
    0x1C,0x18,0x38,0x30,0x30,0xA0,0xE8,0xF8,0xE0,0xE0,0xC0,0xC0,0xF0,0xE0,0xC0,0x80,
    0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0xC0,0xF0,0xC0,0xC0,0xC0,0x60,0x70,0x70,0x70,0x60,0x30,0xB0,0xB0,0x98,
    0x98,0xFC,0xCC,0xCE,0xE7,0xF3,0xF1,0xF8,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0x3F,0x0D,0xC8,0xFC,0xFF,0x3F,0x3F,0x3F,0x39,0xF1,0xE1,0x63,0xC3,0xCF,0xCE,
    0xCD,0x8D,0x8D,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x8C,0xCC,0xCC,
    0xCC,0xC4,0xE6,0xE6,0xE6,0xF3,0x73,0xB1,0xFD,0xFD,0xFB,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0xE0,0xFC,0xFF,0xFF,0x00,0x00,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0x3F,0x00,0x30,0x7F,0xFF,0x79,0x00,0x00,0x80,0x87,0xFF,0x7F,0xF0,0xC0,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,
    0xFF,0x7F,0x7E,0xFF,0xFF,0xF7,0xE0,0xFF,0x7F,0x1F,0x0F,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x37,0x3F,0x3F,0x1F,0x00,0x18,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFE,0xFE,0xFC,0xFC,0xF8,0xF8,0x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0x0D,0x0D,0x0D,0x0F,0x3D,0x07,0x07,0x07,0x03,0x02,0x06,0x87,
    0x86,0x8C,0xCD,0xF9,0x79,0x73,0x33,0x33,0x33,0x1B,0x1B,0x19,0x0D,0x0D,0x0D,0x0E,
    0x04,0x06,0x07,0x06,0x06,0x07,0x02,0x02,0x02,0x03,0x03,0x03,0x00,0x00,0x00,0x00,
    0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x06,0x06,0x06,0x06,0x0F,
    0x0F,0x1D,0x39,0x39,0x32,0x77,0xF7,0xDF,0x8F,0x1F,0x3F,0x7F,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x81,0x00,0x3C,0xFF,
    0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x03,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFC,0xFE,0xCF,
    0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC7,0xFF,0xFF,0x7E,0x00,0x83,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xFC,
    0xFB,0xF3,0xF3,0xE7,0xE6,0xCC,0xCC,0xD8,0xD8,0xB8,0xB8,0xB0,0xB0,0x30,0x20,0x60,
    0xE0,0xE0,0xF0,0xF0,0x60,0x60,0x60,0x60,0x70,0x70,0x60,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x08,0x1C,0x3E,0x7F,0xF7,0xE7,
    0x8E,0x0C,0x1C,0x18,0x38,0x30,0x30,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xC0,
    0xC0,0x80,0x80,0x80,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x80,0x80,0x80,0x80,0xC0,0xC0,0xC0,0xC0,0x40,0x78,0x60,0x60,0x20,0x30,
    0xB0,0xB8,0x98,0xD8,0xCC,0xEE,0xE7,0xF7,0xF3,0xF8,0xF8,0xFE,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,
    0x1F,0x7F,0xFF,0xFF,0x1F,0x1F,0x3F,0x33,0x73,0xE3,0xE3,0x63,0xE3,0x66,0x46,0x4E,
    0x46,0x46,0x46,0x46,0x44,0x44,0x44,0x46,0x46,0x46,0x46,0x67,0x67,0xE7,0xE7,0xF7,
    0x67,0xE3,0xE3,0xA3,0x33,0x33,0xB1,0x31,0x39,0xF9,0xF8,0xFC,0x78,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0xE8,0xFC,0xFF,0x1F,0x03,0xE2,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,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xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
    0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
    0xF0,0xF0,0xF0,0xF0,0xF0,0xF8,0xF8,0xFC,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
 
};
 
static uint8_t g_oled_buffer[6][SSD1306_WIDTH * SSD1306_HEIGHT / 8];
 
int i2c_fd = 0;
 
char addr = 0x78;
 
 
int i2c_init(void)
{
    i2c_fd = open("/dev/at24c02", O_RDWR);
    if (i2c_fd < 0)
    {
		return -1;
    }
}
 
int oled_read_cmd(uint8_t *data)
{
    return read(i2c_fd, data, 1);
}
 
int oled_write_cmd(uint8_t data)
{
	char buf[2] = "";
 
	buf[0] = 0x00;
	buf[1] = data;
 
    return write(i2c_fd, buf, 2);
}
 
int oled_write_data(uint8_t data)
{
	char buf[2] = "";
 
	buf[0] = 0x01;
	buf[1] = data;
 
    return write(i2c_fd, buf, 2);
}
 
 
int oled_write_long_data(uint8_t *data, uint16_t len)
{
	int i;
 
	for (i = 0; i < len; i++)
	{
		oled_write_data(*(data + i));
	}
 
	return 0;
}
 
 
void oled_update_screen(uint8_t *buffer)
{
    uint8_t line_index;
    for(line_index=0    ;   line_index<8   ;  line_index++)
    {
        oled_write_cmd(0xb0+line_index);
        oled_write_cmd(0x00);
        oled_write_cmd(0x10);
 
        oled_write_long_data(&buffer[SSD1306_WIDTH * line_index],SSD1306_WIDTH);
    }
}
 
void oled_update_screen1(void)
{
    uint8_t line_index;
    for(line_index=0; line_index<8; line_index++)
    {
        oled_write_cmd(0xb0+line_index);
        oled_write_cmd(0x00);
        oled_write_cmd(0x10);
 
        oled_write_long_data(&g_oled_buffer1[SSD1306_WIDTH * line_index],SSD1306_WIDTH);
    }
}
 
void oled_clear(void)
{
    //清0缓存
    memset(g_oled_buffer1,0x00,sizeof(g_oled_buffer1));
    oled_update_screen1();
}
 
int oled_init(void)
{
    oled_write_cmd(0xAE);
    oled_write_cmd(0XD5);
    oled_write_cmd(0X80);
    oled_write_cmd(0XA8);
    oled_write_cmd(0X3F);
    oled_write_cmd(0XD3);
    oled_write_cmd(0X00);
    oled_write_cmd(0X40);
    oled_write_cmd(0XA1);
    oled_write_cmd(0XC8);
    oled_write_cmd(0XDA);
    oled_write_cmd(0X12);
    oled_write_cmd(0X81);
    oled_write_cmd(0XCF);
    oled_write_cmd(0XD9);
    oled_write_cmd(0XF1);
    oled_write_cmd(0XDB);
    oled_write_cmd(0X30);
    oled_write_cmd(0xA4);
    oled_write_cmd(0xA6);
    oled_write_cmd(0x8D);
    oled_write_cmd(0x14);
    oled_write_cmd(0xAF);
 
    oled_clear();
 
    return 0;
}
 
int main(int argc, char *argv[])
{
    uint8_t data = 0;
    uint32_t i = 0;
 
    memcpy(g_oled_buffer[0], s1, sizeof(s1));
    memcpy(g_oled_buffer[1], s2, sizeof(s2));
    memcpy(g_oled_buffer[2], s3, sizeof(s3));
    memcpy(g_oled_buffer[3], s4, sizeof(s4));
    memcpy(g_oled_buffer[4], s5, sizeof(s5));
    memcpy(g_oled_buffer[5], s6, sizeof(s6));
 
    i2c_init();
    oled_init();
 
    for (i = 0; i < SSD1306_WIDTH * SSD1306_HEIGHT / 8; i++)
    {
        g_oled_buffer2[i] = g_oled_buffer[i*8];
    }
 
    while(1)
    {
        for (i = 0; i < 6; i++)
        {
            oled_update_screen(g_oled_buffer[i]);
        }
    }
}

6. 效果

Linux I2C驱动分析4 - GPIO模拟I2C_第1张图片

 

三. 总结

        本文讲解了如何开启并配置内核和设备树,使内核支持GPIO模拟I2C总线的实验。

你可能感兴趣的:(Linux内核学习总结,linux)