请大佬们帮忙看下代码哪里出错了,如果直接驱动墨水屏是已经没问题了,画点函数也是可以用的
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <asm/io.h> //含有 ioremap 函数 iounmap 函数
#include <asm/uaccess.h> //含有 copy_from_user 函数和含有 copy_to_user 函数
#include <linux/device.h> //含有类相关的设备函数
#include <linux/cdev.h>
#include <linux/platform_device.h> //包含 platform 函数
#include <linux/of.h> //包含设备树相关函数
#include <linux/fb.h> //包含 frame buffer
#include <linux/spi/spi.h>
#include <linux/regmap.h>
#include <linux/gpio.h>
#include <linux/kobject.h> //包含 sysfs 文件系统对象类
#include <linux/sysfs.h> //包含 sysfs 操作文件函数
#include <linux/slab.h>
#include <linux/string.h>
#define EPD_2IN13_V2_WIDTH 122
#define EPD_2IN13_V2_HEIGHT 250
#define EPD_2IN13_V2_FULL 0
#define EPD_2IN13_V2_PART 1
#define MAX_Flash_COUNTER 10
static struct spi_device *fbspi; //保存 spi 驱动指针
static struct gpio_desc *dc_pin; //dc 引脚
static struct gpio_desc *reset_pin; //reset 引脚
static struct gpio_desc *busy_pin; //busy 引脚
u8 framebuffer[4000];
u8 flash_count;
static int epd_status = 0;
static struct kobject *epd_kobj;
static struct fb_info *myfb; //定义一个 fb_info
static struct task_struct *fb_thread; //定义一个线程刷新屏幕
const u8 IMAGE_DATA[] = {
/* 0X00,0X01,0X80,0X00,0XFA,0X00, */
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X38,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X00,0X00,0X78,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0X80,0X00,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XC0,0X03,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X01,0X00,0X00,0X00,0X00,0X01,0XFF,0XE0,0X1F,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0XC0,0X00,0X00,0X00,0X03,0XFF,0X70,0X1F,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X7E,0X00,0X00,0X00,0X03,0XFF,0X78,0X38,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X3F,0X00,0X00,0X00,0X03,0XFF,0XF8,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XC0,0X00,0X00,0X03,0XF0,0XF8,0XC1,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X00,0X03,0XF3,0XF3,0X8F,0XFE,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X01,0XF8,0X00,0X00,0X03,0XFF,0XF3,0XBF,0XFF,0XC0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X3E,0X00,0X00,0X03,0XFF,0XFA,0X7F,0XFF,0XF0,0X00,0X00,
0X00,0X0F,0X00,0X00,0X00,0X3F,0XE0,0X00,0X00,0XE7,0XFB,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X07,0X00,0X00,0X00,0X3F,0XF0,0X00,0X00,0XE7,0XFB,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X1F,0XFC,0X00,0X00,0XFF,0XFB,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X0F,0XFE,0X00,0X00,0X7F,0XFB,0XCF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X03,0XFE,0X00,0X00,0X3F,0XF9,0XCF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X01,0XFF,0X80,0X00,0X0F,0XF1,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0XFF,0XC0,0X00,0X00,0X3D,0XEF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X7F,0XE0,0X00,0X03,0XFF,0XF7,0XFF,0XC0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X3F,0XE0,0X00,0X3F,0XFF,0XFF,0XFF,0X80,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X1F,0XE0,0X00,0X7E,0XFF,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X3E,0XFF,0XF1,0XFF,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X3F,0XFF,0XBF,0XFC,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X3E,0X7F,0X3F,0XF8,0X38,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7E,0X7F,0XC0,0X00,0X7C,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7E,0X3F,0XC0,0X01,0XFE,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7F,0X1F,0XDF,0XFF,0XFF,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X7F,0X87,0XEF,0XFF,0XFF,0X80,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X7F,0XE3,0XF1,0XFF,0XFF,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X01,0X87,0XFC,0X78,0XFE,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X03,0X01,0XF8,0XFF,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X0E,0X00,0X01,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X0C,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X1C,0X00,0X0F,0X98,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X38,0X00,0X7F,0X9C,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X30,0X00,0X3F,0XDC,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X07,0XFE,0X07,0XE0,0X30,0X00,0X1F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X0F,0XFF,0X87,0XF0,0X70,0X00,0X1F,0XFC,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X1F,0XFF,0XC7,0XF0,0X00,0X00,0X0F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XFF,0XE7,0XE0,0X00,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X7F,0XFF,0XF3,0XE0,0X7F,0XFF,0XEF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0XFF,0X9F,0XFB,0XCF,0XFF,0XFF,0XC6,0X18,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X03,0XFF,0XCF,0XF9,0XDF,0XFF,0XFF,0XC0,0X08,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X0E,0XFF,0XDF,0XFD,0XFF,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X01,0XF0,0XFF,0XFF,0XFD,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X03,0XF8,0XFF,0XFF,0XFD,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X07,0XFC,0XFF,0XDF,0XFD,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0XFE,0XC7,0XDF,0XFD,0XFF,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X3E,0X7F,0XF7,0XDF,0XFF,0XFE,0X30,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X3E,0X7F,0XF7,0XDF,0XCF,0XF0,0X38,0X00,0X06,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X7E,0X7F,0XFF,0XFF,0X9F,0XE0,0X38,0X00,0X1F,0XC0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X1F,0XFF,0XFE,0X3E,0X00,0X3C,0X00,0X3B,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X8F,0XFF,0XFE,0X7C,0X00,0X3C,0X00,0X3B,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X87,0XFE,0X3F,0XF8,0X00,0X3C,0X00,0X7F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0XA1,0XF8,0X1F,0XFC,0X00,0X1C,0X00,0X7C,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X3F,0XFF,0XF0,0X0F,0XFC,0X00,0X0C,0X00,0X7E,0X7C,0X00,0X00,0X00,0X00,
0X00,0X03,0X3F,0XFF,0XF0,0X0F,0XFE,0X00,0X0C,0X00,0X7F,0X3C,0X00,0X00,0X00,0X00,
0X00,0X03,0X1F,0XFF,0XF0,0X0F,0XFF,0X00,0X0C,0X00,0X3F,0X80,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0XFF,0XF0,0X0E,0X7F,0X80,0X0C,0X00,0X3F,0XC0,0X00,0X00,0X00,0X00,
0X00,0X03,0X07,0XFF,0XF8,0X0E,0X3F,0XC0,0X0C,0X00,0X1F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X03,0XFF,0XF8,0X1E,0X1F,0XE0,0X0C,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X3F,0XFE,0X3F,0X87,0XE0,0X3C,0X00,0X0F,0XBE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X47,0XFF,0XFF,0XF0,0X60,0X3C,0X00,0X0F,0XBF,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X31,0XFF,0XFF,0XF8,0XE0,0X38,0X00,0X0F,0XBF,0X80,0X00,0X00,0X00,
0X00,0X03,0X06,0X11,0XFF,0XFD,0XFF,0XE0,0X38,0X00,0X0F,0X1F,0X80,0X00,0X00,0X00,
0X00,0X03,0X0E,0X13,0XFF,0XF9,0XFF,0XE0,0X30,0X00,0X0E,0X07,0X80,0X00,0X00,0X00,
0X00,0X03,0X3C,0XD7,0XFD,0XFD,0XFF,0XE0,0X30,0X00,0X1C,0XC7,0X80,0X00,0X00,0X00,
0X00,0X03,0X39,0XEF,0XFB,0XFF,0XFF,0XE0,0X30,0X00,0X3D,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X73,0XEF,0XFB,0XFF,0XFF,0XE0,0X60,0X00,0X3D,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X67,0XEF,0XFB,0XFF,0XFF,0XC0,0XC0,0X00,0X3F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X8F,0XF7,0XE3,0XFF,0XFF,0X80,0XE0,0X00,0X1B,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X9F,0XF3,0XE1,0XFF,0XE0,0X01,0XC0,0X00,0X3B,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X03,0X3F,0XF1,0XF9,0XFF,0XC0,0X03,0X80,0X00,0X7F,0XFF,0XE0,0X00,0X00,0X00,
0X00,0X03,0X7F,0XF1,0XFD,0XFF,0X80,0X07,0X00,0X00,0X1F,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X03,0XFF,0XF1,0XFF,0XFF,0X80,0X0F,0X00,0X00,0X3F,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X03,0XFF,0XE0,0XFF,0XFF,0X00,0X0E,0X00,0X00,0X3F,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X03,0XFF,0X80,0X0F,0XFF,0X00,0X06,0X00,0X00,0X03,0XF6,0X7C,0X00,0X00,0X00,
0X00,0X03,0XFF,0X00,0X1F,0X7C,0X00,0XF8,0X00,0X00,0X09,0XF0,0X3C,0X00,0X00,0X00,
0X00,0X03,0XFE,0X00,0X3F,0X38,0X01,0XFC,0X00,0X00,0X1C,0XF8,0X1C,0X00,0X00,0X00,
0X00,0X03,0XFC,0X00,0XFF,0X90,0X03,0XFE,0X00,0X00,0X3D,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X03,0XF8,0X00,0XFF,0XC0,0X0F,0XFF,0X00,0X00,0X73,0XFF,0XCC,0X00,0X00,0X00,
0X00,0X03,0XF0,0X00,0XFF,0XE0,0X0F,0XFF,0X00,0X00,0X61,0XFF,0XFC,0X60,0X00,0X00,
0X00,0X03,0XF0,0X01,0XFF,0XF0,0X1F,0XFF,0X00,0X00,0XC0,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X07,0XE0,0X01,0XFF,0XBF,0XFF,0XFF,0X80,0X00,0XE0,0X00,0X7F,0XF0,0X00,0X00,
0X00,0X03,0XC0,0X01,0XFF,0X3F,0XFF,0XFF,0X80,0X00,0XC0,0X00,0X3F,0XF8,0X00,0X00,
0X00,0X01,0X80,0X01,0XFE,0X7F,0XFF,0XFF,0X80,0X00,0X80,0X00,0X1F,0XFC,0X00,0X00,
0X00,0X07,0X00,0X00,0XFE,0X7F,0XFF,0XFF,0X80,0X00,0X80,0X00,0X0C,0XFC,0X00,0X00,
0X00,0X03,0X00,0X00,0XF0,0X7F,0XFF,0XFF,0X00,0X00,0X80,0X00,0X04,0X7C,0X00,0X00,
0X00,0X03,0X00,0X00,0X7E,0X3F,0XFF,0XFC,0X00,0X01,0X80,0X00,0X03,0XFC,0X00,0X00,
0X00,0X03,0X00,0X00,0X7E,0X3F,0XFF,0XFE,0X00,0X01,0X80,0X00,0X01,0XF0,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XDF,0XBF,0XFF,0X80,0X01,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XCF,0XBF,0XFF,0XC0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X7F,0XCF,0XFF,0XFF,0XE0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0XFF,0XCF,0XCF,0XFF,0XC0,0X01,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X1E,0XFF,0XEF,0XC7,0XFF,0XC0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X01,0XFC,0XFF,0XE7,0XF0,0X7F,0X80,0X03,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0X07,0XC0,0XFF,0XF3,0XF8,0XFF,0X00,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0X80,0X7F,0XF3,0XF9,0XFE,0X00,0X0E,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X1F,0X00,0X3F,0XF3,0XFB,0XFE,0X00,0X0C,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X38,0X00,0X03,0XF9,0XFB,0XF3,0XE0,0X18,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XF0,0X00,0X3C,0XF9,0XFB,0XEF,0XF0,0X30,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XC0,0X00,0X7D,0XF9,0XFB,0XCF,0XF0,0X70,0X00,0X00,0X18,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XF8,0XFB,0XCF,0XFC,0XC0,0X00,0X03,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XFC,0XFB,0XFF,0XFC,0X00,0X00,0X07,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XDE,0XFB,0XFF,0X7C,0X00,0X00,0X3F,0XFC,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XDE,0XF3,0XFF,0X3C,0X00,0X00,0X7F,0XFE,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XC2,0XF3,0XFF,0X1C,0X00,0X00,0XFF,0XFE,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFB,0XE3,0XFF,0XFF,0X3C,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XF9,0XEF,0XFF,0XFE,0X3C,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFC,0XFF,0XFF,0XF9,0XFC,0X00,0X00,0XDC,0X7F,0X00,0X00,0X00,
0X00,0X01,0X00,0X01,0XFE,0X7F,0XFF,0XE3,0XFE,0X00,0X00,0XFF,0XBF,0X00,0X00,0X00,
0X00,0X01,0X00,0X01,0XFE,0X3F,0XFF,0XC7,0XFE,0X00,0X00,0XFF,0X9F,0X00,0X00,0X00,
0X00,0X01,0X00,0X03,0XFF,0X3F,0XFF,0XCF,0XFF,0X00,0X00,0XFF,0XBF,0X00,0X00,0X00,
0X00,0X01,0X00,0XFF,0XFF,0XCF,0XFF,0XFF,0XFF,0X80,0X00,0XFF,0XFE,0X00,0X00,0X00,
0X00,0X01,0X0F,0XE0,0X7F,0XFF,0X87,0XFF,0XFF,0X80,0X00,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X1F,0X80,0X3F,0XFF,0X03,0XFF,0XCE,0X00,0X00,0XFF,0X00,0X00,0X00,0X00,
0X00,0X01,0XF0,0X00,0X0F,0XFE,0X01,0XFC,0X1E,0X00,0X00,0XF0,0X00,0X00,0X00,0X00,
0X00,0X01,0XE0,0X7F,0XC7,0XFC,0X01,0XFC,0X3E,0X00,0X00,0XC1,0XFF,0XE0,0X00,0X00,
0X00,0X01,0XC1,0XFF,0XF7,0XF8,0X01,0XFF,0XFC,0X00,0X01,0X8D,0XFF,0XF0,0X00,0X00,
0X00,0X01,0X87,0XFF,0XFB,0XFC,0X01,0XFF,0XF8,0X00,0X0F,0X1E,0XFF,0XF8,0X00,0X00,
0X00,0X01,0X3F,0X80,0X03,0XFC,0X01,0XFF,0XF0,0X00,0X0E,0X7E,0X7F,0XFE,0X00,0X00,
0X00,0X01,0XF8,0X00,0X07,0XFE,0X01,0XFF,0XE2,0X00,0X1E,0X7F,0X3F,0XFC,0X00,0X00,
0X00,0X01,0XE0,0XFF,0X9F,0XDF,0X03,0XFF,0XC6,0X60,0X1C,0XFF,0X8F,0XFE,0X00,0X00,
0X00,0X01,0X8F,0XC0,0XFF,0X3F,0XC7,0XEF,0XE3,0X78,0X3E,0X1F,0XCF,0XFF,0X00,0X00,
0X00,0X01,0XDF,0X80,0XFE,0X7F,0XEF,0XE7,0XF1,0XBC,0X7F,0X0F,0XCF,0XFF,0XC0,0X00,
0X00,0X01,0XFC,0X00,0XFD,0XFF,0XFF,0XE3,0XF1,0X9E,0X3F,0XC3,0XE7,0XFF,0X00,0X00,
0X00,0X01,0XF8,0X01,0XF1,0XF9,0XFF,0XF1,0XFD,0XCF,0X9F,0XE1,0XFF,0XFF,0X00,0X00,
0X00,0X01,0X80,0X01,0XF3,0XF1,0XFF,0XF9,0XFD,0XC1,0X9F,0XF8,0XFF,0XE0,0X00,0X00,
0X00,0X01,0X00,0X01,0XFF,0XE3,0XFD,0XFE,0XFF,0XC0,0X3F,0XF0,0X00,0X03,0X80,0X00,
0X00,0X01,0X00,0X00,0XFF,0XE3,0XFD,0XFF,0X7F,0XC0,0X7F,0XC0,0X00,0X07,0X80,0X00,
0X00,0X01,0X00,0X00,0XFF,0XE7,0XFC,0XFF,0X07,0X80,0XFF,0XCF,0XFF,0XFF,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XEF,0XCE,0X7F,0X07,0X00,0X7E,0X7F,0XFF,0XFE,0X00,0X00,
0X00,0X01,0X1F,0XFE,0XFF,0XFF,0XCE,0X7F,0X3E,0X00,0X3E,0X7F,0XFF,0XFC,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XFF,0XF1,0XCE,0X3F,0X3E,0X00,0X3F,0XFC,0X07,0XF8,0X00,0X00,
0X00,0X01,0XFF,0XFF,0X3F,0XE1,0X8E,0X3F,0X3E,0X00,0X1F,0XFC,0X07,0XF0,0X00,0X00,
0X00,0X01,0XE0,0X00,0X0E,0X03,0X8E,0X3F,0X3E,0X00,0X0F,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0X87,0XFF,0X8E,0X3F,0X1E,0X00,0X04,0XFE,0X3E,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XC7,0XFF,0X8F,0X3F,0XBE,0X00,0X00,0XFE,0X1E,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XC7,0XFF,0X8F,0X9F,0XFE,0X00,0X00,0XFC,0X3F,0X80,0X00,0X00,
0X00,0X01,0X87,0XFF,0X8F,0XFF,0X8F,0X9F,0XFE,0X00,0X00,0X79,0XFF,0XC0,0X00,0X00,
0X00,0X01,0X00,0X06,0X3F,0XFF,0X8F,0XDF,0XFE,0X00,0X00,0X7F,0XFF,0XC0,0X00,0X00,
0X00,0X01,0X00,0X00,0X7F,0XFF,0X8F,0X8F,0XFC,0X00,0X00,0X1F,0XFF,0XE0,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XFF,0X8F,0X1F,0X00,0X00,0X00,0X0F,0XFF,0XF0,0X00,0X00,
0X00,0X01,0XC0,0X01,0XFF,0XFF,0X8E,0X3F,0X81,0X00,0X00,0X01,0XFF,0XE0,0X00,0X00,
0X00,0X01,0XE0,0X01,0XFF,0XFF,0X8E,0X7F,0XC3,0X80,0X00,0X00,0XFF,0X80,0X00,0X00,
0X00,0X01,0XF8,0X00,0XFF,0XF3,0X8E,0X7F,0XE7,0XC0,0X00,0X00,0X7F,0X00,0X00,0X00,
0X00,0X01,0XFF,0X80,0XFF,0XE7,0X8F,0XFF,0XC4,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X87,0XE1,0XFF,0XDF,0X8F,0XFF,0XCE,0X1C,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XF1,0XF8,0XFF,0XFF,0X8F,0XFF,0XCF,0XCF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFE,0X1C,0XFF,0XBE,0X43,0XE0,0X1F,0XF3,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0X06,0X7F,0X3E,0X63,0XC1,0X3F,0XF1,0XE0,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0X83,0X3E,0X3C,0XF3,0X81,0X1F,0XF8,0XF0,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0XE1,0X80,0X39,0XFF,0X00,0X07,0XFE,0X78,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFE,0X60,0X1F,0XFE,0X1C,0X03,0XFF,0X1C,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X0F,0XFF,0X3C,0X1F,0XFE,0X60,0X01,0XFF,0X8E,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X01,0XFF,0X9E,0X0F,0XFF,0XC0,0X00,0X3F,0XC3,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X7F,0XC3,0X8F,0XFD,0X80,0X00,0X3F,0XE3,0X80,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X3F,0XE1,0XC7,0XFC,0X00,0X00,0X3F,0XF1,0XC0,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X1F,0XF1,0XE3,0XF8,0X00,0X00,0X07,0XF0,0X60,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X0F,0XF1,0XE1,0XF0,0X00,0X00,0X03,0XF8,0X30,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X01,0XF8,0X30,0X00,0X00,0X00,0X01,0XFC,0X3C,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XF8,0X18,0X00,0X00,0X00,0X00,0XFC,0X0E,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFC,0X0C,0X00,0X00,0X00,0X00,0XFE,0X0F,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7C,0X0C,0X00,0X00,0X00,0X00,0X7E,0X07,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7C,0X06,0X00,0X00,0X00,0X00,0X3F,0X03,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7E,0X06,0X00,0X00,0X00,0X00,0X1F,0X81,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X1E,0X03,0X00,0X00,0X00,0X00,0X0F,0X80,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X0E,0X01,0X00,0X00,0X00,0X00,0X07,0X80,0X60,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X0F,0X01,0X80,0X00,0X00,0X00,0X03,0XC0,0X30,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0X81,0XC0,0X00,0X00,0X00,0X01,0XC0,0X38,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0X81,0XC0,0X00,0X00,0X00,0X00,0XC0,0X18,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0XC0,0XE0,0X00,0X00,0X00,0X00,0X40,0X08,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0XF0,0X00,0X00,0X00,0X00,0X00,0X04,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X70,0X00,0X00,0X00,0X00,0X00,0X06,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X70,0X00,0XF8,0X00,0X00,0X00,0X02,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X30,0X00,0XFF,0XF0,0X00,0X00,0X07,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X30,0X01,0XFF,0XF8,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X30,0X01,0XFF,0XFC,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X18,0X01,0XFF,0XFE,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0XFF,0XFF,0X00,0X00,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0X67,0XFF,0X00,0X00,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0XFF,0XFF,0X00,0X00,0X00,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0X80,0X08,0X03,0XFF,0XBF,0X80,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X07,0XFF,0X3F,0X80,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0XBF,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0X3F,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XF0,0X1F,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0XCF,0XF0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XE7,0XFC,0X00,0X00,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XF3,0XFF,0XF0,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XF8,0XFF,0XF8,0X01,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X7F,0XFC,0X7F,0XFF,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X1F,0XFF,0X00,0X7F,0X83,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0X80,0X1F,0XC7,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC3,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X18,0X00,0X1F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X38,0X00,0X0F,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X78,0X00,0X03,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0XF8,0X00,0X00,0X7F,0XFF,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X01,0XF8,0X00,0X00,0X3F,0XFF,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X38,0X00,0X00,0X3F,0XFF,0XF9,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X18,0X00,0X00,0X3F,0XFF,0XF3,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X00,0X3F,0XFF,0XE7,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X00,0X3C,0XFC,0X1F,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X8C,0X00,0X00,0X7E,0X00,0X7F,0X98,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X79,0X8C,0X00,0X07,0XFF,0X0F,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0XFC,0XC6,0X00,0X0F,0XFF,0X7F,0XFF,0X78,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XF8,0X46,0X00,0X0F,0XFF,0X7F,0XFE,0X78,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XFC,0X07,0X00,0X0F,0XFF,0X7F,0XFE,0X78,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X07,0XFE,0X07,0XC0,0X0F,0XFF,0X7F,0XFE,0X60,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X07,0XF9,0XE7,0XE0,0X07,0XFF,0X7F,0XF8,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X03,0XE3,0XF3,0XF0,0X03,0XFF,0XFF,0XF1,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X7F,0XC3,0XF3,0X38,0X01,0XFF,0XFF,0XF1,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFF,0XDF,0XF3,0X1C,0X00,0X7F,0XFF,0XE3,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFF,0X9F,0XF3,0X8E,0X00,0X3F,0XFF,0XE7,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFE,0X33,0XFB,0XCF,0X00,0X1F,0XFF,0XCF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X01,0XFE,0X3F,0XF1,0XCF,0X00,0X0F,0XFF,0XCF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X0C,0X7F,0XCD,0XE3,0X80,0X0F,0XFF,0XDF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X01,0X01,0XFC,0X8E,0X7F,0X80,0X0F,0XFF,0X9F,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XF9,0XFC,0X1E,0X3F,0X80,0X0F,0XF3,0XBF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFD,0XFC,0X3E,0X3F,0X80,0X0F,0XE1,0XBF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFC,0XFC,0X3F,0X3F,0X80,0X0F,0XC1,0X3F,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XE5,0XF8,0X3B,0X9F,0X80,0X0F,0XC2,0X3F,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XCF,0XF0,0X33,0XDF,0XC0,0X03,0X9C,0X0F,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X0E,0X00,0X39,0XD9,0XC0,0X00,0X38,0X63,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFE,0X00,0X0F,0XEE,0XF0,0X00,0XFF,0XF3,0XF0,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XFE,0X00,0X07,0XEE,0X78,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFE,0X00,0X07,0XEE,0X3C,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFE,0X00,0X07,0XEF,0X3C,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0X7C,0X00,0X00,0XEF,0XFC,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1E,0X1C,0X00,0X00,0X6F,0XFC,0X01,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X33,0XFE,0X00,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0X00,0XFF,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X3F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X1F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFC,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFE,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7E,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X78,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X30,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
};
//================================================================================================
const unsigned char EPD_2IN13_V2_lut_full_update[]= {
0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT0: BB: VS 0 ~7
0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT1: BW: VS 0 ~7
0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT2: WB: VS 0 ~7
0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT3: WW: VS 0 ~7
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT4: VCOM: VS 0 ~7
0x03,0x03,0x00,0x00,0x02, // TP0 A~D RP0
0x09,0x09,0x00,0x00,0x02, // TP1 A~D RP1
0x03,0x03,0x00,0x00,0x02, // TP2 A~D RP2
0x00,0x00,0x00,0x00,0x00, // TP3 A~D RP3
0x00,0x00,0x00,0x00,0x00, // TP4 A~D RP4
0x00,0x00,0x00,0x00,0x00, // TP5 A~D RP5
0x00,0x00,0x00,0x00,0x00, // TP6 A~D RP6
0x15,0x41,0xA8,0x32,0x30,0x0A,
};
const unsigned char EPD_2IN13_V2_lut_partial_update[]= { //20 bytes
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT0: BB: VS 0 ~7
0x80,0x00,0x00,0x00,0x00,0x00,0x00, //LUT1: BW: VS 0 ~7
0x40,0x00,0x00,0x00,0x00,0x00,0x00, //LUT2: WB: VS 0 ~7
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT3: WW: VS 0 ~7
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT4: VCOM: VS 0 ~7
0x0A,0x00,0x00,0x00,0x00, // TP0 A~D RP0
0x00,0x00,0x00,0x00,0x00, // TP1 A~D RP1
0x00,0x00,0x00,0x00,0x00, // TP2 A~D RP2
0x00,0x00,0x00,0x00,0x00, // TP3 A~D RP3
0x00,0x00,0x00,0x00,0x00, // TP4 A~D RP4
0x00,0x00,0x00,0x00,0x00, // TP5 A~D RP5
0x00,0x00,0x00,0x00,0x00, // TP6 A~D RP6
0x15,0x41,0xA8,0x32,0x30,0x0A,
};
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2IN13_V2_Reset(void)
{
gpiod_set_value(reset_pin, 1);
msleep(200);
gpiod_set_value(reset_pin, 0);
msleep(2);
gpiod_set_value(reset_pin, 1);
msleep(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2IN13_V2_SendCommand(u8 Reg)
{
gpiod_set_value(dc_pin, 0);
spi_write(fbspi, &Reg, 1);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_2IN13_V2_SendData(u8 Data)
{
gpiod_set_value(dc_pin, 1);
spi_write(fbspi, &Data, 1);
}
/******************************************************************************
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void EPD_2IN13_V2_ReadBusy(void)
{
while(gpiod_get_value(busy_pin) == 1) { //LOW: idle, HIGH: busy
msleep(10);
}
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN13_V2_TurnOnDisplay(void)
{
EPD_2IN13_V2_SendCommand(0x22);
EPD_2IN13_V2_SendData(0xC7);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_ReadBusy();
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN13_V2_TurnOnDisplayPart(void)
{
EPD_2IN13_V2_SendCommand(0x22);
EPD_2IN13_V2_SendData(0x0C);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_ReadBusy();
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2IN13_V2_Init(u8 Mode)
{
u8 count;
EPD_2IN13_V2_Reset();
if(Mode == EPD_2IN13_V2_FULL) {
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x12); // soft reset
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x74); //set analog block control
EPD_2IN13_V2_SendData(0x54);
EPD_2IN13_V2_SendCommand(0x7E); //set digital block control
EPD_2IN13_V2_SendData(0x3B);
EPD_2IN13_V2_SendCommand(0x01); //Driver output control
EPD_2IN13_V2_SendData(0xF9);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x11); //data entry mode
EPD_2IN13_V2_SendData(0x01);
EPD_2IN13_V2_SendCommand(0x44); //set Ram-X address start/end position
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x0F); //0x0C-->(15+1)*8=128
EPD_2IN13_V2_SendCommand(0x45); //set Ram-Y address start/end position
EPD_2IN13_V2_SendData(0xF9); //0xF9-->(249+1)=250
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x3C); //BorderWavefrom
EPD_2IN13_V2_SendData(0x03);
EPD_2IN13_V2_SendCommand(0x2C); //VCOM Voltage
EPD_2IN13_V2_SendData(0x55); //
EPD_2IN13_V2_SendCommand(0x03);
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[70]);
EPD_2IN13_V2_SendCommand(0x04); //
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[71]);
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[72]);
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[73]);
EPD_2IN13_V2_SendCommand(0x3A); //Dummy Line
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[74]);
EPD_2IN13_V2_SendCommand(0x3B); //Gate time
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[75]);
EPD_2IN13_V2_SendCommand(0x32);
for(count = 0; count < 70; count++) {
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[count]);
}
EPD_2IN13_V2_SendCommand(0x4E); // set RAM x address count to 0;
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x4F); // set RAM y address count to 0X127;
EPD_2IN13_V2_SendData(0xF9);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_ReadBusy();
} else if(Mode == EPD_2IN13_V2_PART) {
EPD_2IN13_V2_SendCommand(0x2C); //VCOM Voltage
EPD_2IN13_V2_SendData(0x26);
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x32);
for(count = 0; count < 70; count++) {
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_partial_update[count]);
}
EPD_2IN13_V2_SendCommand(0x37);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x40);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x22);
EPD_2IN13_V2_SendData(0xC0);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x3C); //BorderWavefrom
EPD_2IN13_V2_SendData(0x01);
} else {
printk(KERN_ERR"error, the Mode is EPD_2IN13_FULL or EPD_2IN13_PART\n");
}
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_2IN13_V2_Clear(void)
{
u16 Width, Height;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
printk(KERN_ERR"clear\n");
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
EPD_2IN13_V2_SendData(0XFF);
}
}
printk(KERN_ERR"\n");
EPD_2IN13_V2_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_2IN13_V2_Display(u8 *Image)
{
u16 Width, Height;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
EPD_2IN13_V2_SendData(Image[i + j * Width]);
}
}
EPD_2IN13_V2_TurnOnDisplay();
}
/******************************************************************************
function : The image of the previous frame must be uploaded, otherwise the
first few seconds will display an exception.
parameter:
******************************************************************************/
void EPD_2IN13_V2_DisplayPartBaseImage(u8 *Image)
{
u16 Width, Height;
u32 Addr;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
Addr = 0;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
Addr = i + j * Width;
EPD_2IN13_V2_SendData(Image[Addr]);
}
}
EPD_2IN13_V2_SendCommand(0x26);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
Addr = i + j * Width;
EPD_2IN13_V2_SendData(Image[Addr]);
}
}
EPD_2IN13_V2_TurnOnDisplay();
}
/******************************************************************************
function : Partly display (No Flash)
parameter:
******************************************************************************/
void EPD_2IN13_V2_DisplayPart(u8 *Image)
{
u16 Width, Height;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
EPD_2IN13_V2_SendData(Image[i + j * Width]);
}
}
EPD_2IN13_V2_TurnOnDisplayPart();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2IN13_V2_Sleep(void)
{
EPD_2IN13_V2_SendCommand(0x22); //POWER OFF
EPD_2IN13_V2_SendData(0xC3);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_SendCommand(0x10); //enter deep sleep
EPD_2IN13_V2_SendData(0x01);
msleep(100);
}
void EPD_2IN13_V2_ClearPart(void)
{
int w, h;
int i, j;
w = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
h = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
EPD_2IN13_V2_SendData(0xff);
}
}
EPD_2IN13_V2_TurnOnDisplayPart();
}
void EPD_2IN13_V2_Int_Frambuffer(void)
{
int w, h;
int i, j;
flash_count = 0;
w = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
h = EPD_2IN13_V2_HEIGHT;
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
framebuffer[i + j * w] = 0xff;
}
}
}
// pix=1, write position balck; pix=0, wirete white.
void Write_Pix(u16 x, u16 y, u8 pix){
if(x > EPD_2IN13_V2_WIDTH || y > EPD_2IN13_V2_HEIGHT){
printk(KERN_INFO "Out screen\n");
return ;
}
int position;
position = (y * 128 + x) / 8;
framebuffer[position] &= ~(1 << (x % 8));
framebuffer[position] |= ~(pix << (x % 8));
}
void Update_to_Epd(void){
if(flash_count < MAX_Flash_COUNTER){
flash_count++;
EPD_2IN13_V2_Init(EPD_2IN13_V2_PART);
EPD_2IN13_V2_DisplayPart(framebuffer);
EPD_2IN13_V2_Sleep();
}
else{
flash_count = 0;
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
EPD_2IN13_V2_Display(framebuffer);
EPD_2IN13_V2_DisplayPartBaseImage(framebuffer);
EPD_2IN13_V2_Sleep();
}
}
static ssize_t epd_show(struct kobject* kobjs,struct kobj_attribute *attr,char *buf)
{
printk(KERN_INFO "Read epd\n");
return sprintf(buf, "buf is\n");
}
static ssize_t epd_store(struct kobject *kobj, struct kobj_attribute *attr,const char *buf, size_t count)
{
printk(KERN_INFO "write epd\n");
int num,x,y,pix;
num = sscanf(buf, "%d %d %d", &x, &y, &pix);
if(num < 3){
printk(KERN_INFO "too less agument");
return count;
}
else{
printk("write %d %d %d %d\n", x , y, pix, flash_count);
Write_Pix(x , y, pix);
Update_to_Epd();
}
}
static struct kobj_attribute epd_attr = __ATTR(epd_status,0660,epd_show,epd_store);
//================================================================================================
int thread_func_fb(void *data)
{
struct fb_info *fbi = (struct fb_info *)data;
while (1)
{
if (kthread_should_stop())
break;
msleep(1);
Update_to_Epd();
}
return 0;
}
static struct fb_ops myfb_ops = {
.owner = THIS_MODULE,
.fb_write = fb_sys_write,
.fb_fillrect = sys_fillrect, /*用像素行填充矩形框,通用库函数*/
.fb_copyarea = sys_copyarea, /*将屏幕的一个矩形区域复制到另一个区域,通用库函数*/
.fb_imageblit = sys_imageblit, /*显示一副图像,通用库函数*/
};
static void myfb_update(struct fb_info *fbi, struct list_head *pagelist)
{
//比较粗暴的方式,直接全部刷新
fbi->fbops->fb_pan_display(&fbi->var,fbi); //将应用层数据刷到 FrameBuffer 缓存中
}
static struct fb_deferred_io myfb_defio = {
.delay = HZ/1,
.deferred_io = &myfb_update,
};
static struct fb_var_screeninfo myfb_var = {
.rotate = 0,
.xres = 250,
.yres = 122,
.xres_virtual = 256,
.yres_virtual = 128,
.bits_per_pixel = 1,
.nonstd = 1,
.grayscale = 1,
.transp.offset = 0,
.transp.length = 0,
.activate = FB_ACTIVATE_NOW,
.vmode = FB_VMODE_NONINTERLACED,
};
static struct fb_fix_screeninfo myfb_fix = {
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_MONO10,
.line_length = 32, //16 bit = 2byte
.accel = FB_ACCEL_NONE,//没有使用硬件加速
.id = "myfb",
};
//------------------------------------------------------------------------------------------------
static int myfb_probe(struct spi_device *spi)
{
int i;
int ret;
void *gmem_addr;
u32 gmem_size;
epd_kobj = kobject_create_and_add("sys_epd",NULL);
if(epd_kobj == NULL)
{
printk(KERN_INFO"create led_kobj failed!\n");
return -1;
}
ret = sysfs_create_file(epd_kobj, &epd_attr.attr);
if(ret != 0)
{
printk(KERN_INFO"create sysfa file failed!\n");
return -1;
}
fbspi = spi; //保存 spi 驱动指针
printk(KERN_ERR"register myfb_spi_probe!\n");
//申请 GPIO 用作 DC 引脚
dc_pin = devm_gpiod_get(&spi->dev,"dc",GPIOF_OUT_INIT_LOW);
if(IS_ERR(dc_pin))
{
printk(KERN_ERR"fail to request dc-gpios!\n");
return -1;
}
// 申请 GPIO 用作 RESET 引脚
reset_pin = devm_gpiod_get(&spi->dev,"reset",GPIOF_OUT_INIT_HIGH);
if(IS_ERR(reset_pin))
{
printk(KERN_ERR"fail to request reset-gpios!\n");
return -1;
}
// 申请 GPIO 用作 RESET 引脚
busy_pin = devm_gpiod_get(&spi->dev,"busy",GPIOF_OUT_INIT_HIGH);
if(IS_ERR(reset_pin))
{
printk(KERN_ERR"fail to request reset-gpios!\n");
return -1;
}
gpiod_direction_output(dc_pin,0);//设置输出方向
gpiod_direction_output(reset_pin,1);//设置输出方向
gpiod_direction_input(busy_pin);
EPD_2IN13_V2_Int_Frambuffer();
//---------------------------------------------------------------------------------
myfb = framebuffer_alloc(sizeof(struct fb_info), &spi->dev);//向内核申请 fb_info 结构体
//初始化底层操作结构体
myfb->fbops = &myfb_ops; //指定底层操作结构体
gmem_size = 256 * 128 / 8; //设置显存大小,16bit 占 2 字节
gmem_addr = kmalloc(gmem_size,GFP_KERNEL); //分配 Frame Buffer 显存
if(!gmem_addr)
{
printk(KERN_ERR"fail to alloc fb buffer!\n");
}
myfb->var = myfb_var; //设置分辨率参数
myfb->fix = myfb_fix; //设置显示参数
myfb->screen_buffer = gmem_addr;//设置显存地址
myfb->screen_size = gmem_size;//设置显存大小
myfb->fix.smem_len = gmem_size;//设置应用层显存大小
myfb->fix.smem_start = (u32)framebuffer;//设置应用层数据地址
memset((void *)myfb->fix.smem_start, 0, myfb->fix.smem_len); //清楚数据缓存
myfb->fbdefio = &myfb_defio; //设置刷新参数
fb_deferred_io_init(myfb); //初始化刷新机制
ret = register_framebuffer(myfb); //注册 fb 驱动
if(ret)
{
framebuffer_release(myfb);
unregister_framebuffer(myfb);
devm_gpiod_put(&spi->dev, dc_pin);
devm_gpiod_put(&spi->dev, reset_pin);
printk(KERN_ERR"fail to register fb dev!\n");
return -1;
}
fb_thread = kthread_run(thread_func_fb, myfb, spi->modalias);
//==========================Test code==============================================
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
EPD_2IN13_V2_Clear();
EPD_2IN13_V2_Sleep();
return 0;
}
int myfb_remove(struct spi_device *spi)
{
devm_gpiod_put(&spi->dev, dc_pin);
devm_gpiod_put(&spi->dev, reset_pin);
devm_gpiod_put(&spi->dev, busy_pin);
sysfs_remove_file(epd_kobj,&epd_attr.attr); //删除属性
kobject_put(epd_kobj); //删除对象
fb_deferred_io_cleanup(myfb); //清除刷新机制
unregister_framebuffer(myfb);
printk(KERN_INFO "exit sysfs epd!\n");
return 0;
}
struct of_device_id myfb_match[] = {
{.compatible = "test,myfb-spi"},
{},
};
struct spi_driver myfb_drv = {
.probe = myfb_probe,
.remove = myfb_remove,
.driver = {
.owner = THIS_MODULE,
.name = "myfb_spi_driver",
.of_match_table = myfb_match,
},
};
最近编辑记录 你在卖萌吗 (2023-03-23 19:40:41)
离线
蠢b了,不知道为啥发帖无响应多点了几下,发了好几个一样的,真真不好意思
离线
用linux的framebuffer架构吗?
离线
用linux的framebuffer架构吗?
是的,我发现是内存映射错了,现在是将刷新的内存改为显存,能刷新出来的东西,但是显示的是看不懂的东西
最近编辑记录 你在卖萌吗 (2023-03-23 22:23:04)
离线
可以多提供一点信息分析分析,比如用什么接口,用什么驱动芯片。
离线
用的SPI接口,屏幕型号是微雪的2.13英寸的水墨屏,SPI和屏幕都驱动起来了,画点也是可以的,应该是fb的参数设置错误了。
遇到的问题是往/dev/fb0 写东西,屏幕出来的东西是小黑块显示不了字符:)
离线
用一块缓冲区,应用程序更新缓冲区,有变更的时候再刷新墨水屏。
离线
用一块缓冲区,应用程序更新缓冲区,有变更的时候再刷新墨水屏。
我主要是想把终端给弄上去所以才弄的fb设备,但是不知道什么原因我加载好驱动,fb设备也有了,屏幕也能自动刷新了,但是我echo hello>>tty0 设备上屏幕没有出现字,可能是设置有问题。
离线
先把能用的部分代码贴出来吧,有需要的可以拿去玩玩,屏幕的型号是微雪的2.13寸的墨水屏V2版,用其他的屏幕只要改改驱动里的framebuffer大小和初始化屏幕的指令就行。用的是V3s的SPI,设备树如下:
&spi0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
myfb@0 {
compatible = "test,myfb-spi";
reg = <0>;
spi-max-frequency = <20000000>; /* 20MHz */
//spi-cpol; //使用模式 3
//spi-cpha;
buswidth = <8>; //数据宽度 8 位
dc-gpios = <&pio 1 0 GPIO_ACTIVE_HIGH>; /* GPIOB0 */
reset-gpios = <&pio 1 1 GPIO_ACTIVE_HIGH>; /* GPIOB1 */
busy-gpio = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* GPIOB4 */
};
};
注意用的时候注释一下,PWM相关口,不然编译会报错。
驱动载入后会在/sys/目录下生成一个sys_epd的类,通过这个接口就可以进行写点了,格式如下:echo 10 1 1 >> epd_status(在10,1的位置上画黑点上画黑点 最后一位1是代表写黑点,0代表写白点,前两位代表x和y)。
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/fb.h>
#include <linux/spi/spi.h>
#include <linux/regmap.h>
#include <linux/gpio.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
#include <linux/string.h>
#define EPD_2IN13_V2_WIDTH 122
#define EPD_2IN13_V2_HEIGHT 250
#define EPD_2IN13_V2_FULL 0
#define EPD_2IN13_V2_PART 1
#define MAX_Flash_COUNTER 10
static struct spi_device *fbspi;
static struct gpio_desc *dc_pin;
static struct gpio_desc *reset_pin;
static struct gpio_desc *busy_pin;
u8 framebuffer[4000];
u8 flash_count;
static int epd_status = 0;
static struct kobject *epd_kobj;
const u8 IMAGE_DATA[] = {
/* 0X00,0X01,0X80,0X00,0XFA,0X00, */
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X38,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X00,0X00,0X78,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X1F,0X80,0X00,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XC0,0X03,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X01,0X00,0X00,0X00,0X00,0X01,0XFF,0XE0,0X1F,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0XC0,0X00,0X00,0X00,0X03,0XFF,0X70,0X1F,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X7E,0X00,0X00,0X00,0X03,0XFF,0X78,0X38,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X3F,0X00,0X00,0X00,0X03,0XFF,0XF8,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XC0,0X00,0X00,0X03,0XF0,0XF8,0XC1,0XF8,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X00,0X03,0XF3,0XF3,0X8F,0XFE,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X01,0XF8,0X00,0X00,0X03,0XFF,0XF3,0XBF,0XFF,0XC0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X3E,0X00,0X00,0X03,0XFF,0XFA,0X7F,0XFF,0XF0,0X00,0X00,
0X00,0X0F,0X00,0X00,0X00,0X3F,0XE0,0X00,0X00,0XE7,0XFB,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X07,0X00,0X00,0X00,0X3F,0XF0,0X00,0X00,0XE7,0XFB,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X1F,0XFC,0X00,0X00,0XFF,0XFB,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X0F,0XFE,0X00,0X00,0X7F,0XFB,0XCF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X03,0XFE,0X00,0X00,0X3F,0XF9,0XCF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X01,0XFF,0X80,0X00,0X0F,0XF1,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0XFF,0XC0,0X00,0X00,0X3D,0XEF,0XFF,0XE0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X7F,0XE0,0X00,0X03,0XFF,0XF7,0XFF,0XC0,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X3F,0XE0,0X00,0X3F,0XFF,0XFF,0XFF,0X80,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X1F,0XE0,0X00,0X7E,0XFF,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X3E,0XFF,0XF1,0XFF,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X0F,0XE0,0X00,0X3F,0XFF,0XBF,0XFC,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X3E,0X7F,0X3F,0XF8,0X38,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7E,0X7F,0XC0,0X00,0X7C,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7E,0X3F,0XC0,0X01,0XFE,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X07,0XF0,0X00,0X7F,0X1F,0XDF,0XFF,0XFF,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X7F,0X87,0XEF,0XFF,0XFF,0X80,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X00,0X7F,0XE3,0XF1,0XFF,0XFF,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X01,0X87,0XFC,0X78,0XFE,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X03,0X01,0XF8,0XFF,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X0E,0X00,0X01,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X0C,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X1C,0X00,0X0F,0X98,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X38,0X00,0X7F,0X9C,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X00,0X00,0X03,0XF0,0X30,0X00,0X3F,0XDC,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X07,0XFE,0X07,0XE0,0X30,0X00,0X1F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X0F,0XFF,0X87,0XF0,0X70,0X00,0X1F,0XFC,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X1F,0XFF,0XC7,0XF0,0X00,0X00,0X0F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XFF,0XE7,0XE0,0X00,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X7F,0XFF,0XF3,0XE0,0X7F,0XFF,0XEF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0XFF,0X9F,0XFB,0XCF,0XFF,0XFF,0XC6,0X18,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X03,0XFF,0XCF,0XF9,0XDF,0XFF,0XFF,0XC0,0X08,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X0E,0XFF,0XDF,0XFD,0XFF,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X01,0XF0,0XFF,0XFF,0XFD,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X03,0XF8,0XFF,0XFF,0XFD,0XFF,0XFC,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X07,0XFC,0XFF,0XDF,0XFD,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0XFE,0XC7,0XDF,0XFD,0XFF,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X3E,0X7F,0XF7,0XDF,0XFF,0XFE,0X30,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X3E,0X7F,0XF7,0XDF,0XCF,0XF0,0X38,0X00,0X06,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X7E,0X7F,0XFF,0XFF,0X9F,0XE0,0X38,0X00,0X1F,0XC0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X1F,0XFF,0XFE,0X3E,0X00,0X3C,0X00,0X3B,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X8F,0XFF,0XFE,0X7C,0X00,0X3C,0X00,0X3B,0XE0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0X87,0XFE,0X3F,0XF8,0X00,0X3C,0X00,0X7F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X7F,0XA1,0XF8,0X1F,0XFC,0X00,0X1C,0X00,0X7C,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X3F,0XFF,0XF0,0X0F,0XFC,0X00,0X0C,0X00,0X7E,0X7C,0X00,0X00,0X00,0X00,
0X00,0X03,0X3F,0XFF,0XF0,0X0F,0XFE,0X00,0X0C,0X00,0X7F,0X3C,0X00,0X00,0X00,0X00,
0X00,0X03,0X1F,0XFF,0XF0,0X0F,0XFF,0X00,0X0C,0X00,0X3F,0X80,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0XFF,0XF0,0X0E,0X7F,0X80,0X0C,0X00,0X3F,0XC0,0X00,0X00,0X00,0X00,
0X00,0X03,0X07,0XFF,0XF8,0X0E,0X3F,0XC0,0X0C,0X00,0X1F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X03,0XFF,0XF8,0X1E,0X1F,0XE0,0X0C,0X00,0X0F,0XF0,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X3F,0XFE,0X3F,0X87,0XE0,0X3C,0X00,0X0F,0XBE,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X47,0XFF,0XFF,0XF0,0X60,0X3C,0X00,0X0F,0XBF,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X31,0XFF,0XFF,0XF8,0XE0,0X38,0X00,0X0F,0XBF,0X80,0X00,0X00,0X00,
0X00,0X03,0X06,0X11,0XFF,0XFD,0XFF,0XE0,0X38,0X00,0X0F,0X1F,0X80,0X00,0X00,0X00,
0X00,0X03,0X0E,0X13,0XFF,0XF9,0XFF,0XE0,0X30,0X00,0X0E,0X07,0X80,0X00,0X00,0X00,
0X00,0X03,0X3C,0XD7,0XFD,0XFD,0XFF,0XE0,0X30,0X00,0X1C,0XC7,0X80,0X00,0X00,0X00,
0X00,0X03,0X39,0XEF,0XFB,0XFF,0XFF,0XE0,0X30,0X00,0X3D,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X73,0XEF,0XFB,0XFF,0XFF,0XE0,0X60,0X00,0X3D,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X67,0XEF,0XFB,0XFF,0XFF,0XC0,0XC0,0X00,0X3F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X8F,0XF7,0XE3,0XFF,0XFF,0X80,0XE0,0X00,0X1B,0XFF,0X80,0X00,0X00,0X00,
0X00,0X03,0X9F,0XF3,0XE1,0XFF,0XE0,0X01,0XC0,0X00,0X3B,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X03,0X3F,0XF1,0XF9,0XFF,0XC0,0X03,0X80,0X00,0X7F,0XFF,0XE0,0X00,0X00,0X00,
0X00,0X03,0X7F,0XF1,0XFD,0XFF,0X80,0X07,0X00,0X00,0X1F,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X03,0XFF,0XF1,0XFF,0XFF,0X80,0X0F,0X00,0X00,0X3F,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X03,0XFF,0XE0,0XFF,0XFF,0X00,0X0E,0X00,0X00,0X3F,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X03,0XFF,0X80,0X0F,0XFF,0X00,0X06,0X00,0X00,0X03,0XF6,0X7C,0X00,0X00,0X00,
0X00,0X03,0XFF,0X00,0X1F,0X7C,0X00,0XF8,0X00,0X00,0X09,0XF0,0X3C,0X00,0X00,0X00,
0X00,0X03,0XFE,0X00,0X3F,0X38,0X01,0XFC,0X00,0X00,0X1C,0XF8,0X1C,0X00,0X00,0X00,
0X00,0X03,0XFC,0X00,0XFF,0X90,0X03,0XFE,0X00,0X00,0X3D,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X03,0XF8,0X00,0XFF,0XC0,0X0F,0XFF,0X00,0X00,0X73,0XFF,0XCC,0X00,0X00,0X00,
0X00,0X03,0XF0,0X00,0XFF,0XE0,0X0F,0XFF,0X00,0X00,0X61,0XFF,0XFC,0X60,0X00,0X00,
0X00,0X03,0XF0,0X01,0XFF,0XF0,0X1F,0XFF,0X00,0X00,0XC0,0XFF,0XFF,0XF0,0X00,0X00,
0X00,0X07,0XE0,0X01,0XFF,0XBF,0XFF,0XFF,0X80,0X00,0XE0,0X00,0X7F,0XF0,0X00,0X00,
0X00,0X03,0XC0,0X01,0XFF,0X3F,0XFF,0XFF,0X80,0X00,0XC0,0X00,0X3F,0XF8,0X00,0X00,
0X00,0X01,0X80,0X01,0XFE,0X7F,0XFF,0XFF,0X80,0X00,0X80,0X00,0X1F,0XFC,0X00,0X00,
0X00,0X07,0X00,0X00,0XFE,0X7F,0XFF,0XFF,0X80,0X00,0X80,0X00,0X0C,0XFC,0X00,0X00,
0X00,0X03,0X00,0X00,0XF0,0X7F,0XFF,0XFF,0X00,0X00,0X80,0X00,0X04,0X7C,0X00,0X00,
0X00,0X03,0X00,0X00,0X7E,0X3F,0XFF,0XFC,0X00,0X01,0X80,0X00,0X03,0XFC,0X00,0X00,
0X00,0X03,0X00,0X00,0X7E,0X3F,0XFF,0XFE,0X00,0X01,0X80,0X00,0X01,0XF0,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XDF,0XBF,0XFF,0X80,0X01,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X3F,0XCF,0XBF,0XFF,0XC0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0X7F,0XCF,0XFF,0XFF,0XE0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X00,0XFF,0XCF,0XCF,0XFF,0XC0,0X01,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X00,0X1E,0XFF,0XEF,0XC7,0XFF,0XC0,0X01,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X01,0XFC,0XFF,0XE7,0XF0,0X7F,0X80,0X03,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X07,0X07,0XC0,0XFF,0XF3,0XF8,0XFF,0X00,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X03,0X0F,0X80,0X7F,0XF3,0XF9,0XFE,0X00,0X0E,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X1F,0X00,0X3F,0XF3,0XFB,0XFE,0X00,0X0C,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X38,0X00,0X03,0XF9,0XFB,0XF3,0XE0,0X18,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XF0,0X00,0X3C,0XF9,0XFB,0XEF,0XF0,0X30,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XC0,0X00,0X7D,0XF9,0XFB,0XCF,0XF0,0X70,0X00,0X00,0X18,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XF8,0XFB,0XCF,0XFC,0XC0,0X00,0X03,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XFC,0XFB,0XFF,0XFC,0X00,0X00,0X07,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XDE,0XFB,0XFF,0X7C,0X00,0X00,0X3F,0XFC,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XDE,0XF3,0XFF,0X3C,0X00,0X00,0X7F,0XFE,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XC2,0XF3,0XFF,0X1C,0X00,0X00,0XFF,0XFE,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFB,0XE3,0XFF,0XFF,0X3C,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XF9,0XEF,0XFF,0XFE,0X3C,0X00,0X00,0XFF,0XFF,0X00,0X00,0X00,
0X00,0X01,0X00,0X00,0XFC,0XFF,0XFF,0XF9,0XFC,0X00,0X00,0XDC,0X7F,0X00,0X00,0X00,
0X00,0X01,0X00,0X01,0XFE,0X7F,0XFF,0XE3,0XFE,0X00,0X00,0XFF,0XBF,0X00,0X00,0X00,
0X00,0X01,0X00,0X01,0XFE,0X3F,0XFF,0XC7,0XFE,0X00,0X00,0XFF,0X9F,0X00,0X00,0X00,
0X00,0X01,0X00,0X03,0XFF,0X3F,0XFF,0XCF,0XFF,0X00,0X00,0XFF,0XBF,0X00,0X00,0X00,
0X00,0X01,0X00,0XFF,0XFF,0XCF,0XFF,0XFF,0XFF,0X80,0X00,0XFF,0XFE,0X00,0X00,0X00,
0X00,0X01,0X0F,0XE0,0X7F,0XFF,0X87,0XFF,0XFF,0X80,0X00,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X1F,0X80,0X3F,0XFF,0X03,0XFF,0XCE,0X00,0X00,0XFF,0X00,0X00,0X00,0X00,
0X00,0X01,0XF0,0X00,0X0F,0XFE,0X01,0XFC,0X1E,0X00,0X00,0XF0,0X00,0X00,0X00,0X00,
0X00,0X01,0XE0,0X7F,0XC7,0XFC,0X01,0XFC,0X3E,0X00,0X00,0XC1,0XFF,0XE0,0X00,0X00,
0X00,0X01,0XC1,0XFF,0XF7,0XF8,0X01,0XFF,0XFC,0X00,0X01,0X8D,0XFF,0XF0,0X00,0X00,
0X00,0X01,0X87,0XFF,0XFB,0XFC,0X01,0XFF,0XF8,0X00,0X0F,0X1E,0XFF,0XF8,0X00,0X00,
0X00,0X01,0X3F,0X80,0X03,0XFC,0X01,0XFF,0XF0,0X00,0X0E,0X7E,0X7F,0XFE,0X00,0X00,
0X00,0X01,0XF8,0X00,0X07,0XFE,0X01,0XFF,0XE2,0X00,0X1E,0X7F,0X3F,0XFC,0X00,0X00,
0X00,0X01,0XE0,0XFF,0X9F,0XDF,0X03,0XFF,0XC6,0X60,0X1C,0XFF,0X8F,0XFE,0X00,0X00,
0X00,0X01,0X8F,0XC0,0XFF,0X3F,0XC7,0XEF,0XE3,0X78,0X3E,0X1F,0XCF,0XFF,0X00,0X00,
0X00,0X01,0XDF,0X80,0XFE,0X7F,0XEF,0XE7,0XF1,0XBC,0X7F,0X0F,0XCF,0XFF,0XC0,0X00,
0X00,0X01,0XFC,0X00,0XFD,0XFF,0XFF,0XE3,0XF1,0X9E,0X3F,0XC3,0XE7,0XFF,0X00,0X00,
0X00,0X01,0XF8,0X01,0XF1,0XF9,0XFF,0XF1,0XFD,0XCF,0X9F,0XE1,0XFF,0XFF,0X00,0X00,
0X00,0X01,0X80,0X01,0XF3,0XF1,0XFF,0XF9,0XFD,0XC1,0X9F,0XF8,0XFF,0XE0,0X00,0X00,
0X00,0X01,0X00,0X01,0XFF,0XE3,0XFD,0XFE,0XFF,0XC0,0X3F,0XF0,0X00,0X03,0X80,0X00,
0X00,0X01,0X00,0X00,0XFF,0XE3,0XFD,0XFF,0X7F,0XC0,0X7F,0XC0,0X00,0X07,0X80,0X00,
0X00,0X01,0X00,0X00,0XFF,0XE7,0XFC,0XFF,0X07,0X80,0XFF,0XCF,0XFF,0XFF,0X00,0X00,
0X00,0X01,0X00,0X00,0XFF,0XEF,0XCE,0X7F,0X07,0X00,0X7E,0X7F,0XFF,0XFE,0X00,0X00,
0X00,0X01,0X1F,0XFE,0XFF,0XFF,0XCE,0X7F,0X3E,0X00,0X3E,0X7F,0XFF,0XFC,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XFF,0XF1,0XCE,0X3F,0X3E,0X00,0X3F,0XFC,0X07,0XF8,0X00,0X00,
0X00,0X01,0XFF,0XFF,0X3F,0XE1,0X8E,0X3F,0X3E,0X00,0X1F,0XFC,0X07,0XF0,0X00,0X00,
0X00,0X01,0XE0,0X00,0X0E,0X03,0X8E,0X3F,0X3E,0X00,0X0F,0XFF,0XF8,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0X87,0XFF,0X8E,0X3F,0X1E,0X00,0X04,0XFE,0X3E,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XC7,0XFF,0X8F,0X3F,0XBE,0X00,0X00,0XFE,0X1E,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFF,0XC7,0XFF,0X8F,0X9F,0XFE,0X00,0X00,0XFC,0X3F,0X80,0X00,0X00,
0X00,0X01,0X87,0XFF,0X8F,0XFF,0X8F,0X9F,0XFE,0X00,0X00,0X79,0XFF,0XC0,0X00,0X00,
0X00,0X01,0X00,0X06,0X3F,0XFF,0X8F,0XDF,0XFE,0X00,0X00,0X7F,0XFF,0XC0,0X00,0X00,
0X00,0X01,0X00,0X00,0X7F,0XFF,0X8F,0X8F,0XFC,0X00,0X00,0X1F,0XFF,0XE0,0X00,0X00,
0X00,0X01,0X80,0X00,0XFF,0XFF,0X8F,0X1F,0X00,0X00,0X00,0X0F,0XFF,0XF0,0X00,0X00,
0X00,0X01,0XC0,0X01,0XFF,0XFF,0X8E,0X3F,0X81,0X00,0X00,0X01,0XFF,0XE0,0X00,0X00,
0X00,0X01,0XE0,0X01,0XFF,0XFF,0X8E,0X7F,0XC3,0X80,0X00,0X00,0XFF,0X80,0X00,0X00,
0X00,0X01,0XF8,0X00,0XFF,0XF3,0X8E,0X7F,0XE7,0XC0,0X00,0X00,0X7F,0X00,0X00,0X00,
0X00,0X01,0XFF,0X80,0XFF,0XE7,0X8F,0XFF,0XC4,0XE0,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X87,0XE1,0XFF,0XDF,0X8F,0XFF,0XCE,0X1C,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XF1,0XF8,0XFF,0XFF,0X8F,0XFF,0XCF,0XCF,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFE,0X1C,0XFF,0XBE,0X43,0XE0,0X1F,0XF3,0X80,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0X06,0X7F,0X3E,0X63,0XC1,0X3F,0XF1,0XE0,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0X83,0X3E,0X3C,0XF3,0X81,0X1F,0XF8,0XF0,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0XE1,0X80,0X39,0XFF,0X00,0X07,0XFE,0X78,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0XFF,0XFE,0X60,0X1F,0XFE,0X1C,0X03,0XFF,0X1C,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X0F,0XFF,0X3C,0X1F,0XFE,0X60,0X01,0XFF,0X8E,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X01,0XFF,0X9E,0X0F,0XFF,0XC0,0X00,0X3F,0XC3,0X00,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X7F,0XC3,0X8F,0XFD,0X80,0X00,0X3F,0XE3,0X80,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X3F,0XE1,0XC7,0XFC,0X00,0X00,0X3F,0XF1,0XC0,0X00,0X00,0X00,0X00,
0X00,0X01,0X00,0X1F,0XF1,0XE3,0XF8,0X00,0X00,0X07,0XF0,0X60,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X0F,0XF1,0XE1,0XF0,0X00,0X00,0X03,0XF8,0X30,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X01,0XF8,0X30,0X00,0X00,0X00,0X01,0XFC,0X3C,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XF8,0X18,0X00,0X00,0X00,0X00,0XFC,0X0E,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0XFC,0X0C,0X00,0X00,0X00,0X00,0XFE,0X0F,0X00,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7C,0X0C,0X00,0X00,0X00,0X00,0X7E,0X07,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7C,0X06,0X00,0X00,0X00,0X00,0X3F,0X03,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X7E,0X06,0X00,0X00,0X00,0X00,0X1F,0X81,0X80,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X1E,0X03,0X00,0X00,0X00,0X00,0X0F,0X80,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X0E,0X01,0X00,0X00,0X00,0X00,0X07,0X80,0X60,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X0F,0X01,0X80,0X00,0X00,0X00,0X03,0XC0,0X30,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0X81,0XC0,0X00,0X00,0X00,0X01,0XC0,0X38,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0X81,0XC0,0X00,0X00,0X00,0X00,0XC0,0X18,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X07,0XC0,0XE0,0X00,0X00,0X00,0X00,0X40,0X08,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0XF0,0X00,0X00,0X00,0X00,0X00,0X04,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X70,0X00,0X00,0X00,0X00,0X00,0X06,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X70,0X00,0XF8,0X00,0X00,0X00,0X02,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X30,0X00,0XFF,0XF0,0X00,0X00,0X07,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XC0,0X30,0X01,0XFF,0XF8,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X30,0X01,0XFF,0XFC,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X18,0X01,0XFF,0XFE,0X00,0X00,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0XFF,0XFF,0X00,0X00,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0X67,0XFF,0X00,0X00,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XC0,0X08,0X00,0XFF,0XFF,0X00,0X00,0X00,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0X80,0X08,0X03,0XFF,0XBF,0X80,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X07,0XFF,0X3F,0X80,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0XBF,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0X3F,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XF0,0X1F,0XC0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X03,0XFF,0XCF,0XF0,0X00,0X00,0X40,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XE7,0XFC,0X00,0X00,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XF3,0XFF,0XF0,0X01,0XC0,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X01,0XFF,0XF8,0XFF,0XF8,0X01,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X7F,0XFC,0X7F,0XFF,0X03,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X1F,0XFF,0X00,0X7F,0X83,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0X80,0X1F,0XC7,0X80,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC3,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X3F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X18,0X00,0X1F,0XFF,0XFF,0XFF,0XC4,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X38,0X00,0X0F,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X78,0X00,0X03,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0XF8,0X00,0X00,0X7F,0XFF,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X01,0XF8,0X00,0X00,0X3F,0XFF,0XFF,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X38,0X00,0X00,0X3F,0XFF,0XF9,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X18,0X00,0X00,0X3F,0XFF,0XF3,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X00,0X3F,0XFF,0XE7,0XFC,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X08,0X00,0X00,0X3C,0XFC,0X1F,0XF8,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X00,0X8C,0X00,0X00,0X7E,0X00,0X7F,0X98,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0X79,0X8C,0X00,0X07,0XFF,0X0F,0XFF,0X9C,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X00,0XFC,0XC6,0X00,0X0F,0XFF,0X7F,0XFF,0X78,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X01,0XF8,0X46,0X00,0X0F,0XFF,0X7F,0XFE,0X78,0X00,0X00,0X00,
0X00,0X01,0X80,0X00,0X03,0XFC,0X07,0X00,0X0F,0XFF,0X7F,0XFE,0X78,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X07,0XFE,0X07,0XC0,0X0F,0XFF,0X7F,0XFE,0X60,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X07,0XF9,0XE7,0XE0,0X07,0XFF,0X7F,0XF8,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X03,0XE3,0XF3,0XF0,0X03,0XFF,0XFF,0XF1,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X7F,0XC3,0XF3,0X38,0X01,0XFF,0XFF,0XF1,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFF,0XDF,0XF3,0X1C,0X00,0X7F,0XFF,0XE3,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFF,0X9F,0XF3,0X8E,0X00,0X3F,0XFF,0XE7,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0XFE,0X33,0XFB,0XCF,0X00,0X1F,0XFF,0XCF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X01,0XFE,0X3F,0XF1,0XCF,0X00,0X0F,0XFF,0XCF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X0C,0X7F,0XCD,0XE3,0X80,0X0F,0XFF,0XDF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X01,0X01,0XFC,0X8E,0X7F,0X80,0X0F,0XFF,0X9F,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XF9,0XFC,0X1E,0X3F,0X80,0X0F,0XF3,0XBF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFD,0XFC,0X3E,0X3F,0X80,0X0F,0XE1,0XBF,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFC,0XFC,0X3F,0X3F,0X80,0X0F,0XC1,0X3F,0X00,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XE5,0XF8,0X3B,0X9F,0X80,0X0F,0XC2,0X3F,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XCF,0XF0,0X33,0XDF,0XC0,0X03,0X9C,0X0F,0X80,0X00,0X00,0X00,
0X00,0X00,0X80,0X00,0X0E,0X00,0X39,0XD9,0XC0,0X00,0X38,0X63,0XC0,0X00,0X00,0X00,
0X00,0X00,0X80,0X0F,0XFE,0X00,0X0F,0XEE,0XF0,0X00,0XFF,0XF3,0XF0,0X00,0X00,0X00,
0X00,0X00,0X80,0X1F,0XFE,0X00,0X07,0XEE,0X78,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFE,0X00,0X07,0XEE,0X3C,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0XFE,0X00,0X07,0XEF,0X3C,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1F,0X7C,0X00,0X00,0XEF,0XFC,0X01,0XFF,0XFF,0XF0,0X00,0X00,0X00,
0X00,0X00,0X00,0X1E,0X1C,0X00,0X00,0X6F,0XFC,0X01,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X33,0XFE,0X00,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFE,0X00,0XFF,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X3F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X1F,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFC,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFE,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X7E,0X00,0X03,0XFF,0X80,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X78,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X30,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
};
//================================================================================================
const unsigned char EPD_2IN13_V2_lut_full_update[]= {
0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT0: BB: VS 0 ~7
0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT1: BW: VS 0 ~7
0x80,0x60,0x40,0x00,0x00,0x00,0x00, //LUT2: WB: VS 0 ~7
0x10,0x60,0x20,0x00,0x00,0x00,0x00, //LUT3: WW: VS 0 ~7
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT4: VCOM: VS 0 ~7
0x03,0x03,0x00,0x00,0x02, // TP0 A~D RP0
0x09,0x09,0x00,0x00,0x02, // TP1 A~D RP1
0x03,0x03,0x00,0x00,0x02, // TP2 A~D RP2
0x00,0x00,0x00,0x00,0x00, // TP3 A~D RP3
0x00,0x00,0x00,0x00,0x00, // TP4 A~D RP4
0x00,0x00,0x00,0x00,0x00, // TP5 A~D RP5
0x00,0x00,0x00,0x00,0x00, // TP6 A~D RP6
0x15,0x41,0xA8,0x32,0x30,0x0A,
};
const unsigned char EPD_2IN13_V2_lut_partial_update[]= { //20 bytes
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT0: BB: VS 0 ~7
0x80,0x00,0x00,0x00,0x00,0x00,0x00, //LUT1: BW: VS 0 ~7
0x40,0x00,0x00,0x00,0x00,0x00,0x00, //LUT2: WB: VS 0 ~7
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT3: WW: VS 0 ~7
0x00,0x00,0x00,0x00,0x00,0x00,0x00, //LUT4: VCOM: VS 0 ~7
0x0A,0x00,0x00,0x00,0x00, // TP0 A~D RP0
0x00,0x00,0x00,0x00,0x00, // TP1 A~D RP1
0x00,0x00,0x00,0x00,0x00, // TP2 A~D RP2
0x00,0x00,0x00,0x00,0x00, // TP3 A~D RP3
0x00,0x00,0x00,0x00,0x00, // TP4 A~D RP4
0x00,0x00,0x00,0x00,0x00, // TP5 A~D RP5
0x00,0x00,0x00,0x00,0x00, // TP6 A~D RP6
0x15,0x41,0xA8,0x32,0x30,0x0A,
};
/******************************************************************************
function : Software reset
parameter:
******************************************************************************/
static void EPD_2IN13_V2_Reset(void)
{
gpiod_set_value(reset_pin, 1);
msleep(200);
gpiod_set_value(reset_pin, 0);
msleep(2);
gpiod_set_value(reset_pin, 1);
msleep(200);
}
/******************************************************************************
function : send command
parameter:
Reg : Command register
******************************************************************************/
static void EPD_2IN13_V2_SendCommand(u8 Reg)
{
gpiod_set_value(dc_pin, 0);
spi_write(fbspi, &Reg, 1);
}
/******************************************************************************
function : send data
parameter:
Data : Write data
******************************************************************************/
static void EPD_2IN13_V2_SendData(u8 Data)
{
gpiod_set_value(dc_pin, 1);
spi_write(fbspi, &Data, 1);
}
/******************************************************************************
function : Wait until the busy_pin goes LOW
parameter:
******************************************************************************/
void EPD_2IN13_V2_ReadBusy(void)
{
while(gpiod_get_value(busy_pin) == 1) { //LOW: idle, HIGH: busy
msleep(10);
}
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN13_V2_TurnOnDisplay(void)
{
EPD_2IN13_V2_SendCommand(0x22);
EPD_2IN13_V2_SendData(0xC7);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_ReadBusy();
}
/******************************************************************************
function : Turn On Display
parameter:
******************************************************************************/
static void EPD_2IN13_V2_TurnOnDisplayPart(void)
{
EPD_2IN13_V2_SendCommand(0x22);
EPD_2IN13_V2_SendData(0x0C);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_ReadBusy();
}
/******************************************************************************
function : Initialize the e-Paper register
parameter:
******************************************************************************/
void EPD_2IN13_V2_Init(u8 Mode)
{
u8 count;
EPD_2IN13_V2_Reset();
if(Mode == EPD_2IN13_V2_FULL) {
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x12); // soft reset
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x74); //set analog block control
EPD_2IN13_V2_SendData(0x54);
EPD_2IN13_V2_SendCommand(0x7E); //set digital block control
EPD_2IN13_V2_SendData(0x3B);
EPD_2IN13_V2_SendCommand(0x01); //Driver output control
EPD_2IN13_V2_SendData(0xF9);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x11); //data entry mode
EPD_2IN13_V2_SendData(0x01);
EPD_2IN13_V2_SendCommand(0x44); //set Ram-X address start/end position
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x0F); //0x0C-->(15+1)*8=128
EPD_2IN13_V2_SendCommand(0x45); //set Ram-Y address start/end position
EPD_2IN13_V2_SendData(0xF9); //0xF9-->(249+1)=250
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x3C); //BorderWavefrom
EPD_2IN13_V2_SendData(0x03);
EPD_2IN13_V2_SendCommand(0x2C); //VCOM Voltage
EPD_2IN13_V2_SendData(0x55); //
EPD_2IN13_V2_SendCommand(0x03);
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[70]);
EPD_2IN13_V2_SendCommand(0x04); //
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[71]);
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[72]);
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[73]);
EPD_2IN13_V2_SendCommand(0x3A); //Dummy Line
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[74]);
EPD_2IN13_V2_SendCommand(0x3B); //Gate time
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[75]);
EPD_2IN13_V2_SendCommand(0x32);
for(count = 0; count < 70; count++) {
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_full_update[count]);
}
EPD_2IN13_V2_SendCommand(0x4E); // set RAM x address count to 0;
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x4F); // set RAM y address count to 0X127;
EPD_2IN13_V2_SendData(0xF9);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_ReadBusy();
} else if(Mode == EPD_2IN13_V2_PART) {
EPD_2IN13_V2_SendCommand(0x2C); //VCOM Voltage
EPD_2IN13_V2_SendData(0x26);
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x32);
for(count = 0; count < 70; count++) {
EPD_2IN13_V2_SendData(EPD_2IN13_V2_lut_partial_update[count]);
}
EPD_2IN13_V2_SendCommand(0x37);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x40);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendData(0x00);
EPD_2IN13_V2_SendCommand(0x22);
EPD_2IN13_V2_SendData(0xC0);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_ReadBusy();
EPD_2IN13_V2_SendCommand(0x3C); //BorderWavefrom
EPD_2IN13_V2_SendData(0x01);
} else {
printk(KERN_ERR"error, the Mode is EPD_2IN13_FULL or EPD_2IN13_PART\n");
}
}
/******************************************************************************
function : Clear screen
parameter:
******************************************************************************/
void EPD_2IN13_V2_Clear(void)
{
u16 Width, Height;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
printk(KERN_ERR"clear\n");
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
EPD_2IN13_V2_SendData(0XFF);
}
}
printk(KERN_ERR"\n");
EPD_2IN13_V2_TurnOnDisplay();
}
/******************************************************************************
function : Sends the image buffer in RAM to e-Paper and displays
parameter:
******************************************************************************/
void EPD_2IN13_V2_Display(u8 *Image)
{
u16 Width, Height;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
EPD_2IN13_V2_SendData(Image[i + j * Width]);
}
}
EPD_2IN13_V2_TurnOnDisplay();
}
/******************************************************************************
function : The image of the previous frame must be uploaded, otherwise the
first few seconds will display an exception.
parameter:
******************************************************************************/
void EPD_2IN13_V2_DisplayPartBaseImage(u8 *Image)
{
u16 Width, Height;
u32 Addr;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
Addr = 0;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
Addr = i + j * Width;
EPD_2IN13_V2_SendData(Image[Addr]);
}
}
EPD_2IN13_V2_SendCommand(0x26);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
Addr = i + j * Width;
EPD_2IN13_V2_SendData(Image[Addr]);
}
}
EPD_2IN13_V2_TurnOnDisplay();
}
/******************************************************************************
function : Partly display (No Flash)
parameter:
******************************************************************************/
void EPD_2IN13_V2_DisplayPart(u8 *Image)
{
u16 Width, Height;
u16 i, j;
Width = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
Height = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < Height; j++) {
for (i = 0; i < Width; i++) {
EPD_2IN13_V2_SendData(Image[i + j * Width]);
}
}
EPD_2IN13_V2_TurnOnDisplayPart();
}
/******************************************************************************
function : Enter sleep mode
parameter:
******************************************************************************/
void EPD_2IN13_V2_Sleep(void)
{
EPD_2IN13_V2_SendCommand(0x22); //POWER OFF
EPD_2IN13_V2_SendData(0xC3);
EPD_2IN13_V2_SendCommand(0x20);
EPD_2IN13_V2_SendCommand(0x10); //enter deep sleep
EPD_2IN13_V2_SendData(0x01);
msleep(100);
}
void EPD_2IN13_V2_ClearPart(void)
{
int w, h;
int i, j;
w = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
h = EPD_2IN13_V2_HEIGHT;
EPD_2IN13_V2_SendCommand(0x24);
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
EPD_2IN13_V2_SendData(0xff);
}
}
EPD_2IN13_V2_TurnOnDisplayPart();
}
void EPD_2IN13_V2_Int_Frambuffer(void)
{
int w, h;
int i, j;
flash_count = 0;
w = (EPD_2IN13_V2_WIDTH % 8 == 0)? (EPD_2IN13_V2_WIDTH / 8 ): (EPD_2IN13_V2_WIDTH / 8 + 1);
h = EPD_2IN13_V2_HEIGHT;
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
framebuffer[i + j * w] = 0xff;
}
}
}
// pix=1, write position balck; pix=0, wirete white.
void Write_Pix(u16 x, u16 y, u8 pix){
if(x > EPD_2IN13_V2_WIDTH || y > EPD_2IN13_V2_HEIGHT){
printk(KERN_INFO "Out screen\n");
return ;
}
int position;
position = (y * 128 + x) / 8;
framebuffer[position] &= ~(1 << (x % 8));
framebuffer[position] |= ~(pix << (x % 8));
}
void Update_to_Epd(void){
if(flash_count < MAX_Flash_COUNTER){
flash_count++;
EPD_2IN13_V2_Init(EPD_2IN13_V2_PART);
EPD_2IN13_V2_DisplayPart(framebuffer);
EPD_2IN13_V2_Sleep();
}
else{
flash_count = 0;
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
EPD_2IN13_V2_Display(framebuffer);
EPD_2IN13_V2_DisplayPartBaseImage(framebuffer);
EPD_2IN13_V2_Sleep();
}
}
static ssize_t epd_show(struct kobject* kobjs,struct kobj_attribute *attr,char *buf)
{
printk(KERN_INFO "Read epd\n");
return sprintf(buf, "buf is\n");
}
static ssize_t epd_store(struct kobject *kobj, struct kobj_attribute *attr,const char *buf, size_t count)
{
printk(KERN_INFO "write epd\n");
int num,x,y,pix;
num = sscanf(buf, "%d %d %d", &x, &y, &pix);
if(num < 3){
printk(KERN_INFO "too less agument");
return count;
}
else{
printk("write %d %d %d %d\n", x , y, pix, flash_count);
Write_Pix(x , y, pix);
Update_to_Epd();
return count;
}
}
static struct kobj_attribute epd_attr = __ATTR(epd_status,0660,epd_show,epd_store);
//================================================================================================
static int myfb_probe(struct spi_device *spi)
{
int i;
int ret;
epd_kobj = kobject_create_and_add("sys_epd",NULL);
if(epd_kobj == NULL)
{
printk(KERN_INFO"create led_kobj failed!\n");
return -1;
}
ret = sysfs_create_file(epd_kobj, &epd_attr.attr);
if(ret != 0)
{
printk(KERN_INFO"create sysfa file failed!\n");
return -1;
}
fbspi = spi;
printk(KERN_ERR"register myfb_spi_probe!\n");
dc_pin = devm_gpiod_get(&spi->dev,"dc",GPIOF_OUT_INIT_LOW);
if(IS_ERR(dc_pin))
{
printk(KERN_ERR"fail to request dc-gpios!\n");
return -1;
}
reset_pin = devm_gpiod_get(&spi->dev,"reset",GPIOF_OUT_INIT_HIGH);
if(IS_ERR(reset_pin))
{
printk(KERN_ERR"fail to request reset-gpios!\n");
return -1;
}
busy_pin = devm_gpiod_get(&spi->dev,"busy",GPIOF_OUT_INIT_HIGH);
if(IS_ERR(reset_pin))
{
printk(KERN_ERR"fail to request reset-gpios!\n");
return -1;
}
gpiod_direction_output(dc_pin,0);
gpiod_direction_output(reset_pin,1);
gpiod_direction_input(busy_pin);
EPD_2IN13_V2_Int_Frambuffer();
//==========================Test code==============================================
EPD_2IN13_V2_Init(EPD_2IN13_V2_FULL);
EPD_2IN13_V2_Display(IMAGE_DATA);
EPD_2IN13_V2_Clear();
EPD_2IN13_V2_Sleep();
for(i=0;i<100;i++){
Write_Pix(60 , i, 1);
}
for(i=0;i<30;i++){
Update_to_Epd();
}
return 0;
}
int myfb_remove(struct spi_device *spi)
{
devm_gpiod_put(&spi->dev, dc_pin);
devm_gpiod_put(&spi->dev, reset_pin);
devm_gpiod_put(&spi->dev, busy_pin);
sysfs_remove_file(epd_kobj,&epd_attr.attr); //删除属性
kobject_put(epd_kobj); //删除对象
printk(KERN_INFO "exit sysfs epd!\n");
return 0;
}
struct of_device_id myfb_match[] = {
{.compatible = "test,myfb-spi"},
{},
};
struct spi_driver myfb_drv = {
.probe = myfb_probe,
.remove = myfb_remove,
.driver = {
.owner = THIS_MODULE,
.name = "myfb_spi_driver",
.of_match_table = myfb_match,
},
};
module_spi_driver(myfb_drv);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Perasi");
MODULE_VERSION("1.0");
MODULE_DESCRIPTION("epd_spi_driver");
最近编辑记录 你在卖萌吗 (2023-03-25 00:18:42)
离线
现在fb已经能较为正常的显示了,但是显示的字符的顺序不对
我echo 123456789 > /dev/tty0结果从右边开始显示,这个要修改啥参数呢?
我还想旋转一下啊屏幕,让他横屏这个要咋操作,有无大佬给个思路,我有尝试修改过fb_var_screeninfo.rotate参数修改成1但是没变化
最近编辑记录 你在卖萌吗 (2023-04-01 20:15:21)
离线