|
| 1 | +# Device Operations |
| 2 | + |
| 3 | +Methods to setup the device, get device information and change device options. |
| 4 | + |
| 5 | +## Initialization |
| 6 | + |
| 7 | +### begin() |
| 8 | +This method is called to initialize the TMF882X library and connect to the TMF882X device. This method should be called before accessing the device. |
| 9 | + |
| 10 | +The I2C address of the is an optional argument. If not provided, the default address is used. |
| 11 | + |
| 12 | +During the initialization process, the device is opened and the runtime firmware loaded onto the device. The TMF882X device is them placed into "APP" mode. |
| 13 | + |
| 14 | +```c++ |
| 15 | +bool begin(TwoWire &wirePort, uint8_t address) |
| 16 | +``` |
| 17 | +
|
| 18 | +| Parameter | Type | Description | |
| 19 | +| :------------ | :---------- | :---------------------------------------------- | |
| 20 | +| `wirePort` | `TwoWire` | **optional**. The Wire port. If not provided, the default port is used| |
| 21 | +| `address` | `uint8_t` | **optional**. I2C Address. If not provided, the default address is used| |
| 22 | +| return value | `bool` | ```true``` on success, ```false``` on startup failure | |
| 23 | +
|
| 24 | +### loadFirmware() |
| 25 | +To operate the TMF882X device, runtime firmware must be loaded. At startup, this library loads a default firmware version on library initialization. |
| 26 | +
|
| 27 | +This method allows the library user to set the firmware version on the device if a newer version is available from AMS. |
| 28 | +
|
| 29 | +```C++ |
| 30 | +bool loadFirmware(const unsigned char *firmwareBinImage, unsigned long length) |
| 31 | +``` |
| 32 | + |
| 33 | +| Parameter | Type | Description | |
| 34 | +| :------------ | :---------- | :---------------------------------------------- | |
| 35 | +| `firmwareBinImage` | `const unsigned char` | The firmware binary image | |
| 36 | +| `length` | `unsigned long` | The length of the image array | |
| 37 | +| return value | `bool` | ```true``` on success, ```false``` on failure | |
| 38 | + |
| 39 | +### isConnected() |
| 40 | +Called to determine if a TMF882X device, at the provided i2c address is connected. |
| 41 | + |
| 42 | +```C++ |
| 43 | +bool isConnected() |
| 44 | +``` |
| 45 | + |
| 46 | +| Parameter | Type | Description | |
| 47 | +| :------------ | :---------- | :---------------------------------------------- | |
| 48 | +| return value | `bool` | ```true``` if connected, ```false``` if not | |
| 49 | + |
| 50 | +### setI2CAddress() |
| 51 | +Called to change the I2C address of the connected device. |
| 52 | + |
| 53 | +```C++ |
| 54 | +bool setI2CAddress(uint8_t address) |
| 55 | +``` |
| 56 | +
|
| 57 | +| Parameter | Type | Description | |
| 58 | +| :------------ | :---------- | :---------------------------------------------- | |
| 59 | +| return value | `bool` | ```true``` on success, ```false``` on failure | |
| 60 | +
|
| 61 | +### getApplicationVersion() |
| 62 | +Returns the version of the "Application" software running on the connected TMF882X device. See the TMF882X data sheet for more information regarding application software |
| 63 | +
|
| 64 | +```C++ |
| 65 | +bool getApplicationVersion(char *Version, uint8_t vlen) |
| 66 | +``` |
| 67 | + |
| 68 | +| Parameter | Type | Description | |
| 69 | +| :------------ | :---------- | :---------------------------------------------- | |
| 70 | +| `Version` | `char*` | Pointer to a character array to receive the version data | |
| 71 | +| `vlen` | `uint8_t` | The length of the array pointed to by Version | |
| 72 | +| return value | `bool` | ```true``` on success, ```false``` on failure | |
| 73 | + |
| 74 | +### getDeviceUniqueID() |
| 75 | +Returns the unique ID of the connected TMF882X. |
| 76 | + |
| 77 | +!!! note |
| 78 | + This method uses a ID structure as defined by the AMS TMF882X SDK to |
| 79 | + store the ID value. |
| 80 | + |
| 81 | +```C++ |
| 82 | +bool getDeviceUniqueID(struct tmf882x_mode_app_dev_UID &devUID) |
| 83 | +``` |
| 84 | +
|
| 85 | +| Parameter | Type | Description | |
| 86 | +| :------------ | :---------- | :---------------------------------------------- | |
| 87 | +| `deviceUID` | `struct tmf882x_mode_app_dev_UID` | The TMF882X UID structure to store the ID into. | |
| 88 | +| return value | `bool` | ```true``` on success, ```false``` on failure | |
| 89 | +
|
| 90 | +
|
| 91 | +## Debug and Development |
| 92 | +
|
| 93 | +### setDebug() |
| 94 | +Set the debug state fo the SDK. To use the full debug capabilities of the SDK, debug should be enabled before calling init/begin() on the library |
| 95 | +
|
| 96 | +```C++ |
| 97 | +void setDebug(bool bEnable) |
| 98 | +``` |
| 99 | + |
| 100 | +| Parameter | Type | Description | |
| 101 | +| :------------ | :---------- | :---------------------------------------------- | |
| 102 | +| `bEnable` | `bool` | To enable or disable debug mode in the SDK| |
| 103 | + |
| 104 | +### getDebug() |
| 105 | +Returns the current debug setting of the library |
| 106 | + |
| 107 | +```C++ |
| 108 | +bool getDebug(void) |
| 109 | +``` |
| 110 | +
|
| 111 | +| Parameter | Type | Description | |
| 112 | +| :------------ | :---------- | :---------------------------------------------- | |
| 113 | +| return value | `bool` | ```true``` Debug mode enabled, ```false``` Debug Mode disabled | |
| 114 | +
|
| 115 | +### setInfoMessages() |
| 116 | +Enable/Disable the output of info messages from the AMS SDK. |
| 117 | +
|
| 118 | +```C++ |
| 119 | +void setInfoMessages(bool bEnable) |
| 120 | +``` |
| 121 | + |
| 122 | +| Parameter | Type | Description | |
| 123 | +| :------------ | :---------- | :---------------------------------------------- | |
| 124 | +| `bEnable` | `bool` | To enable or disable info message output from the SDK| |
| 125 | + |
| 126 | +### setMessageLevel() |
| 127 | +Used to set the message level of the system. |
| 128 | + |
| 129 | +The value passed in should be one, or a combination of the following flags. |
| 130 | + |
| 131 | +| FLAG | Description | |
| 132 | +| :------------ | :---------- | |
| 133 | +| TMF882X_MSG_INFO | Output Info messages| |
| 134 | +| TMF882X_MSG_DEBUG | Output Debug messages| |
| 135 | +| TMF882X_MSG_ERROR | Output Error messages| |
| 136 | +| TMF882X_MSG_ALL | Output all messages| |
| 137 | +| TMF882X_MSG_NONE | Disable all message output the output of info messages from the AMS SDK.| |
| 138 | + |
| 139 | +```C++ |
| 140 | +void setMessageLevel(uint8_t msg) |
| 141 | +``` |
| 142 | +
|
| 143 | +| Parameter | Type | Description | |
| 144 | +| :------------ | :---------- | :---------------------------------------------- | |
| 145 | +| `msg` | `uint8_t` | Message type flag(s)| |
| 146 | +
|
| 147 | +### getMessageLevel() |
| 148 | +Return the current message settings. See setMessageLevel() description for possible values |
| 149 | +
|
| 150 | +```C++ |
| 151 | +uint8_t getMessageLevel(void) |
| 152 | +``` |
| 153 | + |
| 154 | +| Parameter | Type | Description | |
| 155 | +| :------------ | :---------- | :---------------------------------------------- | |
| 156 | +| return value | `uint8_t` | The current message level settings| |
0 commit comments