⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t_iic_ioctl.c

📁 uClinux下IIC读写程序
💻 C
字号:
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>

#include "iic-arm44b0.h"

int main(int argc, char *argv[])
{
	int fd, res, i;
	fd = open("/dev/iicarm0", O_RDWR);

	/* complain if the open failed */
	if (fd == -1) {
		perror("open");
		printf("can`t open iicarm0\n");
		return 1;
	}

	res = ioctl( fd, IICARM_GET_SLAVE_PAGE, &i);
	printf("SLAVE_PAGE = %d\n",i);
	i =  0xa2; //1010 0010 error slave device address
	res = ioctl( fd, IICARM_SET_SLAVE_ADDRESS, &i);
	printf("SLAVE_PAGESIZE = %d\n",i);
	
	printf("test iic debug toggled\n");
	

	close(fd);
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -