当前位置:网站首页>[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);
}
边栏推荐
- 想开户买股票,在网上办理股票开户安全吗?
- TI AM3352/54/59 工业核心板硬件说明书
- 【牛客討論區】第四章:Redis
- 自监督学习与药物发现
- Overview of drug discovery-01 overview of drug discovery
- I/o limit process and CPU limit process
- 声网 VQA:将实时互动中未知的视频画质用户主观体验变可知
- 美团动态线程池实践思路已开源
- Self supervised learning and drug discovery
- Solve storage problems? WMS warehouse management system solution
猜你喜欢
Neural network of zero basis multi map detailed map
pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [1] But...
1382. 将二叉搜索树变平衡-常规方法
Database query optimization: master-slave read-write separation and common problems
Xctf attack and defense world misc wage earner advanced zone
Import the data table in MySQL into Excel
嵌入式必学,硬件资源接口详解——基于ARM AM335X开发板 (上)
The number of nodes of a complete binary tree [non-O (n) solution > Abstract dichotomy]
Review of drug discovery-02-prediction of molecular properties
面试官问:JS的继承
随机推荐
Adobe Premiere Basics - common video effects (corner positioning, mosaic, blur, sharpen, handwriting tools, effect control hierarchy) (16)
[Yocto RM]1 - System Requirements
MapReduce elementary programming practice
Li Kou today's question -522 Longest special sequence
同花顺上能炒股开户吗?安全吗?
OS模块与OS.path 模块的学习
评价——秩和比综合评价
TI AM3352/54/59 工业核心板硬件说明书
style中的scoped属性和lang属性
零基礎多圖詳解圖神經網絡
The practice of dual process guard and keeping alive in IM instant messaging development
centos8-操作记录-命令版-yum-redis-mysql-nacos-jdk
[Yocto RM] 4 - Source Directory Structure
网络爬虫是什么
Self supervised learning and drug discovery
Some problems in awk
【ELT.ZIP】OpenHarmony啃论文俱乐部—数据密集型应用内存压缩
万字长文看懂商业智能(BI)|推荐收藏
pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
嵌入式必学,硬件资源接口详解——基于ARM AM335X开发板 (上)