linux 驱动 spi 接口 3.5inch TFT显示屏 ili9488驱动程序之绘制矩形

设备树如下:

&spi5 {
	status = "okay";
	max-freq = <48000000>;   //spi internal clk, don't modify
	
	spi_dev@0 {
		compatible = "ilitek,ili9488";
		reg = <0>;
		
		led-gpios = <&gpio3 31 GPIO_ACTIVE_HIGH>;
		reset-gpios = <&gpio3 27 GPIO_ACTIVE_LOW>;
		dc-gpios = <&gpio3 25 GPIO_ACTIVE_LOW>;
		
		/**spi-msb-first; */
		
		spi-max-frequency = <32000000>;
		rotate = <270>;
		bgr;
		buswidth = <8>;
		debug = <7>;
		fps = <30>;
	};
		
};
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/delay.h>

#include "ili9488cmds.h"
#include "ili9488_regs.h"

#define WIDTH 480
#define HEIGHT 320

#define  RED  (BIT(15) | BIT(14) | BIT(13) | BIT(12) | BIT(11))
#define  GREEN  (BIT(10) | BIT(9) | BIT(8) | BIT(7) | BIT(6) | BIT(5))
#define  BLUE  (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(4))

//#define dc_rs01(a) gpiod_direction_output(dc_rs,a)
//
//#define reset01(a) gpiod_direction_output(reset,a)
//
//#define cs(a) gpiod_set_value(dc, a)

//#define   PAGE_SIZE  "device name 499"

/**
 * When you have only one slave, then you can directly connect the SS/CS pin to the ground if your slave permits it.
 *
 * https://embetronicx.com/tutorials/tech_devices/spi-serial-peripheral-interface-protocol-basics/
 *
 * https://www.cnblogs.com/tansuoxinweilai/p/11405029.html
 *
 * https://github.com/gmtii/ili9341-arduino/blob/master/TFTv2.cpp
 *
 * https://github.com/CariadDisplayLibrary/ILI9342/blob/master/src/ILI9342.cpp
 *
 * https://github.com/jks-liu/ili9341/blob/master/ili9341.c
 *
 * https://github.com/Bodmer/TFT_ILI9341/tree/master/examples
 *
 * https://blog.csdn.net/jklinux/article/details/79612831
 *
 *
 *
 *
 *
 *reset-gpios
 Hardware reset

 dc-gpios
 Data/Command (sometimes called RS)

 led-gpios
 Backlight


 ilitek,ili9341







 *
 */

struct fbtft_par *par;

static struct spi_device *my_spi_device;

struct gpio_desc *led;

u8 *buffer;

inline void Lcd_Write_Com(u8 cmd);

inline void Lcd_Write_Data2(u8 *data, size_t len);

void fbtft_write_reg8_bus8(struct fbtft_par *par, int len, ...) {
	int i;
	int para;
	va_list args;
//	pr_err("write_reg start \n");
	va_start(args, len);
	para = va_arg(args, int);

	pr_err("fbtft_write_reg8_bus8: %x ", para);
	Lcd_Write_Com(para);
//	pr_err("first arg  %x \n",para);

	for (i = 0; i < len - 1; i++) {
		para = va_arg(args, int);
		pr_err("%x ", para);
		*(buffer + i) = para;
	}
	pr_err("\n");
	va_end(args);

	if (len - 1 > 0) {
		Lcd_Write_Data2(buffer, len - 1);
	}
//	pr_err("write_reg end ###################################");
}

#define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__})/sizeof(int))

#define write_reg(par, ...)  \
do {                     \
	fbtft_write_reg8_bus8(par, NUMARGS(__VA_ARGS__), __VA_ARGS__);   \
} while (0)

struct fbtft_par {
	struct spi_device *spi;
	struct platform_device *pdev;

	struct {
		void *buf;
		size_t len;
	} txbuf;

	struct {
		struct gpio_desc *reset;
		struct gpio_desc *dc;
	} gpio;
};

