错误:“ int”类型的参数与“ uint8_t *”类型的参数不兼容

问题描述

我正在尝试在STM32F401RE上使用HAL编写I2C应用程序。当我写数据时,出现此错误。这是我的代码

HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c,uint16_t DevAddress,uint16_t MemAddress,uint16_t MemAddSize,uint8_t *pData,uint16_t Size,uint32_t Timeout)

HAL_I2C_Mem_Write(hi2c,mpu9250_ADDRESS,PWR_MGMT_1,0x01,1,100);

0x01必须为(uint8_t *)形式。如何转换或投射?

解决方法

您正在将(define (general-bubble-pass lst func) (local [(define (general-bubble-pass-acc lst bubble) (cond [(empty? lst) (list bubble)] [(not (func (first lst) bubble)) (cons bubble (general-bubble-pass-acc (rest lst) (first lst)))] [else (cons (first lst) (general-bubble-pass-acc (rest lst) bubble))]))] (if (<= (length lst) 1) lst (general-bubble-pass-acc (rest lst) (first lst))))) (类型为0x01的值)传递给期望int的函数。 (uint8_t*表示它期望的是指针而不是值。)这是不可能的,因为您无法将指针指向不存在的变量。

您需要添加具有该值的变量,并将其传递为:

*

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...