usbPT104Api.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /**************************************************************************
  2. *
  3. * Filename: usbPT104Api.h
  4. * Author: MAS
  5. * Description:
  6. *
  7. * This header defines the interface to driver routines for the
  8. * USB PT-104 Platinum Resistance Temperature Data Logger.
  9. *
  10. * Copyright � 2009 - 2022 Pico Technology Ltd. All rights reserved.
  11. *
  12. *************************************************************************/
  13. #ifndef __USBPT104API_H__
  14. #define __USBPT104API_H__
  15. #include <stdint.h>
  16. #include "PicoStatus.h"
  17. #ifdef PREF0
  18. #undef PREF0
  19. #endif
  20. #ifdef PREF1
  21. #undef PREF1
  22. #endif
  23. #ifdef PREF2
  24. #undef PREF2
  25. #endif
  26. #ifdef PREF3
  27. #undef PREF3
  28. #endif
  29. #ifdef __cplusplus
  30. #define PREF0 extern "C"
  31. #else
  32. #define PREF0
  33. #endif
  34. #ifdef WIN32
  35. // If you are dynamically linking usbpt104.DLL into your project #define DYNLINK
  36. // somewhere in your project before here.
  37. #ifdef DYNLINK
  38. #define PREF1 typedef
  39. #define PREF2
  40. #define PREF3(x) (__stdcall *x)
  41. #else
  42. #define PREF1
  43. #ifdef _USRDLL
  44. #define PREF2 __declspec(dllexport) __stdcall
  45. #else
  46. #define PREF2 __declspec(dllimport) __stdcall
  47. #endif
  48. #define PREF3(x) x
  49. #endif
  50. #else
  51. /* Define a 64-bit integer type */
  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. #endif
  66. #define USBPT104_MIN_WIRES 2
  67. #define USBPT104_MAX_WIRES 4
  68. typedef enum enUsbPt104Channels
  69. {
  70. USBPT104_CHANNEL_1 = 1,
  71. USBPT104_CHANNEL_2,
  72. USBPT104_CHANNEL_3,
  73. USBPT104_CHANNEL_4,
  74. USBPT104_CHANNEL_5,
  75. USBPT104_CHANNEL_6,
  76. USBPT104_CHANNEL_7,
  77. USBPT104_CHANNEL_8,
  78. USBPT104_MAX_CHANNELS = USBPT104_CHANNEL_8
  79. } USBPT104_CHANNELS;
  80. typedef enum enUsbPt104DataType
  81. {
  82. USBPT104_OFF,
  83. USBPT104_PT100,
  84. USBPT104_PT1000,
  85. USBPT104_RESISTANCE_TO_375R,
  86. USBPT104_RESISTANCE_TO_10K,
  87. USBPT104_DIFFERENTIAL_TO_115MV,
  88. USBPT104_DIFFERENTIAL_TO_2500MV,
  89. USBPT104_SINGLE_ENDED_TO_115MV,
  90. USBPT104_SINGLE_ENDED_TO_2500MV,
  91. USBPT104_MAX_DATA_TYPES
  92. } USBPT104_DATA_TYPES;
  93. typedef enum enIpDetailsType
  94. {
  95. IDT_GET,
  96. IDT_SET,
  97. } IP_DETAILS_TYPE;
  98. typedef enum enCommunicationType
  99. {
  100. CT_USB = 0x00000001,
  101. CT_ETHERNET = 0x00000002,
  102. CT_ALL = 0xFFFFFFFF
  103. }COMMUNICATION_TYPE;
  104. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104Enumerate)
  105. (
  106. int8_t *details,
  107. uint32_t *length,
  108. COMMUNICATION_TYPE type
  109. );
  110. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104OpenUnit)
  111. (
  112. int16_t *handle,
  113. int8_t *serial
  114. );
  115. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104OpenUnitViaIp)
  116. (
  117. int16_t *handle,
  118. int8_t *serial,
  119. int8_t *ipAddress
  120. );
  121. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104CloseUnit)
  122. (
  123. int16_t handle
  124. );
  125. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104IpDetails)
  126. (
  127. int16_t handle,
  128. int16_t *enabled,
  129. int8_t *ipaddress,
  130. uint16_t *length,
  131. uint16_t *listeningPort,
  132. IP_DETAILS_TYPE type
  133. );
  134. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104GetUnitInfo)
  135. (
  136. int16_t handle,
  137. int8_t *string,
  138. int16_t stringLength,
  139. int16_t *requiredSize,
  140. PICO_INFO info
  141. );
  142. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104SetChannel)
  143. (
  144. int16_t handle,
  145. USBPT104_CHANNELS channel,
  146. USBPT104_DATA_TYPES type,
  147. int16_t noOfWires
  148. );
  149. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104SetMains)
  150. (
  151. int16_t handle,
  152. uint16_t sixtyHertz
  153. );
  154. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (UsbPt104GetValue)
  155. (
  156. int16_t handle,
  157. USBPT104_CHANNELS channel,
  158. int32_t *value,
  159. int16_t filtered
  160. );
  161. #endif