Skip to content

Commit 7a10eff

Browse files
committed
completed API docs
1 parent b0214b7 commit 7a10eff

File tree

2 files changed

+127
-1
lines changed

2 files changed

+127
-1
lines changed

docs/api_operation.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Methods used to read data from the connected TMF882X device.
44

5-
## Message Callback Functions
5+
## Data Callback Functions
66

77
The TMF882X SDK returns data via a message structure passed to a user provided C function. This library allows the user to register callback functions that are called during the measurement operation.
88

@@ -219,3 +219,82 @@ void setErrorHandler(TMF882XErrorHandler handler)
219219
| handler | `TMF882XErrorHandler` | The message handler callback C function |
220220
221221
## Measurement Methods
222+
223+
### startMeasuring()
224+
225+
Start measuring distance/data on the TMF882X device. This method returns after one measurement is performed.
226+
227+
Measurement data is returned in the provided measurement struct.
228+
229+
```c++
230+
int startMeasuring(struct tmf882x_msg_meas_results results, uint32_t timeout = 0)
231+
```
232+
233+
| Parameter | Type | Description |
234+
| :--- | :--- | :--- |
235+
| results| `struct tmf882x_msg_meas_results` | The results of the measurement |
236+
| timeout| `uint32_t` | [OPTIONAL] The time, in milliseconds, to take measurements. A value of zero [default value] indicates no timeout set |
237+
| return value| `int` | The number of measurements taken (1), or -1 on error. |
238+
239+
### startMeasuring()
240+
241+
Start measuring distance/data on the TMF882X device. This method won't return until the measurement activity ends.
242+
243+
Measurement data is passed to the library user via a callback function, which is set using one of the set<type>Handler() methods on this object.
244+
245+
Measurements continue, until one of the following conditions occurs:
246+
247+
* The specified number of measurements took place (set via reqMeasurements)
248+
* The specified timeout value expires
249+
* The stopMeasuring() method was called in a Handler function.
250+
251+
This method won't start measuring if a measurement limit isn't set, a timeout isn't set and no callback handlers are not set.
252+
253+
This method returns the number of measurements taken
254+
255+
```c++
256+
int startMeasuring(uint32_t reqMeasurements = 0, uint32_t timeout = 0)
257+
```
258+
259+
| Parameter | Type | Description |
260+
| :--- | :--- | :--- |
261+
| reqMeasurements| `uint32_t` | [OPTIONAL] The number of measurements desired. A value of zero [the default value] indicates no limit |
262+
| timeout| `uint32_t` | [OPTIONAL] The time, in milliseconds, to take measurements. A value of zero [default value] indicates no timeout set |
263+
| return value| `int` | The number of measurements taken, or -1 on error. |
264+
265+
### stopMeasuring()
266+
267+
Called to stop the device measuring loop. Normally called in a message handler function.
268+
269+
```c++
270+
void stopMeasuring(void)
271+
```
272+
273+
| Parameter | Type | Description |
274+
| :--- | :--- | :--- |
275+
| None| | |
276+
277+
278+
### setSampleDelay()
279+
280+
Set the delay used in the libraries sample loop used when processing samples/reading from the device.
281+
282+
```c++
283+
void setSampleDelay(uint16_t delay)
284+
```
285+
286+
| Parameter | Type | Description |
287+
| :--- | :--- | :--- |
288+
| delay| `uint16_t` | The delay to use, in milli-seconds. |
289+
290+
### getSampleDelay()
291+
292+
Returns the current value of the library processing loop delay. The value is ib milliseconds..
293+
294+
```c++
295+
uint16_t getSampleDelay(void)
296+
```
297+
298+
| Parameter | Type | Description |
299+
| :--- | :--- | :--- |
300+
| return value| `uint16_t` | The current delay, in milli-seconds. |

docs/api_setup.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,53 @@ bool setTMF882XConfig(struct tmf882x_mode_app_config tofConfig)
6464
| tofConfig | `struct tmf882x_mode_app_config` | A configuration structure that has the desired settings for the device|
6565
| return value| `bool` | `true` on success, `false` on an error |
6666

67+
## Calibration
68+
69+
### factoryCalibration()
70+
71+
Used to run a factory calibration on the connected TMF882X device. The results of the calibration are returned in the passed in calibration structure.
72+
73+
Consult the TMF882X datasheet for details on performing a factory calibration
74+
75+
```c++
76+
bool factoryCalibration(struct tmf882x_mode_app_calib tofCalib);
77+
```
78+
79+
| Parameter | Type | Description |
80+
| :--- | :--- | :--- |
81+
| tofCalib | `struct tmf882x_mode_app_calib` | The results of the calibration process |
82+
| return value| `bool` | `true` on success, `false` on an error |
83+
84+
### setCalibration()
85+
86+
Used to set the calibration data on the connected TMF882X device.
87+
88+
Consult the TMF882X datasheet for details on calibration data.
89+
90+
```c++
91+
bool setCalibration(struct tmf882x_mode_app_calib tofCalib)
92+
```
93+
94+
| Parameter | Type | Description |
95+
| :--- | :--- | :--- |
96+
| tofCalib | `struct tmf882x_mode_app_calib` | The calibration data to set |
97+
| return value| `bool` | `true` on success, `false` on an error |
98+
99+
### getCalibration()
100+
101+
Used to get the calibration data on the connected TMF882X device.
102+
103+
Consult the TMF882X datasheet for details on calibration data.
104+
105+
```c++
106+
bool setCalibration(struct tmf882x_mode_app_calib tofCalib)
107+
```
108+
109+
| Parameter | Type | Description |
110+
| :--- | :--- | :--- |
111+
| tofCalib | `struct tmf882x_mode_app_calib` | The calibration data |
112+
| return value| `bool` | `true` on success, `false` on an error |
113+
67114
## SPAD Settings
68115
69116

0 commit comments

Comments
 (0)