int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len) {
	int ret;
	struct spi_transfer t = { .tx_buf = buf, .len = len, };
	struct spi_message m;

	if (!par->spi) {
		pr_err("spi is NULL\n");
		return -1;
	}
	spi_message_init(&m);
	spi_message_add_tail(&t, &m);
//	pr_err("fbtft_write_spi end\n");
	ret = spi_sync(par->spi, &m);
	if (ret == 0) {
		pr_err("fbtft_write_spi(len=%ld),success \n", len);
	} else {
		pr_err("fbtft_write_spi(len=%ld),fail \n", len);
	}
	return ret;
}

/* 16 bit pixel over 8-bit databus */
int fbtft_write_vmem16_bus8(struct device *dev, struct fbtft_par *par,
		size_t offset, size_t len) {
//	u16 *vmem16;
	u8 *txbuf = par->txbuf.buf;
	size_t remain;
	size_t to_copy;
	size_t tx_array_size;
	int i;
	int ret = 0;

	pr_err("len = %ld  \n", len);

	/* remaining number of pixels to send */
	remain = len / 2;
//	vmem16 = (u16 *)(par->info->screen_buffer + offset);

//	if (par->gpio.dc != -1)
//	gpio_direction_output(par->gpio.dc, 1);
	gpiod_set_raw_value(par->gpio.dc, 1);

	/* number of pixels that fits in the transmit buffer */
	tx_array_size = par->txbuf.len / 3;

	while (remain) {
		/* number of pixels to copy in one iteration of the loop */
		to_copy = min(tx_array_size, remain);
//		dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
//						to_copy, remain - to_copy);

		for (i = 0; i < to_copy; i++) {
//			u16 pixel = vmem16[i];
//			u16 b = pixel & 0x1f;
//			u16 g = (pixel & (0x3f << 5)) >> 5;
//			u16 r = (pixel & (0x1f << 11)) >> 11;

//			u8 r8 = (r & 0x1F) << 3;
//			u8 g8 = (g & 0x3F) << 2;
//			u8 b8 = (b & 0x1F) << 3;

			u8 r8 = (0x1f & 0x1F) << 3;
			u8 g8 = (0x3f & 0x3F) << 2;
			u8 b8 = (0 & 0x1F) << 3;

			txbuf[i * 3 + 0] = r8;
			txbuf[i * 3 + 1] = g8;
			txbuf[i * 3 + 2] = b8;
		}
		pr_err("to_copy %ld  \n", to_copy * 3);
		ret = fbtft_write_spi(par, par->txbuf.buf, to_copy * 3);
		if (ret < 0)
			return ret;
		remain -= to_copy;
	}
	return ret;
}

/* 16 bit pixel over 8-bit databus */
int fbtft_write_vmem16_bus82(struct device *dev, struct fbtft_par *par,
		u16 color, size_t offset, size_t len) {
	u16 pixel = color;
	u16 b = pixel & 0x1f;
	u16 g = (pixel & (0x3f << 5)) >> 5;
	u16 r = (pixel & (0x1f << 11)) >> 11;

	u8 r8 = (r & 0x1F) << 3;
	u8 g8 = (g & 0x3F) << 2;
	u8 b8 = (b & 0x1F) << 3;

//	u16 *vmem16;
	u8 *txbuf = par->txbuf.buf;
	size_t remain;
	size_t to_copy;
	size_t tx_array_size;
	int i;
	int ret = 0;

	pr_err("len = %ld  \n", len);

	/* remaining number of pixels to send */
	remain = len;
//	vmem16 = (u16 *)(par->info->screen_buffer + offset);

//	if (par->gpio.dc != -1)
//	gpio_direction_output(par->gpio.dc, 1);
	gpiod_set_raw_value(par->gpio.dc, 1);

	/* number of pixels that fits in the transmit buffer */
	tx_array_size = par->txbuf.len / 3;

	while (remain) {
		/* number of pixels to copy in one iteration of the loop */
		to_copy = min(tx_array_size, remain);

//		dev_dbg(par->info->device, "    to_copy=%zu, remain=%zu\n",
//						to_copy, remain - to_copy);

		for (i = 0; i < to_copy; i++) {
			txbuf[i * 3 + 0] = r8;
			txbuf[i * 3 + 1] = g8;
			txbuf[i * 3 + 2] = b8;
		}
		pr_err("to_copy %ld  \n", to_copy * 3);
		ret = fbtft_write_spi(par, par->txbuf.buf, to_copy * 3);
		if (ret < 0)
			return ret;
		remain -= to_copy;
	}
	return ret;
}

