繁体   English   中英

Teensy LidarLite LIDAR增强了参数2从'int16_t * {aka short int *}'到'int *'的未知转换

[英]Teensy LidarLite LIDAREnhanced no known conversion for argument 2 from 'int16_t* {aka short int*}' to 'int*'

我正在使用Teensy 3.5运行LidarLite v3模块,并收到以下错误:

teensy no known conversion for argument 2 from 'int16_t* {aka short int*}' to 'int*'

对于许多不同的功能,会重复出现此错误。 如何使编译器使用16位int而不是32位int?

更新1:

运行的代码是:

#include <Arduino.h>
#include <Wire.h>
#include <I2CFunctions.h> 
#include <LidarObject.h>
#include <LidarController.h>

#define WIRE400K true
// Trigger pin, can be unplugged
#define Z1_LASER_TRIG 11
// Enable pin, IMPORTANT
#define Z1_LASER_EN 12
// Mode pin, can be unplugged
#define Z1_LASER_PIN 13
//Define address of lasers
//Thoses are written during initialisation
// default address : 0x62
#define Z1_LASER_AD 0x6E

#define NUMBER_OF_LASERS 1

// Create lasers
static LidarController Controller;
static LidarObject LZ1;

void setup()
{
  Serial.begin(115200);
  // Configure lasers
  LZ1.begin(Z1_LASER_EN, Z1_LASER_PIN, Z1_LASER_TRIG, Z1_LASER_AD, 2, DISTANCE, 'A');
  LZ1.setCallbackDistance(&distance_callback);
  // Add the laser to the Controller
  Controller.add(&LZ1, 0);

  delay(100);
  Controller.begin(WIRE400K);
  delay(100);
}

void distance_callback(LidarObject* self){
   Serial.println(self->distance);
}

void loop()
{
  Controller.spinOnce();
  // Rest of your non blocking application. 
}

有问题的图书馆位于: https//github.com/AlexisTM/LIDAR

作为该站点状态的其他答案,teensy板是32位板,这意味着int是32位。 LIDAREnhanced库和WIRE库均假定in为16位。

为了修复LIDAREnhanced库,您需要进入LidarController.h并将对int每个引用更改为int16_t 这将迫使编译器将文件中的所有整数都视为同一类型。

此外,对于Teensy 3.x,我还将每个#include <Wire.h>更改为#include <i2c_t3.h> i2c_t3库旨在处理Teensy 3.x板的i2c通信。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM