如何解决lsm6ds33 IMU HAL 库 I2C 函数问题
对于一个项目,我必须使用 HAL 库运行带有 STM32f446re 微控制器的 lsm6ds33 传感器。
将现有的 lsm6ds33 库转换为 HAL 库时,由于您在下面看到的原因,我无法运行我的工作。
由于我将 mbed 库转换为 HAL 库,因此找不到以下函数的等效项。
// MBED
int read(int address,char *data,int length,bool repeated = false);
/** Read a single byte from the I2C bus
*
* @param ack indicates if the byte is to be acknowledged (1 = acknowledge)
*
* @returns
* the byte read
*/
int read(int ack);
/** Write to an I2C slave
*
* Performs a complete write transaction. The bottom bit of
* the address is forced to 0 to indicate a write.
*
* @param address 8-bit I2C slave address [ addr | 0 ]
* @param data Pointer to the byte-array data to send
* @param length Number of bytes to send
* @param repeated Repeated start,true - do not send stop at end
*
* @returns
* 0 on success (ack),* non-0 on failure (nack)
*/
int write(int address,const char *data,bool repeated = false);
/** Write single byte out on the I2C bus
*
* @param data data to write out on bus
*
* @returns
* '1' if an ACK was received,* '0' otherwise
*/
int write(int data);
// 哈尔
HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c,uint16_t DevAddress,uint8_t *pData,uint16_t Size,uint32_t Timeout);
HAL_StatusTypeDef HAL_I2C_Master_Receive(I2C_HandleTypeDef *hi2c,uint32_t Timeout);
int write(int data);
— 这个消除所有问题的函数是以下函数
HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c,uint32_t Timeout);
。
我怎样才能写成这种格式?
额外: 如果有您当前正在使用或知道的 lsm6ds33 HAL 库,可以在评论中发布吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。