当前位置:网站首页>[sylixos] I2C device driver creation and use
[sylixos] I2C device driver creation and use
2022-06-28 01:56:00 【zhaqonianzhu】
The premise is that it has been realized i2c Bus driver
step
The steps are divided into several steps :
- Create device API_I2cAdapterCreate
- Transmit messages API_I2cDeviceTransfer
- Send a message API_I2cDeviceMasterSend
- receive messages API_I2cDeviceMasterRecv
- Delete device API_I2cDeviceDelete
Example
{
uint8_t data_buf[100]
LW_I2C_MESSAGE i2cWrMsg[2];
PLW_I2C_DEVICE pI2cDev;
pI2cDev = API_I2cDeviceCreate("/bus/i2c/0", "i2cdev", 0x60, 0);
API_I2cDeviceMasterSend("i2cdev", data_buf, 1);
API_I2cDeviceMasterRecv("i2cdev", data_buf, 1);
i2cWrMsg[0].I2CMSG_usAddr = 0x60;
i2cWrMsg[0].I2CMSG_usFlag = 0;
i2cWrMsg[0].I2CMSG_pucBuffer = (VOID*)&data_buf[1];
i2cWrMsg[0].I2CMSG_usLen = 1;
i2cWrMsg[1].I2CMSG_usAddr = i2cWrMsg[0].I2CMSG_usAddr;
i2cWrMsg[1].I2CMSG_usFlag = LW_I2C_M_RD;
i2cWrMsg[1].I2CMSG_pucBuffer = data_buf;
i2cWrMsg[1].I2CMSG_usLen = 1;
API_I2cDeviceTransfer("i2cdev", i2cWrMsg, 2);
}
边栏推荐
- Is there any risk in opening an account for flush stock? Is it safe for flush to open an account
- 学习 pickle
- 药物发现综述-03-分子设计与优化
- 怎样能低成本构建一个电商平台
- 一张图弄懂 MIT,BSD,Apache几种开源协议之间的区别
- 声网 VQA:将实时互动中未知的视频画质用户主观体验变可知
- 机器学习笔记 - 时间序列作为特征
- Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)
- 国外LEAD赚钱的一些习惯
- [Yocto RM]3 - Yocto Project Releases and the Stable Release Process
猜你喜欢

Lmsoc: a socially sensitive pre training method

The practice of dual process guard and keeping alive in IM instant messaging development

How to optimize the "message" list of IM

Xctf attack and defense world misc wage earner advanced zone

Google Earth engine (GEE) -- an error caused by the imagecollection (error) traversing the image collection

将某数据库N多表名作为另外一张表中某一列得值(范围可以是别的数据库中得某张表)

Interviewer asked: Inheritance of JS

N methods of data De duplication using SQL

766. 托普利茨矩阵

Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)
随机推荐
怎样能低成本构建一个电商平台
嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)
Deepmind | pre training of molecular property prediction through noise removal
【DNS 解析】将Name.com的域名接入DNSPod解析
【牛客討論區】第四章:Redis
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
PostgreSQL设置自增字段
Database query optimization: master-slave read-write separation and common problems
DeepMind | 通过去噪来进行分子性质预测的预训练
【开源】开源系统整理-考试问卷等
Li Kou today's question -522 Longest special sequence
万字长文看懂商业智能(BI)|推荐收藏
Implementation of timed tasks in laravel framework
Is it safe to open an online futures account?
如何理解 Transformer 中的 Query、Key 与 Value
利用redis bitmap实现人员在线情况监控
【嵌入式基础】内存(Cache,RAM,ROM,Flash)
面试官问:JS的this指向
学习 pickle
Web3 技术初体验以及相关学习资料