inline void lcd_write(u8 *data) {
	fbtft_write_spi(par, data, 1);
}

inline void lcd_write2(u8 *data, size_t len) {
	fbtft_write_spi(par, data, len);
}

inline void Lcd_Write_Com(u8 cmd) {
	pr_err("Lcd_Write_Com = 0x%x\n", cmd);
	gpiod_set_raw_value(par->gpio.dc, 0);
	lcd_write(&cmd);
}

inline void Lcd_Write_Data(u8 data) {
	gpiod_set_raw_value(par->gpio.dc, 1);
	lcd_write(&data);
}

inline void Lcd_Write_Data2(u8 *data, size_t len) {
	gpiod_set_raw_value(par->gpio.dc, 1);
	lcd_write2(data, len);
}

inline void lcd_write_cmd_data(u8 cmd, u8 data) {
	Lcd_Write_Com(cmd);
	Lcd_Write_Data(data);
}

void fbtft_set_addr_win(struct fbtft_par *par, int x_start, int y_start,
		int x_end, int y_end) {
	/* Column address set */
	write_reg(par, ILI9488_CMD_COLUMN_ADDRESS_SET, (x_start >> 8) & 0xFF,
			x_start & 0xFF, (x_end >> 8) & 0xFF, x_end & 0xFF);

	/* Row adress set */
	write_reg(par, ILI9488_CMD_PAGE_ADDRESS_SET, (y_start >> 8) & 0xFF,
			y_start & 0xFF, (y_end >> 8) & 0xFF, y_end & 0xFF);

	/* Memory write */
	write_reg(par, ILI9488_CMD_MEMORY_WRITE);
}

int lcd_clear(struct device *dev, u16 color) {
	size_t offset, len;
	int ret = 0;
	offset = 0;
	len = 320 * 480;
	fbtft_set_addr_win(par, 0, 0, WIDTH - 1, HEIGHT - 1);
	ret = fbtft_write_vmem16_bus82(dev, par, color, offset, len);
	return ret;
}

//int lcd_rect(struct device *dev, u16 color, int width, int height) {
//	size_t offset, len;
//	int ret = 0;
//	offset = 0;
//	len = width * height;
//	fbtft_set_addr_win(par, 0, 0, width - 1, height - 1);
//	ret = fbtft_write_vmem16_bus82(dev, par, color, offset, len);
//	return ret;
//}

int draw_rect(struct device *dev, u16 color, int start_x, int start_y,
		int width, int height) {
	size_t offset, len;
	int ret = 0;
	offset = 0;
	len = width * height;
	fbtft_set_addr_win(par, start_x, start_y, start_x + width - 1,
			start_y + height - 1);
	ret = fbtft_write_vmem16_bus82(dev, par, color, offset, len);
	return ret;
}

void fbtft_reset(struct fbtft_par *par) {
	gpiod_set_raw_value(par->gpio.reset, 0);
	udelay(20);
	gpiod_set_raw_value(par->gpio.reset, 1);
	mdelay(120);
}

void fbtft_update_display(struct fbtft_par *par, unsigned start_line,
		unsigned end_line) {

}

