The MGC3130 is the world’s first electrical-field (E-field) based three-dimensional (3D) tracking and gesture controller
Dependents: NucleoMGC3130 i2c_master
Diff: MGC3130.h
- Revision:
- 2:c7d984193741
- Parent:
- 1:621c4e9238ef
- Child:
- 3:b657bfcffc0a
--- a/MGC3130.h Wed Oct 07 20:43:39 2015 +0000 +++ b/MGC3130.h Thu Oct 08 11:14:18 2015 +0000 @@ -11,6 +11,9 @@ #include "TouchInfo.h" #include "OutputEnable.h" +/** +* Outlines the function of the Library’s I2C message interface, and contains the complete message reference to control and operate the MGC3X30 system. +*/ class MGC3130 { private: @@ -19,8 +22,7 @@ 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. + /// 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; @@ -33,56 +35,50 @@ GestICMsg * readMsg(); public: + /** Construct a message with existing @GestICMsg as its base. + * IS2 is available for address selection and enables the user to connect up to two MGC3X30 devices on the same bus without address conflict. + * The MGC3X30 I2C addresses are 0x42 and 0x43. They are given as device addresses without the R/W bit. + * In addition, MGC3X30 requires a dedicated transfer status line (TS), which features a + * data transfer status function. The TS is used by both I2C Master and Slave to control + * the data flow. I2C SCL, I2C SDA and TS lines require an open-drain connection on + * MGC3X30 and the connected host controller. To function properly, I2C SCL and I2C + * SDA need to be pulled up to VCC with 1.8 kΩ resistors and the TS line needs to be + * pulled up to VCC with a 10 kΩ resistor. + * + * @param sda I2C sda signal + * @param scl I2C scl signal + * @param ET0 + * @param IS2 High->true, Low->false + * + */ MGC3130(PinName sda, PinName scl, PinName EI0, bool IS2); + /** Get a sensor data payload from the device, will block if the device is busy. + * + * @returns @SensorData NULL means data not avaliable + * + */ 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 + /** Set the system runtime parameters. + * + * @param para @Parameter and any RuntimeParameter classes + * + * @returns + *0x0000 NoError OK + *0x0001 UnknownCommand Message ID is unknown + *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) + *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 + *0x0080 LoaderUpdateStarted The Library Loader update started + *0x0081 LoaderUpdateFinished The Library Loader update finished */ int setRuntimeParameter(Parameter * para); };