[STM32G0] HAL库的I2C驱动真好用啊,考虑全面

[复制链接]
449|1
 楼主| yiyigirl2014 发表于 2024-1-11 20:36 | 显示全部楼层 |阅读模式
  1. /**

  2.   * [url=home.php?mod=space&uid=247401]@brief[/url]  Transmits in master mode an amount of data in blocking mode.

  3.   * @param  hi2c Pointer to a I2C_HandleTypeDef structure that contains

  4.   *                the configuration information for the specified I2C.

  5.   * @param  DevAddress Target device address: The device 7 bits address value

  6.   *         in datasheet must be shifted to the left before calling the interface

  7.   * @param  pData Pointer to data buffer

  8.   * @param  Size Amount of data to be sent

  9.   * @param  Timeout Timeout duration

  10.   * @retval HAL status

  11.   */

  12. HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData,

  13.                                           uint16_t Size, uint32_t Timeout);
看这函数,里面传递的有超时函数,当忙切超时时候就结束。挺好的。

天灵灵地灵灵 发表于 2024-1-11 21:38 | 显示全部楼层
非常好用,这是多少用户积累下来的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

230

主题

3676

帖子

10

粉丝
快速回复 在线客服 返回列表 返回顶部