Linux I2C驱动分析2 - 通过设备树添加设备

这篇具有很好参考价值的文章主要介绍了Linux I2C驱动分析2 - 通过设备树添加设备。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一. I2C通过设备树添加设备

        通过设备可以向I2C总线添加I2C设备,设备树举例如下:

i2c: i2c@900 {
    compatible = "ralink,rt2880-i2c";
    reg = <0x900 0x100>;

    resets = <&rstctrl 16>;
    reset-names = "i2c";

    #address-cells = <1>;
    #size-cells = <0>;

    pinctrl-names = "default";
    pinctrl-0 = <&i2c_pins>;
    
    oled {
        compatible = "oled0.98";
        reg = <0x3c>;
    };
};

        设备树中在I2C总线下添加了一个oled0.98设备,oled在I2C总线中的地址为0x3c。可以在/sys/bus/platform下看到这个设备。

# ls /sys/bus/platform/devices/10000900.i2c/i2c-0/0-003c/
driver     modalias   name       subsystem  uevent

# cat /sys/bus/platform/devices/10000900.i2c/i2c-0/0-003c/name 
oled0.98

二. I2C驱动代码

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/fs.h>

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");

三. I2C应用代码

#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>


#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 g_oled_buffer2[SSD1306_WIDTH * SSD1306_HEIGHT / 8] = {0};

static uint8_t s1[SSD1306_WIDTH * SSD1306_HEIGHT / 8] = 
{
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,
    0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,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,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF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,0x02,0x03,0x03,0x07,0x07,0x07,0x06,0x06,
    0x0F,0x0F,0x0D,0x1D,0x78,0x3B,0x37,0x7F,0xE7,0xCF,0xCF,0x1F,0x3F,0x7F,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0x1F,0x87,0xE3,0xF1,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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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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,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0xCF,0x87,0xF1,0xF9,0x7C,0x1C,0x0E,
    0x1E,0x07,0x83,0x83,0xF7,0xFF,0x7E,0x1E,0xC0,0xE1,0xFB,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,0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CD,0xE5,0xFD,0x3D,0x3D,0x81,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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,0x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,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,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,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0x18,0x0C,0x0F,0x0F,0x07,0x06,0x0E,0xC3,0x83,0x83,
    0x83,0xE3,0xC1,0xC1,0x41,0x61,0x61,0x71,0x63,0x21,0x21,0x21,0x01,0x01,0x03,0x01,
    0x03,0x09,0x09,0x09,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,0x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8,0xF8,0xF8,
    0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,
    0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,0xF8,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,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]);
        }
    }
}

        以上的代码功能是首先打开oled设备,初始化oled,然后轮流显示四张图片,形成一个简单的动画。

四. 应用程序的效果

        运行应用代码,oled会出现一个动画,因为四张图片轮流播放,效果如下

设备树添加i2c设备,Linux内核学习总结,驱动开发文章来源地址https://www.toymoban.com/news/detail-624414.html

到了这里,关于Linux I2C驱动分析2 - 通过设备树添加设备的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • I2C知识大全系列四 —— I2C驱动之Linux下的I2C

    Linux 系统定义了 I2C 驱动体系结构。在 Linux 系统中, I2C 驱动由三部分组成,即 I2C 核心 、 I2C 总线驱动 和 I2C 设备驱动 。这三部分相互协作,形成了非常通用、可适应性很强的 I2C 框架。 I2C核心 I2C 核心提供了 I2C 总线驱动 和 设备驱动 的 注册 、 注销方法 , I2C 通信方法

    2024年02月07日
    浏览(58)
  • QEMU学习(五):I2C设备仿真及驱动开发

            I2C 是很常用的一个串行通信接口,用于连接各种外设、传感器等器件, 本章我们来学习一下如何在QEMU里仿真I2C设备及 Linux 下开发 I2C 接口器件驱动。 下面是标准的设备添加结构,我们使用的是常见的at_24c系列设备来做I2C的通信,详细代码请看qemuhwnvrameeprom_

    2024年02月08日
    浏览(123)
  • 【驱动】I2C驱动分析(三)-关键数据类型

    i2c_bus_type 用于表示 I2C 总线类型。 bus_type 是 Linux 内核中用于表示总线类型的结构体,用于管理该类型总线上的设备。 .name : 用于指定总线类型的名称。在这里,总线类型的名称被设置为 “i2c”,表示 I2C 总线类型。 .match : 匹配设备与总线。 .probe : 用于在设备与总线匹配成功

    2024年01月19日
    浏览(48)
  • Linux I2C 驱动实验

    目录 一、Linux I2C 驱动简介 1、I2C 总线驱动 2、I2C 设备驱动 1、 i2c_client 结构体 2、 i2c_driver 结构体 二、硬件分析 三、设备树编写 1、pinctrl_i2c1 2、在 i2c1 节点追加 ap3216c 子节点 3、验证 四、 代码编写 1、makefile 2、ap3216c.h  3、ap3216c.c ①、头文件 ②、驱动出入口  ③、 i2c驱动

    2024年02月08日
    浏览(54)
  • Linux驱动开发(I2C系统的重要结构体)

    本篇文章来讲解I2C系统的重要结构体,了解这些结构体对于编写I2C驱动来说是至关重要的,所以要想编写好一个I2C驱动程序那么就必须先了解这些结构体。 这里使用百问网的一张图片来讲解: 一个芯片中可以有多个I2C控制器,并且一个I2C控制器可以控制多个设备。那么在对

    2024年02月07日
    浏览(50)
  • Linux驱动开发之i2c框架讲解到例程

            本篇章在rk3399平台上,基于设备树的i2c驱动开发。i2c直接使用硬件i2c总线,体系结构分为3部分:I2C 核心、I2C 总线驱动和I2C 设备驱动。 I2C 核心 (i2c-core.c)提供了I2C 总线驱动和设备驱动的注册、注销方法等。我们主要了解Linux中i2c的基本框架,分为 i2c主机驱动开发

    2024年02月02日
    浏览(44)
  • 详解AT24CXX驱动开发(linux platform tree - i2c应用)

    目录 概述 1 认识AT24Cxx 1.1 AT24CXX的特性 1.2 AT24CXX描述 1.2.1 引脚 1.2.2 容量描述 1.2.3 设备地址 1.3 操作时序 1.3.1 写单个字节时序 1.3.2 写page字节时序 1.3.3 读取当前数据时序 1.3.4 随机读取数据 1.3.5 连续读取多个数据 2 驱动开发 2.1 硬件接口 2.2 代码实现 2.2.1 查看设备信息 2.2.2 编写

    2024年02月22日
    浏览(47)
  • 设备树解析 & i2c设备模型

    目录 1、基础概念 1、总线 2、手机启动流程 1、MTK启动流程 2、高通启动流程的差别 3、设备树解析 1、设备树相关 2、设备树解析 4、 i2c 设备初始化流程 1、总线 总线是连接多个设备或者接入点的数据传输通路。 老的电脑主机的都有PCI插槽类似现在的内存条,可以插声卡、网

    2024年02月03日
    浏览(37)
  • 什么是I2C,I2C怎么用,从实例波形分析I2C读写

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 今天分享的主题是I2C通信。接下来从I2C是什么,怎么用,以及以时钟外设读写作为实例进行分析。 I2C(Inter-Integrated Circuit) ,也可以叫IIC、I2C,译作集成电路总线,是 两线式串行通信总线 ,用于设备

    2024年01月19日
    浏览(58)
  • I2C总线驱动

    SOC芯片平台的外设分为: 一级外设:外设控制器集成在SOC芯片内部 二级外设:外设控制器由另一块芯片负责,通过一些通讯总线与SOC芯片相连 Inter-Integrated Circuit: 字面意思是用于“集成电路之间”的通信总线,简写:IIC(或者I2C) i2c传输的要点就是: 传输一个字节 后面必然

    2024年02月15日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包