-
Notifications
You must be signed in to change notification settings - Fork 2
/
HT6022.h
205 lines (186 loc) · 6.57 KB
/
HT6022.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/**
******************************************************************************
* @mainpage HT6022 Driver
* @author Rodrigo Pedroso Mendes
* @email rpm_2003_rpm@yahoo.com.br
* @file HT6022.h
* @version V1.0
* @date 04-14-2013
* @brief Here you find functions prototypes for the HT6022 driver library.
******************************************************************************
*/
/*
05/01/2018 P G Duesbury: Modified ReadData() to return raw interleaved traces
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __HT6022_H
#define __HT6022_H
/* Includes ------------------------------------------------------------------*/
#include <libusb.h>
//#include "libusb.h"
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup HT6022_Driver
* @{
*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief Device Handle
*/
typedef struct
{
libusb_device_handle *DeviceHandle;
unsigned char Address;
}HT6022_DeviceTypeDef;
/**
* @brief Error Code
*/
typedef enum
{
HT6022_SUCCESS = 0,
HT6022_LOADED = 1,
HT6022_ERROR_INVALID_PARAM = -2,
HT6022_ERROR_ACCESS = -3,
HT6022_ERROR_NO_DEVICE = -4,
HT6022_ERROR_TIMEOUT = -7,
HT6022_ERROR_NO_MEM = -11,
HT6022_ERROR_OTHER = -99
} HT6022_ErrorTypeDef;
#define IS_HT6022_ERROR(ERROR) (((ERROR) == HT6022_SUCCESS) || \
((ERROR) == HT6022_ERROR_INVALID_PARAM) || \
((ERROR) == HT6022_ERROR_ACCESS ) || \
((ERROR) == HT6022_ERROR_NO_DEVICE) || \
((ERROR) == HT6022_ERROR_TIMEOUT) || \
((ERROR) == HT6022_ERROR_NO_MEM) || \
((ERROR) == HT6022_ERROR_OTHER))
/**
* @brief Size of data bufffer
*/
typedef enum
{
HT6022_1KB = 0x00000400, /*!< 1024 Bytes */
HT6022_2KB = 0x00000800, /*!< 2048 Bytes */
HT6022_4KB = 0x00001000, /*!< 4096 Bytes */
HT6022_8KB = 0x00002000, /*!< 8192 Bytes */
HT6022_16KB = 0x00004000, /*!< 16384 Bytes */
HT6022_32KB = 0x00008000, /*!< 32768 Bytes */
HT6022_64KB = 0x00010000, /*!< 65536 Bytes */
HT6022_128KB = 0x00020000, /*!< 131072 Bytes */
HT6022_256KB = 0x00040000, /*!< 262144 Bytes */
HT6022_512KB = 0x00080000, /*!< 524288 Bytes */
HT6022_1MB = 0x00100000 /*!< 1048576 Bytes */
} HT6022_DataSizeTypeDef;
#define IS_HT6022_DATASIZE(SIZE) (((SIZE) == HT6022_1KB) ||\
((SIZE) == HT6022_2KB) ||\
((SIZE) == HT6022_4KB) ||\
((SIZE) == HT6022_8KB) ||\
((SIZE) == HT6022_16KB) ||\
((SIZE) == HT6022_32KB) ||\
((SIZE) == HT6022_64KB) ||\
((SIZE) == HT6022_128KB)||\
((SIZE) == HT6022_256KB)||\
((SIZE) == HT6022_512KB)||\
((SIZE) == HT6022_1MB))
/**
* @brief Size of calibration values buffer
*/
typedef enum
{
HT6022_32B = 0x00000010, /*!< 32 Bytes */
HT6022_64B = 0x00000020, /*!< 64 Bytes */
HT6022_128B = 0x00000080 /*!< 128 Bytes */
}HT6022_CVSizeTypeDef;
#define IS_HT6022_CVSIZE(SIZE) (((SIZE) == HT6022_32B) ||\
((SIZE) == HT6022_64B) ||\
((SIZE) == HT6022_128B))
/**
* @brief Sample rate
*/
typedef enum
{
HT6022_48MSa = 0x30, /*!< 24MSa per channel */
HT6022_16MSa = 0x10, /*!< 16MSa per channel */
HT6022_8MSa = 0x08, /*!< 8MSa per channel */
HT6022_4MSa = 0x04, /*!< 4MSa per channel */
HT6022_1MSa = 0x01, /*!< 1MSa per channel */
HT6022_500KSa = 0x32, /*!< 500KSa per channel */
HT6022_200KSa = 0x14, /*!< 200KSa per channel */
HT6022_100KSa = 0x0A /*!< 100KSa per channel */
}HT6022_SRTypeDef;
#define IS_HT6022_SR(SR) (((SR) == HT6022_48MSa) ||\
((SR) == HT6022_16MSa) ||\
((SR) == HT6022_8MSa) ||\
((SR) == HT6022_4MSa) ||\
((SR) == HT6022_1MSa) ||\
((SR) == HT6022_500KSa) ||\
((SR) == HT6022_200KSa) ||\
((SR) == HT6022_100KSa))
/**
* @brief Input range
*/
typedef enum
{
HT6022_10V = 0x01, /*!< -5V to 5V */
HT6022_5V = 0x02, /*!< -2.5V to 2.5V */
HT6022_2V = 0x05, /*!< -1V to 1V */
HT6022_1V = 0x0A, /*!< -500mv to 500mv */
}HT6022_IRTypeDef;
#define IS_HT6022_IR(IR) (((IR) == HT6022_10V) ||\
((IR) == HT6022_5V) ||\
((IR) == HT6022_2V) ||\
((IR) == HT6022_1V))
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/* Initialization and Configuration functions *********************************/
HT6022_ErrorTypeDef HT6022_Init (void);
void HT6022_Exit (void);
HT6022_ErrorTypeDef HT6022_DeviceOpen (HT6022_DeviceTypeDef *Device);
void HT6022_DeviceClose (HT6022_DeviceTypeDef *Device);
HT6022_ErrorTypeDef HT6022_FirmwareUpload (void);
/* Read functions *************************************************************/
HT6022_ErrorTypeDef HT6022_ReadData
(
HT6022_DeviceTypeDef *Device,
unsigned char* data,
HT6022_DataSizeTypeDef DataSize,
unsigned int Timeout
);
/* Read and Write calibration values functions ********************************/
HT6022_ErrorTypeDef HT6022_SetCalValues
(
HT6022_DeviceTypeDef *Device,
unsigned char* CalValues,
HT6022_CVSizeTypeDef CVSize
);
HT6022_ErrorTypeDef HT6022_GetCalValues
(
HT6022_DeviceTypeDef *Device,
unsigned char* CalValues,
HT6022_CVSizeTypeDef CVSize
);
/* Sample rate and input range configuration functions ************************/
HT6022_ErrorTypeDef HT6022_SetSR
(
HT6022_DeviceTypeDef *Device,
HT6022_SRTypeDef SR
);
HT6022_ErrorTypeDef HT6022_SetCH1IR
(
HT6022_DeviceTypeDef *Device,
HT6022_IRTypeDef IR
);
HT6022_ErrorTypeDef HT6022_SetCH2IR
(
HT6022_DeviceTypeDef *Device,
HT6022_IRTypeDef IR
);
#ifdef __cplusplus
}
#endif
#endif
/**
* @}
*/
/**********************************END OF FILE********************************/