Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of LidarLite by
Diff: LidarLite.h
- Revision:
- 1:a01dc8b52be4
- Parent:
- 0:8e6304ab38d2
- Child:
- 2:917b2a1835b0
diff -r 8e6304ab38d2 -r a01dc8b52be4 LidarLite.h
--- a/LidarLite.h Tue Feb 17 12:01:04 2015 +0000
+++ b/LidarLite.h Tue Jan 26 17:55:00 2016 +0000
@@ -1,20 +1,11 @@
-/*
- * Library for easy interface of LidarLite with mbed using I2C
- *
- * Akash Vibhute <akash . roboticist [at] gmail . com>
- *
- * v0.1, 17/Feb/2015 - First version of library, tested using LPC1768 [powered via mbed 3.3v, no additional pullups on I2C necessary]
- *
- */
#ifndef LidarLite_H
#define LidarLite_H
-#include <mbed.h>
+#include "mbed.h"
// Default I2C Address of LIDAR-Lite.
-#define LIDARLite_WriteAdr 0xc4 //8-bit slave write address
-#define LIDARLite_ReadAdr 0xc5 //8-bit slave read address
+//#define LIDARLite_Adr 0x62
// Commands
#define SET_CommandReg 0x00 // Register to write to initiate ranging
@@ -24,22 +15,23 @@
#define GET_DistanceHBReg 0x0f // High byte of distance reading data
#define GET_DistanceLBReg 0x10 // Low byte of distance reading data
#define GET_Distance2BReg 0x8f // Register to get both High and Low bytes of distance reading data in 1 call
-#define GET_VelocityReg 0x09 // Velocity measutement data
-
+#define GET_VelocityReg 0x09 // Velocity measurement data
class LidarLite
{
public:
LidarLite(PinName sda, PinName scl); //Constructor
- void refreshRangeVelocity(); //refreshes range and velocity data from registers of sensor
- void refreshVelocity(); //refreshes velocity data from registers of sensor
- void refreshRange(); //refreshes range data from registers of sensor
-
+ int16_t refreshVelocity(char, char); //refreshes velocity data from registers of sensor
+ int16_t refreshRange(char, char); //refreshes range data from registers of sensor
+ void configure(int, char);
int16_t getRange_cm(); //Read distance in cm from sensor
int16_t getVelocity_cms(); //Read velocity in cm/s from sensor
+ void changeAddress(char, bool, char);
+ void changeAddressMultiPwrEn(int, DigitalOut*, char*, char);
private:
- I2C* i2c_;
+ Serial debug;
+ I2C i2c_;
int16_t distance_LL;
int16_t velocity_LL;
};
