Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
334 | f9daq | 1 | #include <utility.h> |
2 | #include <stdlib.h> |
||
3 | #include <stdio.h> |
||
4 | #include "3mts.h" |
||
5 | int main(int argc, char **argv ){ |
||
6 | unsigned short number_of_devices; |
||
7 | int device_number=0; |
||
8 | unsigned short range = 2; |
||
9 | unsigned short speed; |
||
10 | unsigned long timestamp; |
||
11 | int sensor_count; |
||
12 | TD2 values; |
||
13 | values.dimSize=100; |
||
14 | TD2 *pval= &values; |
||
15 | TD2Hdl ppval = &pval; |
||
16 | |||
17 | TD3 td3; |
||
18 | td3.dimSize=100; |
||
19 | TD3 *ptd3= &td3; |
||
20 | TD3Hdl pptd3 = &ptd3; |
||
21 | |||
22 | #define DBG(x) if (ierr= x) printf("ERR 0x%0x %s\n", ierr, #x) |
||
23 | #define DBGX(x) ierr=x;printf("ERR 0x%0x %s\n", ierr, #x) |
||
24 | int ierr=0; |
||
25 | |||
26 | DBG(count_devices(&number_of_devices)) ; |
||
27 | DBG(open_device(&device_number)); |
||
28 | DBG(set_range(&device_number,range)); |
||
29 | range =0; |
||
30 | DBG(get_range(&device_number,&range)); |
||
31 | |||
32 | speed=2; |
||
33 | DBG(set_speed(&device_number, speed)); |
||
34 | speed=0; |
||
35 | DBG(get_speed(&device_number, &speed)); |
||
36 | |||
37 | DBG(get_sensor_count(&device_number, &sensor_count)); |
||
38 | |||
39 | |||
40 | |||
41 | DBG(get_firmware_version(&device_number, pptd3)); |
||
42 | printf("Firmware version %u > %s\n", td3.dimSize, td3.elt); |
||
43 | |||
44 | DBG(get_device_name(&device_number, pptd3)); |
||
45 | printf("Device name %u > %s\n", td3.dimSize, td3.elt); |
||
46 | |||
47 | |||
48 | printf("Number of devices %d\ndevice number %d\nrange %d\nspeed %d\nsensor count %d\n", number_of_devices, device_number, range, speed, sensor_count); |
||
49 | DBG(clear_buffer(&device_number)); |
||
50 | for (int i=0; i<10;i++){ |
||
51 | DBG(get_sensor_values(&device_number, ×tamp, ppval)); |
||
52 | printf("%d B= %d Total %d uT x %d uT y %d uT z %d uT\n", timestamp, values.dimSize, values.elt[0], values.elt[1], values.elt[2], values.elt[3]); |
||
53 | Delay(1); |
||
54 | } |
||
55 | |||
56 | DBG(close_device(&device_number)); |
||
57 | Delay(10); |
||
58 | //getchar(); |
||
59 | return 0; |
||
60 | } |