Open Yuriy-Kuchinskiy opened 4 years ago
Hi @jetsonhacks, Thank you for the project. I confirm that your code is working with LidarLite V3 & Jetson Nano, with the following wiring map:
VCC J41-4 -> Lidar-Lite (+) 5V (red wire) GND J41-6 -> Lidar-Lite (-) SCL J41-5 -> Lidar-Lite (SCL) SDA J41-3 -> Lidar-Lite (SDA)
Plus, to get code working with L4T 32.2 i have to do the following small changes, due to modifications in libi2c & libi2c-dev (4.0-2)
diff --git a/example/LidarPlotSketch/PlotPractice.pro b/example/LidarPlotSketch/PlotPractice.pro index 8f14a6e..a7efeda 100644 --- a/example/LidarPlotSketch/PlotPractice.pro +++ b/example/LidarPlotSketch/PlotPractice.pro @@ -30,3 +30,5 @@ OTHER_FILES += \ RESOURCES += \ PlotPractice.qrc + +unix|win32: LIBS += -li2c diff --git a/example/LidarPlotSketch/lidarlite.h b/example/LidarPlotSketch/lidarlite.h index 79f6b79..4c359f9 100644 --- a/example/LidarPlotSketch/lidarlite.h +++ b/example/LidarPlotSketch/lidarlite.h @@ -25,7 +25,6 @@ #define LIDARLITE_H #include <cstddef> -#include <linux/i2c-dev.h> #include <sys/ioctl.h> #include <cstdlib> #include <cstdio> @@ -33,6 +32,10 @@ #include <unistd.h> #include <errno.h> +extern "C" { + #include <i2c/smbus.h> + #include <linux/i2c-dev.h> +} // Information taken from PulsedLight knowledge base 5-4-15 // Internal Control Registers diff --git a/example/Makefile b/example/Makefile index d7d3f15..9cc68dd 100755 --- a/example/Makefile +++ b/example/Makefile @@ -1,2 +1,2 @@ all: - g++ example.cpp ../src/lidarlite.cpp -I../src -o example + g++ example.cpp ../src/lidarlite.cpp -I../src -li2c -o example diff --git a/src/lidarlite.h b/src/lidarlite.h index 35343ff..c9289fc 100644 --- a/src/lidarlite.h +++ b/src/lidarlite.h @@ -26,7 +26,6 @@ #define LIDARLITE_H #include <cstddef> -#include <linux/i2c-dev.h> #include <sys/ioctl.h> #include <cstdlib> #include <cstdio> @@ -34,6 +33,11 @@ #include <unistd.h> #include <errno.h> +extern "C" { + #include <linux/i2c-dev.h> + #include <i2c/smbus.h> +} + // Information taken from PulsedLight knowledge base 5-4-15 // Internal Control Registers
Please let me know if you would like me to create PR
Thank you for your update, it also works for me with the same configuration on Jetson Nano.
Hi @jetsonhacks, Thank you for the project. I confirm that your code is working with LidarLite V3 & Jetson Nano, with the following wiring map:
Plus, to get code working with L4T 32.2 i have to do the following small changes, due to modifications in libi2c & libi2c-dev (4.0-2)
Please let me know if you would like me to create PR