usbDrDaqApi.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. /**************************************************************************
  2. *
  3. * Filename: usbDrDaqApi.h
  4. * Author: RPM & MAS
  5. * Description:
  6. *
  7. * This header defines the interface to driver routines for the
  8. * USB DrDAQ Data Logger.
  9. *
  10. * Copyright © 2010-2018 Pico Technology Ltd. All rights reserved.
  11. *
  12. *************************************************************************/
  13. #ifndef __USBDRDAQAPI_H__
  14. #define __USBDRDAQAPI_H__
  15. #include <stdint.h>
  16. #define USB_DRDAQ_MAX_AWG_VALUE 1000
  17. #include "PicoStatus.h"
  18. #ifdef PREF0
  19. #undef PREF0
  20. #endif
  21. #ifdef PREF1
  22. #undef PREF1
  23. #endif
  24. #ifdef PREF2
  25. #undef PREF2
  26. #endif
  27. #ifdef PREF3
  28. #undef PREF3
  29. #endif
  30. #ifdef __cplusplus
  31. #define PREF0 extern "C"
  32. #else
  33. #define PREF0
  34. #endif
  35. // If you are dynamically linking usbdrdaq.dll into your project #define DYNLINK
  36. // somewhere in your project before here.
  37. #ifdef WIN32
  38. #ifdef DYNLINK
  39. #define PREF1 typedef
  40. #define PREF2
  41. #define PREF3(x) (__stdcall *x)
  42. #else
  43. #define PREF1
  44. #ifdef _USRDLL
  45. #define PREF2 __declspec(dllexport) __stdcall
  46. #else
  47. #define PREF2 __declspec(dllimport) __stdcall
  48. #endif
  49. #define PREF3(x) x
  50. #endif
  51. #else
  52. #ifdef DYNLINK
  53. #define PREF1 typedef
  54. #define PREF2
  55. #define PREF3(x) (*x)
  56. #else
  57. #ifdef _USRDLL
  58. #define PREF1 __attribute__((visibility("default")))
  59. #else
  60. #define PREF1
  61. #endif
  62. #define PREF2
  63. #define PREF3(x) x
  64. #endif
  65. #define __stdcall
  66. #endif
  67. typedef enum enUsbDrDaqInputs
  68. {
  69. USB_DRDAQ_CHANNEL_EXT1 = 1, //Ext. sensor 1
  70. USB_DRDAQ_CHANNEL_EXT2, //Ext. sensor 2
  71. USB_DRDAQ_CHANNEL_EXT3, //Ext. sensor 3
  72. USB_DRDAQ_CHANNEL_SCOPE, //Scope channel
  73. USB_DRDAQ_CHANNEL_PH, //PH
  74. USB_DRDAQ_CHANNEL_RES, //Resistance
  75. USB_DRDAQ_CHANNEL_LIGHT, //Light
  76. USB_DRDAQ_CHANNEL_TEMP, //Thermistor
  77. USB_DRDAQ_CHANNEL_MIC_WAVE, //Microphone waveform
  78. USB_DRDAQ_CHANNEL_MIC_LEVEL, //Microphone level
  79. USB_DRDAQ_MAX_CHANNELS = USB_DRDAQ_CHANNEL_MIC_LEVEL
  80. } USB_DRDAQ_INPUTS;
  81. typedef enum enUsbDrDaqScopeRange
  82. {
  83. USB_DRDAQ_1V25,
  84. USB_DRDAQ_2V5,
  85. USB_DRDAQ_5V,
  86. USB_DRDAQ_10V
  87. }USB_DRDAQ_SCOPE_RANGE;
  88. typedef enum enUsbDrDaqWave
  89. {
  90. USB_DRDAQ_SINE,
  91. USB_DRDAQ_SQUARE,
  92. USB_DRDAQ_TRIANGLE,
  93. USB_DRDAQ_RAMP_UP,
  94. USB_DRDAQ_RAMP_DOWN,
  95. USB_DRDAQ_DC
  96. }USB_DRDAQ_WAVE;
  97. typedef enum enUsbDrDaqDO
  98. {
  99. USB_DRDAQ_GPIO_1 = 1,
  100. USB_DRDAQ_GPIO_2,
  101. USB_DRDAQ_GPIO_3,
  102. USB_DRDAQ_GPIO_4
  103. }USB_DRDAQ_GPIO;
  104. typedef enum enUSBDrDAQInfo
  105. {
  106. USBDrDAQ_DRIVER_VERSION,
  107. USBDrDAQ_USB_VERSION,
  108. USBDrDAQ_HARDWARE_VERSION,
  109. USBDrDAQ_VARIANT_INFO,
  110. USBDrDAQ_BATCH_AND_SERIAL,
  111. USBDrDAQ_CAL_DATE,
  112. USBDrDAQ_KERNEL_DRIVER_VERSION,
  113. USBDrDAQ_ERROR,
  114. USBDrDAQ_SETTINGS,
  115. USBDrDAQ_FIRMWARE_VERSION,
  116. USBDrDAQ_DRIVER_PATH = 14
  117. } USBDrDAQ_INFO;
  118. #ifndef BM_DEFINED
  119. #define BM_DEFINED
  120. typedef enum _BLOCK_METHOD{BM_SINGLE, BM_WINDOW, BM_STREAM} BLOCK_METHOD;
  121. #endif
  122. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqOpenUnit)
  123. (
  124. int16_t *handle
  125. );
  126. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqCloseUnit)
  127. (
  128. int16_t handle
  129. );
  130. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetUnitInfo)
  131. (
  132. int16_t handle,
  133. int8_t *string,
  134. int16_t stringLength,
  135. int16_t *requiredSize,
  136. PICO_INFO info
  137. );
  138. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqRun)
  139. (
  140. int16_t handle,
  141. uint32_t no_of_values,
  142. BLOCK_METHOD method
  143. );
  144. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqReady)
  145. (
  146. int16_t handle,
  147. int16_t *ready
  148. );
  149. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqStop)
  150. (
  151. int16_t handle
  152. );
  153. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetInterval)
  154. (
  155. int16_t handle,
  156. uint32_t *us_for_block,
  157. uint32_t ideal_no_of_samples,
  158. USB_DRDAQ_INPUTS *channels,
  159. int16_t no_of_channels
  160. );
  161. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetIntervalF)
  162. (
  163. int16_t handle,
  164. float * us_for_block,
  165. uint32_t ideal_no_of_samples,
  166. USB_DRDAQ_INPUTS *channels,
  167. int16_t no_of_channels
  168. );
  169. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetTrigger)
  170. (
  171. int16_t handle,
  172. uint16_t enabled,
  173. uint16_t auto_trigger,
  174. uint16_t auto_ms,
  175. uint16_t channel,
  176. uint16_t dir,
  177. int16_t threshold,
  178. uint16_t hysterisis,
  179. float delay
  180. );
  181. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetValues)
  182. (
  183. int16_t handle,
  184. int16_t *values,
  185. uint32_t *noOfValues,
  186. uint16_t *overflow,
  187. uint32_t *triggerIndex
  188. );
  189. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetValuesF)
  190. (
  191. int16_t handle,
  192. float *values,
  193. uint32_t *noOfValues,
  194. uint16_t *overflow,
  195. uint32_t *triggerIndex
  196. );
  197. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetTriggerTimeOffsetNs)
  198. (
  199. int16_t handle,
  200. int64_t *time
  201. );
  202. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetSingle)
  203. (
  204. int16_t handle,
  205. USB_DRDAQ_INPUTS channel,
  206. int16_t *value,
  207. uint16_t *overflow
  208. );
  209. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetSingleF)
  210. (
  211. int16_t handle,
  212. USB_DRDAQ_INPUTS channel,
  213. float *value,
  214. uint16_t *overflow
  215. );
  216. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqOpenUnitAsync)
  217. (
  218. int16_t *status
  219. );
  220. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqOpenUnitProgress)
  221. (
  222. int16_t *handle,
  223. int16_t *progress,
  224. int16_t *complete
  225. );
  226. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetScalings)
  227. (
  228. int16_t handle,
  229. USB_DRDAQ_INPUTS channel,
  230. int16_t *nScales,
  231. int16_t *currentScale,
  232. int8_t *names,
  233. int16_t namesSize
  234. );
  235. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetScalings)
  236. (
  237. int16_t handle,
  238. USB_DRDAQ_INPUTS channel,
  239. int16_t scalingNumber
  240. );
  241. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetSigGenBuiltIn)
  242. (
  243. int16_t handle,
  244. int32_t offsetVoltage,
  245. uint32_t pkToPk,
  246. int16_t frequency,
  247. USB_DRDAQ_WAVE waveType
  248. );
  249. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetSigGenArbitrary)
  250. (
  251. int16_t handle,
  252. int32_t offsetVoltage,
  253. uint32_t pkToPk,
  254. int16_t *arbitraryWaveform,
  255. int16_t arbitraryWaveformSize,
  256. int32_t updateRate
  257. );
  258. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqStopSigGen)
  259. (
  260. int16_t handle
  261. );
  262. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetDO)
  263. (
  264. int16_t handle,
  265. USB_DRDAQ_GPIO IOChannel,
  266. int16_t value
  267. );
  268. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetPWM)
  269. (
  270. int16_t handle,
  271. USB_DRDAQ_GPIO IOChannel,
  272. uint16_t period,
  273. uint8_t cycle
  274. );
  275. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetInput)
  276. (
  277. int16_t handle,
  278. USB_DRDAQ_GPIO IOChannel,
  279. int16_t pullUp,
  280. int16_t *value
  281. );
  282. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqStartPulseCount)
  283. (
  284. int16_t handle,
  285. USB_DRDAQ_GPIO IOChannel,
  286. int16_t direction
  287. );
  288. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetPulseCount)
  289. (
  290. int16_t handle,
  291. USB_DRDAQ_GPIO IOChannel,
  292. int16_t *count
  293. );
  294. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqEnableRGBLED)
  295. (
  296. int16_t handle,
  297. int16_t enabled
  298. );
  299. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqSetRGBLED)
  300. (
  301. int16_t handle,
  302. uint16_t red,
  303. uint16_t green,
  304. uint16_t blue
  305. );
  306. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqGetChannelInfo)
  307. (
  308. int16_t handle,
  309. float *min,
  310. float *max,
  311. int16_t *places,
  312. int16_t *divider,
  313. USB_DRDAQ_INPUTS channel
  314. );
  315. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbDrDaqPingUnit) (int16_t handle);
  316. PREF0 PREF1 PICO_STATUS PREF2 PREF3(UsbDrDaqPhTemperatureCompensation)
  317. (
  318. int16_t handle,
  319. uint16_t enabled
  320. );
  321. #endif