Blame |
Last modification |
View Log
| RSS feed
#include <utility.h>
#include <stdlib.h>
#include <stdio.h>
#include "3mts.h"
int main
(int argc
, char **argv
){
unsigned short number_of_devices
;
int device_number
=0;
unsigned short range
= 2;
unsigned short speed
;
unsigned long timestamp
;
int sensor_count
;
TD2 values
;
values.
dimSize=100;
TD2
*pval
= &values
;
TD2Hdl ppval
= &pval
;
TD3 td3
;
td3.
dimSize=100;
TD3
*ptd3
= &td3
;
TD3Hdl pptd3
= &ptd3
;
#define DBG(x) if (ierr= x) printf("ERR 0x%0x %s\n", ierr, #x)
#define DBGX(x) ierr=x;printf("ERR 0x%0x %s\n", ierr, #x)
int ierr
=0;
DBG
(count_devices
(&number_of_devices
)) ;
DBG
(open_device
(&device_number
));
DBG
(set_range
(&device_number
,range
));
range
=0;
DBG
(get_range
(&device_number
,&range
));
speed
=2;
DBG
(set_speed
(&device_number
, speed
));
speed
=0;
DBG
(get_speed
(&device_number
, &speed
));
DBG
(get_sensor_count
(&device_number
, &sensor_count
));
DBG
(get_firmware_version
(&device_number
, pptd3
));
printf("Firmware version %u > %s\n", td3.
dimSize, td3.
elt);
DBG
(get_device_name
(&device_number
, pptd3
));
printf("Device name %u > %s\n", td3.
dimSize, td3.
elt);
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
);
DBG
(clear_buffer
(&device_number
));
for (int i
=0; i
<10;i
++){
DBG
(get_sensor_values
(&device_number
, ×tamp
, ppval
));
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]);
Delay
(1);
}
DBG
(close_device
(&device_number
));
Delay
(10);
//getchar();
return 0;
}