Files
ldc1612_cmake_vscode/iic_new.md

43 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

主要改进特性:
通用读写函数:
i2c_write():支持任意长度的写操作
i2c_read():支持任意长度的读操作
兼容性函数保留原有的16位读写函数以保持向后兼容
便利函数提供常用的8位、16位、32位读写函数
智能长度处理:
单字节读取正确处理NACK和STOP时序
双字节读取使用POS=NEXT模式
多字节读取正确处理最后几个字节的ACK/NACK时序
错误处理:保持原有的重试机制和错误处理逻辑
使用示例:
```
uint8_t data[4];
i2c_result_t result;
// 读取1字节
result = i2c_read_8bits(0x48, 0x00, &data[0]);
// 读取2字节
result = i2c_read(0x48, 0x01, data, 2);
// 读取4字节
result = i2c_read_32bits(0x48, 0x02, data);
// 写入3字节
uint8_t write_data[3] = {0x11, 0x22, 0x33};
result = i2c_write(0x48,
```
主要功能特性
支持任意长度读写从1字节到255字节
正确的ACK/NACK处理根据读取长度智能处理
保持兼容性原有的16位读写函数仍然可用
专用显示函数:为显示面板参数读取提供专门的函数
完整的错误处理:保持原有的重试和错误恢复机制
这样就可以支持您文档中提到的多字节显示面板参数读写操作了