int init_display(void) {
	//reset
	fbtft_reset(par);

	/* startup sequence for MI0283QT-9A */
	write_reg(par, ILI9488_SWRESET); /* software reset */
	mdelay(5);
	write_reg(par, ILI9488_DISPOFF); /* display off */

	write_reg(par, ILI9488_CMD_POSITIVE_GAMMA_CTRL, 0x00, 0x03, 0x09, 0x08,
			0x16, 0x0A, 0x3F, 0x78, 0x4C, 0x09, 0x0A, 0x08, 0x16, 0x1A, 0x0F);
	write_reg(par, ILI9488_CMD_NEGATIVE_GAMMA_CTRL, 0x00, 0x16, 0x19, 0x03,
			0x0F, 0x05, 0x32, 0x45, 0x46, 0x04, 0x0E, 0x0D, 0x35, 0x37, 0x0F);

	write_reg(par, ILI9488_CMD_POWER_CONTROL_1, 0x17, 0x15);
	write_reg(par, ILI9488_CMD_POWER_CONTROL_2, 0x41);

	write_reg(par, ILI9488_CMD_VCOM_CONTROL_1, 0x00, 0x12, 0x80);

	write_reg(par, ILI9488_CMD_MEMORY_ACCESS_CONTROL, 0x48);

	write_reg(par, ILI9488_CMD_INTERFACE_PIXEL_FORMAT, 0x66);
	write_reg(par, ILI9488_CMD_INTERFACE_MODE_CONTROL, 0x80);

	write_reg(par, ILI9488_CMD_FRAME_RATE_CONTROL_NORMAL, 0xA0);

	write_reg(par, ILI9488_CMD_DISPLAY_INVERSION_CONTROL, 0x02);
	write_reg(par, ILI9488_CMD_DISPLAY_FUNCTION_CONTROL, 0x02, 0x02);

	write_reg(par, ILI9488_CMD_SET_IMAGE_FUNCTION, 0x00);

	write_reg(par, ILI9488_CMD_ADJUST_CONTROL_3, 0xA9, 0x51, 0x2C, 0x82);

	write_reg(par, ILI9488_SLPOUT);
	mdelay(120);

	write_reg(par, ILI9488_DISPON);
	mdelay(20);
	return 0;
}

void fbtft_update_display2(struct device *dev, struct fbtft_par *par) {
	size_t offset, len;
	int ret = 0;
	offset = 0;
	len = (319 - 0 + 1) * 960;
	ret = fbtft_write_vmem16_bus8(dev, par, offset, len);
}

int my_probe(struct spi_device *spi) {
	int ret = 0;
	my_spi_device = spi;
	buffer = kmalloc(1024 * sizeof(u8), GFP_KERNEL);

	par = kmalloc(sizeof(struct fbtft_par), GFP_KERNEL);
	par->spi = spi;
	par->txbuf.buf = kmalloc(8192 * sizeof(u8), GFP_KERNEL);
	par->txbuf.len = 8192;
	dev_info(&spi->dev, "my_probe start.\n");
	dev_info(&spi->dev, "master->bus_num = %d\n", spi->master->bus_num);
	dev_info(&spi->dev, "chip_select = %d\n", spi->chip_select);
	dev_info(&spi->dev, "bits_per_word = %d\n", spi->bits_per_word);

	led = devm_gpiod_get(&spi->dev, "led", GPIOD_OUT_HIGH);
	if (IS_ERR(led)) {
		pr_err("error \n");
		return -1;
	}
	par->gpio.reset = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_HIGH);
	if (IS_ERR(par->gpio.reset)) {
		pr_err("error \n");
		return -1;
	}
//
	par->gpio.dc = devm_gpiod_get(&spi->dev, "dc", GPIOD_OUT_HIGH);
	if (IS_ERR(par->gpio.dc)) {
		pr_err("error \n");
		return -1;
	}
	init_display();
	write_reg(par, 0x36, 0x38);
//	fbtft_update_display2(&spi->dev, par);

	mdelay(1500);
	draw_rect(&spi->dev, RED, 0, 0, WIDTH, HEIGHT);
	mdelay(1500);
	draw_rect(&spi->dev, BLUE, 0,0,480, 160);
	mdelay(1500);
	draw_rect(&spi->dev, GREEN, 100, 100, 100, 100);
	return ret;
}

int my_remove(struct spi_device *spi) {
	dev_info(&spi->dev, "my_remove start.\n");
	kfree(buffer);
	kfree(par->txbuf.buf);
	kfree(par);
	return 0;
}

static const struct of_device_id tft9488_dt_ids[] = { { .compatible =
		"ilitek,ili9488" }, { }, };

MODULE_DEVICE_TABLE(of, tft9488_dt_ids);

