您尚未登录。

楼主 # 2024-07-16 19:05:45

lmnb
会员
注册时间: 2024-01-28
已发帖子: 40
积分: 67
个人网站

求助,f1c100s的rttread的spi驱动怎么用,想驱动一个st7789屏幕

求助,f1c100s的rttread的spi驱动怎么用,想驱动一个st7789屏幕,rttread移植的是微凉大佬的,求会用的大伙给个思路

离线

楼主 #1 2024-07-16 22:39:13

lmnb
会员
注册时间: 2024-01-28
已发帖子: 40
积分: 67
个人网站

Re: 求助,f1c100s的rttread的spi驱动怎么用,想驱动一个st7789屏幕

static void test_spi(void)
{
	#define TEST_SPI_NAME	"spi10"
	struct rt_spi_device *spi_dev_test = RT_NULL;
	struct rt_spi_message msg1;
	struct rt_spi_configuration cfg;
	//rt_uint8_t msg = 0x0a;
	spi_dev_test = (struct rt_spi_device *)rt_device_find(TEST_SPI_NAME);
	if(spi_dev_test == RT_NULL)
	{
		rt_kprintf("test spi error\n");
		return;
	}

	cfg.data_width = 8;
	cfg.mode = RT_SPI_MODE_0 | RT_SPI_MSB; /* SPI Compatible Modes 0 and 3 */
	cfg.max_hz = 500000; /* Atmel RapidS Serial Interface: 66MHz Maximum Clock Frequency */
	rt_spi_configure(spi_dev_test, &cfg);

	msg1.send_buf   = "lmnb66";
	msg1.recv_buf   = RT_NULL;
	msg1.length     = 6;
	msg1.cs_take    = 1;
	msg1.cs_release = 1;
	msg1.next       = RT_NULL;
	rt_kprintf("test spi\n");
	rt_spi_transfer_message(spi_dev_test, &msg1);
}

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn