问题描述
我正在尝试在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*
表示它期望的是指针而不是值。)这是不可能的,因为您无法将指针指向不存在的变量。
您需要添加具有该值的变量,并将其传递为:
*