static struct spi_driver spidev_spi_driver = { .driver = { .name =
		"ilitek,ili9488", .of_match_table = of_match_ptr(tft9488_dt_ids), },
		.probe = my_probe, .remove = my_remove, };

module_spi_driver(spidev_spi_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andy");
MODULE_DESCRIPTION("A sample c  driver");

下面是2个头文件:

#ifndef _ILI9488CMDS_H
#define _ILI9488CMDS_h

#define ILI9488_TFTWIDTH  320
#define ILI9488_TFTHEIGHT 480

#define ILI9488_NOP     0x00
#define ILI9488_SWRESET 0x01
#define ILI9488_RDDID   0x04
#define ILI9488_RDDST   0x09

#define ILI9488_SLPIN   0x10
#define ILI9488_SLPOUT  0x11
#define ILI9488_PTLON   0x12
#define ILI9488_NORON   0x13

#define ILI9488_RDMODE  0x0A
#define ILI9488_RDMADCTL  0x0B
#define ILI9488_RDPIXFMT  0x0C
#define ILI9488_RDIMGFMT  0x0D
#define ILI9488_RDSELFDIAG  0x0F

#define ILI9488_INVOFF  0x20
#define ILI9488_INVON   0x21
#define ILI9488_GAMMASET 0x26
#define ILI9488_DISPOFF 0x28
#define ILI9488_DISPON  0x29

#define ILI9488_CASET   0x2A
#define ILI9488_PASET   0x2B
#define ILI9488_RAMWR   0x2C
#define ILI9488_RAMRD   0x2E

#define ILI9488_PTLAR   0x30
#define ILI9488_MADCTL  0x36
#define ILI9488_PIXFMT  0x3A

#define ILI9488_FRMCTR1 0xB1
#define ILI9488_FRMCTR2 0xB2
#define ILI9488_FRMCTR3 0xB3
#define ILI9488_INVCTR  0xB4
#define ILI9488_DFUNCTR 0xB6

#define ILI9488_PWCTR1  0xC0
#define ILI9488_PWCTR2  0xC1
#define ILI9488_PWCTR3  0xC2
#define ILI9488_PWCTR4  0xC3
#define ILI9488_PWCTR5  0xC4
#define ILI9488_VMCTR1  0xC5
#define ILI9488_VMCTR2  0xC7

#define ILI9488_RDID1   0xDA
#define ILI9488_RDID2   0xDB
#define ILI9488_RDID3   0xDC
#define ILI9488_RDID4   0xDD

#define ILI9488_GMCTRP1 0xE0
#define ILI9488_GMCTRN1 0xE1

#endif /* _ili9488cmds_H */
#ifndef DRIVERS_GFX_ILI9488_ILI9488_REGS_H_INCLUDED
#define DRIVERS_GFX_ILI9488_ILI9488_REGS_H_INCLUDED


/* Level 1 Commands (from the display Datasheet) */
#define ILI9488_CMD_NOP                             0x00
#define ILI9488_CMD_SOFTWARE_RESET                  0x01
#define ILI9488_CMD_READ_DISP_ID                    0x04
#define ILI9488_CMD_READ_DSI_ERRORS                 0x05
#define ILI9488_CMD_READ_DISP_STATUS                0x09
#define ILI9488_CMD_READ_DISP_POWER_MODE            0x0A
#define ILI9488_CMD_READ_DISP_MADCTRL               0x0B
#define ILI9488_CMD_READ_DISP_PIXEL_FORMAT          0x0C
#define ILI9488_CMD_READ_DISP_IMAGE_MODE            0x0D
#define ILI9488_CMD_READ_DISP_SIGNAL_MODE           0x0E
#define ILI9488_CMD_READ_DISP_SELF_DIAGNOSTIC       0x0F
#define ILI9488_CMD_SLEEP_IN                        0x10
#define ILI9488_CMD_SLEEP_OUT                       0x11
#define ILI9488_CMD_PARTIAL_MODE_ON                 0x12
#define ILI9488_CMD_NORMAL_DISP_MODE_ON             0x13
#define ILI9488_CMD_DISP_INVERSION_OFF              0x20
#define ILI9488_CMD_DISP_INVERSION_ON               0x21
#define ILI9488_CMD_ALL_PIXELS_OFF                  0x22
#define ILI9488_CMD_ALL_PIXELS_ON                   0x23
#define ILI9488_CMD_DISPLAY_OFF                     0x28
#define ILI9488_CMD_DISPLAY_ON                      0x29
#define ILI9488_CMD_COLUMN_ADDRESS_SET              0x2A
#define ILI9488_CMD_PAGE_ADDRESS_SET                0x2B
#define ILI9488_CMD_MEMORY_WRITE                    0x2C
#define ILI9488_CMD_MEMORY_READ                     0x2E
#define ILI9488_CMD_PARTIAL_AREA                    0x30
#define ILI9488_CMD_VERT_SCROLL_DEFINITION          0x33
#define ILI9488_CMD_TEARING_EFFECT_LINE_OFF         0x34
#define ILI9488_CMD_TEARING_EFFECT_LINE_ON          0x35
#define ILI9488_CMD_MEMORY_ACCESS_CONTROL           0x36
#define ILI9488_CMD_VERT_SCROLL_START_ADDRESS       0x37
#define ILI9488_CMD_IDLE_MODE_OFF                   0x38
#define ILI9488_CMD_IDLE_MODE_ON                    0x39
#define ILI9488_CMD_INTERFACE_PIXEL_FORMAT          0x3A
#define ILI9488_CMD_WRITE_MEMORY_CONTINUE           0x3C
#define ILI9488_CMD_READ_MEMORY_CONTINUE            0x3E
#define ILI9488_CMD_WRITE_TEAR_SCANLINE             0x44
#define ILI9488_CMD_READ_TEAR_SCANLINE              0x45
#define ILI9488_CMD_WRITE_DISPLAY_BRIGHTNESS        0x51
#define ILI9488_CMD_READ_DISPLAY_BRIGHTNESS         0x52
#define ILI9488_CMD_WRITE_CTRL_DISPLAY              0x53
#define ILI9488_CMD_READ_CTRL_DISPLAY               0x54
#define ILI9488_CMD_WRITE_CONTENT_ADAPT_BRIGHTNESS  0x55
#define ILI9488_CMD_READ_CONTENT_ADAPT_BRIGHTNESS   0x56
#define ILI9488_CMD_WRITE_MIN_CAB_LEVEL             0x5E
#define ILI9488_CMD_READ_MIN_CAB_LEVEL              0x5F
#define ILI9488_CMD_READ_BRIGHTNESS_DIAG_RESULT     0x68
#define ILI9488_CMD_READ_ID1                        0xDA
#define ILI9488_CMD_READ_ID2                        0xDB
#define ILI9488_CMD_READ_ID3                        0xDC

/* Level 2 Commands (from the display Datasheet) */
#define ILI9488_CMD_INTERFACE_MODE_CONTROL          0xB0
#define ILI9488_CMD_FRAME_RATE_CONTROL_NORMAL       0xB1
#define ILI9488_CMD_FRAME_RATE_CONTROL_IDLE_8COLOR  0xB2
#define ILI9488_CMD_FRAME_RATE_CONTROL_PARTIAL      0xB3
#define ILI9488_CMD_DISPLAY_INVERSION_CONTROL       0xB4
#define ILI9488_CMD_BLANKING_PORCH_CONTROL          0xB5
#define ILI9488_CMD_DISPLAY_FUNCTION_CONTROL        0xB6
#define ILI9488_CMD_ENTRY_MODE_SET                  0xB7
#define ILI9488_CMD_COLOR_ENHANCEMENT_CTRL_1        0xB9
#define ILI9488_CMD_COLOR_ENHANCEMENT_CTRL_2        0xBA
#define ILI9488_CMD_HS_LANES_CONTROL                0xBE
#define ILI9488_CMD_POWER_CONTROL_1                 0xC0
#define ILI9488_CMD_POWER_CONTROL_2                 0xC1
#define ILI9488_CMD_POWER_CONTROL_3                 0xC2
#define ILI9488_CMD_POWER_CONTROL_4                 0xC3
#define ILI9488_CMD_POWER_CONTROL_5                 0xC4
#define ILI9488_CMD_VCOM_CONTROL_1                  0xC5
#define ILI9488_CMD_CABC_CONTROL_1                  0xC6
#define ILI9488_CMD_CABC_CONTROL_2                  0xC8
#define ILI9488_CMD_CABC_CONTROL_3                  0xC9
#define ILI9488_CMD_CABC_CONTROL_4                  0xCA
#define ILI9488_CMD_CABC_CONTROL_5                  0xCB
#define ILI9488_CMD_CABC_CONTROL_6                  0xCC
#define ILI9488_CMD_CABC_CONTROL_7                  0xCD
#define ILI9488_CMD_CABC_CONTROL_8                  0xCE
#define ILI9488_CMD_CABC_CONTROL_9                  0xCF
#define ILI9488_CMD_NVMEM_WRITE                     0xD0
#define ILI9488_CMD_NVMEM_PROTECTION_KEY            0xD1
#define ILI9488_CMD_NVMEM_STATUS_READ               0xD2
#define ILI9488_CMD_READ_ID4                        0xD3
#define ILI9488_CMD_ADJUST_CONTROL_1                0xD7
#define ILI9488_CMD_READ_ID4_CHECK                  0xD8
#define ILI9488_CMD_POSITIVE_GAMMA_CTRL             0xE0
#define ILI9488_CMD_NEGATIVE_GAMMA_CTRL             0xE1
#define ILI9488_CMD_DIGITAL_GAMMA_CONTROL_1         0xE2
#define ILI9488_CMD_DIGITAL_GAMMA_CONTROL_2         0xE3
#define ILI9488_CMD_SET_IMAGE_FUNCTION              0xE9
#define ILI9488_CMD_ADJUST_CONTROL_2                0xF2
#define ILI9488_CMD_ADJUST_CONTROL_3                0xF7
#define ILI9488_CMD_ADJUST_CONTROL_4                0xF8
#define ILI9488_CMD_ADJUST_CONTROL_5                0xF9
#define ILI9488_CMD_SPI_READ_CMD_SETTING            0xFB
#define ILI9488_CMD_ADJUST_CONTROL_6                0xFC
#define ILI9488_CMD_ADJUST_CONTROL_7                0xFF

#endif /* DRIVERS_GFX_ILI9488_ILI9488_REGS_H_INCLUDED */

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ESP32 3.5英寸SPI模块ILI9488 SKU:MSP3520是一款集成了ESP32芯片和3.5英寸SPI触摸屏模块的开发板。ESP32是一种功能强大的微控制器,具有高性能、低功耗和丰富的接口资源。而ILI9488是一种支持RGB 8位并行接口SPI接口的LCD控制器芯片,能够提供高质量的显示效果。 这个开发板的特点是方便集成,适合开发者用来实现各种物联网和嵌入式应用。ESP32芯片通过高速SPI总线与ILI9488控制器进行通信,实现图形和文本的显示。同时,该开发板还集成了触摸屏模块,可轻松实现触摸输入功能。 除了基本的显示和触摸功能外,ESP32 3.5英寸SPI模块ILI9488还具有丰富的外围接口,如GPIO、UART、I2C和ADC等,方便开发者连接和控制其他外部设备。开发者可以利用ESP32强大的处理能力、丰富的库函数和易用的开发工具,快速实现各种功能,如物联网设备控制、传感器数据采集和云平台通信等。 此外,由于该开发板集成了ESP32 WiFi和蓝牙模块,可以轻松实现无线通信功能。开发者可以通过WiFi连接到互联网,实现远程控制和数据传输。同时,蓝牙功能也提供了方便的无线数据传输和设备间的通信方式。 总之,ESP32 3.5英寸SPI模块ILI9488是一款功能强大、易用性高的开发板,适合用于物联网和嵌入式应用的开发。无论是初学者还是有经验的开发者,都可以通过该开发板快速实现自己的创意和项目。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值