The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller

Dependencies:   BufferedArray

Dependents:   NucleoMGC3130 i2c_master

MGC3130.h

Committer:
yangcq88517
Date:
2015-10-07
Revision:
1:621c4e9238ef
Parent:
0:92f17b057d6b
Child:
2:c7d984193741

File content as of revision 1:621c4e9238ef:

#ifndef UK_AC_HERTS_SMARTLAB_MGC3130
#define UK_AC_HERTS_SMARTLAB_MGC3130

#include "mbed.h"
#include "GestICMsg.h"
#include "SensorData.h"
#include "Parameter.h"
#include "TouchDetection.h"
#include "AirWheelDetection.h"
#include "ApproachDetection.h"
#include "TouchInfo.h"
#include "OutputEnable.h"

class MGC3130
{
private:
    static const int FREQUENCY_STANDARD = 100000;
    static const int FREQUENCY_FULL = 400000;
    static const int FREQUENCY_FAST = 1000000;
    static const int FREQUENCY_HIGH = 3200000;

    // EI0 Pin
    // The TS line is used to check whether the I2C data is valid and can be sent from MGC3X30 to the host controller.
    DigitalInOut TS_Line;

    I2C _i2c_bus;
    int _speed;
    int _addr;
    GestICMsg msg;
    SensorData sensor;

protected:
    GestICMsg * readMsg();

public:
    MGC3130(PinName sda, PinName scl, PinName EI0, bool IS2);

    SensorData * readSensorData();

    /*
    Structure: 16-bit Word containing dedicated values (see list below)
    Possible values:
    These error codes are sent by the Library Loader, Library Loader Updater and Library:
    0x0000 NoError OK
    0x0001 UnknownCommand Message ID is unknown
    These error codes are sent by the Library Loader:
    0x0002 InvalidSessionId Session ID is invalid or
    does not match
    (0x0 is not allowed) (message
    Fw_Update_Start,
    Fw_Update_Completed)
    0x003 InvalidCrc CRC is invalid
    thrown by messages:
    Fw_Update_Block,
    Fw_Update_Start,
    Fw_Update_Completed
    0x0004 InvalidLength Length is invalid (message
    Fw_Update_Block)
    0x0005 InvalidAddress Address is invalid (message
    Fw_Update_Block)
    0x0006 InvalidFunction Function-Id is invalid (message
    Fw_Update_Start,
    Fw_Update_Block,
    Fw_Update_Completed)
    0x0008 ContentMismatch The VerifyOnly function found a mismatch
    between content and Flash memory (message:
    Fw_Update_Block)
    0x000B WrongParameterAddr Parameter Start address, contained in the new
    Library FW to be loaded, does not match
    Library Loader assumption.
    The Library Update is therefore aborted.
    (message: Fw_Update_Start)
    These error codes are sent by the Library:
    0x0014 WrongParameterValue The value of the Argument/Parameter of a
    RuntimeParameter command is out of the valid
    range (message: Request_Message and
    Set_Runtime_Parameter)
    0x0015 UnknownParameterID The MessageID or RuntimeParameterID is
    unknown or out of the valid range (message:
    Request_Message and
    Set_Runtime_Parameter)
    0x001A WakeupHappend A wake-up by Host was detected
    These error codes are sent by the Library Loader Updater:
    0x0080 LoaderUpdateStarted The Library Loader update started
    0x0081 LoaderUpdateFinished The Library Loader update finished
    */
    int setRuntimeParameter(Parameter * para);
};

#endif