簡體   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