0

我在下面遇到错误;

 error: cannot convert 's8 (BNO055::*)(uint8_t, uint8_t, uint8_t*, uint8_t)' {aka 'signed 
 char (BNO055::*)(unsigned char, unsigned char, unsigned char*, unsigned char)'} to 's8 (*) 
 (u8, u8, u8*, u8)' {aka 'signed char (*)(unsigned char, unsigned char, unsigned char*, 
 unsigned char)'} in assignment
 65 |  bno055_struct.bus_write = &BNO055::write_reg;
    |                                     ^~~~~~~~~

这是我的代码;

#define BNO055_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len) \
bus_write(dev_addr, reg_addr, reg_data, wr_len)

struct bno055_t
{
u8 chip_id; /**< chip_id of bno055 */
u16 sw_rev_id; /**< software revision id of bno055 */
u8 page_id; /**< page_id of bno055 */
u8 accel_rev_id; /**< accel revision id of bno055 */
u8 mag_rev_id; /**< mag revision id of bno055 */
u8 gyro_rev_id; /**< gyro revision id of bno055 */
u8 bl_rev_id; /**< boot loader revision id of bno055 */
u8 dev_addr; /**< i2c device address of bno055 */
BNO055_WR_FUNC_PTR; /**< bus write function pointer */
BNO055_RD_FUNC_PTR; /**<bus read function pointer */
void (*delay_msec)(BNO055_MDELAY_DATA_TYPE); /**< delay function pointer */
};

struct bno055_t bno055_struct;

bno055_struct.bus_write = &BNO055::write_reg;

s8 BNO055::write_reg(uint8_t dev_addr, uint8_t reg_addr, uint8_t *reg_data, uint8_t cnt);

我该如何解决这个问题?我正在尝试为 PX4 编写 BNO055 的驱动程序。

4

0 回答 0