library for m3Dpi robot, based on the Pololu 3pi and m3pi. m3Dpi has multiple distance sensors, gyroscope, compass and accelerometer sensor to be fully aware of its environment. With the addition of xbee or nrf24n01 module it has wireless communication capabilities.

Dependencies:   m3pi ADXL345_I2C HMC5583L ITG3200 PCA9547 TLC59116 VL6180x RGB-fun xbee

Dependents:   m3Dpi-helloworld

lib/vl6180xManager.h

Committer:
sillevl
Date:
2016-01-20
Revision:
12:4cb092df6958
Parent:
10:4200a8140b10

File content as of revision 12:4cb092df6958:

#pragma once

#include "mbed.h"
#include "PCA9547.h"
#include "vl6180x.h"
#include "datatypes.h"

/*enum DistanceSensor{
    FRONT,
    FRONT_RIGHT,
    RIGHT,
    BACK_RIGHT,
    BACK,
    BACK_LEFT,
    LEFT,
    FRONT_LEFT
}; */

class VL6180xManager
{
public:
    VL6180xManager(I2C &i2c);
    VL6180xManager(PinName sda, PinName scl);
    void select(int index);
    m3dpi::Distance getAllDistance();
    int getDistance(int index);

protected:

/*    enum DistanceSensor {
        FRONT,
        FRONT_RIGHT,
        RIGHT,
        BACK_RIGHT,
        BACK,
        BACK_LEFT,
        LEFT,
        FRONT_LEFT
    };*/
    
    void initialize();
    PCA9547 mux;
    I2C i2c;
    int address;
    VL6180x sensor;

    static const int SENSOR_COUNT = 8;
    static const int VL6180X_ADDRESS = 0x52;
};