pl1000Api.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /**************************************************************************
  2. *
  3. * Filename: pl1000Api.h
  4. * Author: MB & MAS
  5. * Description:
  6. *
  7. * This header defines the interface to driver routines for the
  8. * PicoLog 1000 Series Data Loggers.
  9. *
  10. * Copyright © 2009-2018 Pico Technology Ltd. All rights reserved.
  11. *
  12. *************************************************************************/
  13. #ifndef __PL1000API_H__
  14. #define __PL1000API_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 pl1000.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. #define PREF4 __stdcall
  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 PREF4
  66. #endif
  67. typedef enum enPL1000Inputs
  68. {
  69. PL1000_CHANNEL_1 = 1,
  70. PL1000_CHANNEL_2,
  71. PL1000_CHANNEL_3,
  72. PL1000_CHANNEL_4,
  73. PL1000_CHANNEL_5,
  74. PL1000_CHANNEL_6,
  75. PL1000_CHANNEL_7,
  76. PL1000_CHANNEL_8,
  77. PL1000_CHANNEL_9,
  78. PL1000_CHANNEL_10,
  79. PL1000_CHANNEL_11,
  80. PL1000_CHANNEL_12,
  81. PL1000_CHANNEL_13,
  82. PL1000_CHANNEL_14,
  83. PL1000_CHANNEL_15,
  84. PL1000_CHANNEL_16,
  85. PL1000_MAX_CHANNELS = PL1000_CHANNEL_16
  86. } PL1000_INPUTS;
  87. typedef enum enPL1000DO_Channel
  88. {
  89. PL1000_DO_CHANNEL_0,
  90. PL1000_DO_CHANNEL_1,
  91. PL1000_DO_CHANNEL_2,
  92. PL1000_DO_CHANNEL_3,
  93. PL1000_DO_CHANNEL_MAX
  94. } PL1000_DO_CH;
  95. typedef enum enPL1000OpenProgress
  96. {
  97. PL1000_OPEN_PROGRESS_FAIL = -1,
  98. PL1000_OPEN_PROGRESS_PENDING = 0,
  99. PL1000_OPEN_PROGRESS_COMPLETE = 1
  100. } PL1000_OPEN_PROGRESS;
  101. #define PL1000_MIN_PERIOD 100
  102. #define PL1000_MAX_PERIOD 1800
  103. #ifndef BM_DEFINED
  104. #define BM_DEFINED
  105. typedef enum _BLOCK_METHOD{BM_SINGLE, BM_WINDOW, BM_STREAM} BLOCK_METHOD;
  106. #endif
  107. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000OpenUnit) (int16_t * handle);
  108. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000CloseUnit) (int16_t handle);
  109. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000GetUnitInfo)
  110. (int16_t handle, int8_t * string, int16_t stringLength, int16_t * requiredSize, PICO_INFO info);
  111. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000SetDo) (int16_t handle, int16_t do_value, int16_t doNo);
  112. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000SetPulseWidth) (int16_t handle, uint16_t period, uint8_t cycle);
  113. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000Run) (int16_t handle, uint32_t no_of_values, BLOCK_METHOD method);
  114. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000Ready) (int16_t handle, int16_t * ready);
  115. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000Stop) (int16_t handle);
  116. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000MaxValue) (int16_t handle, uint16_t *maxValue);
  117. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000SetInterval)
  118. (int16_t handle, uint32_t * us_for_block, uint32_t ideal_no_of_samples, int16_t * channels,int16_t no_of_channels);
  119. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000SetTrigger)
  120. (int16_t handle, uint16_t enabled, uint16_t auto_trigger, uint16_t auto_ms, uint16_t channel, uint16_t dir, uint16_t threshold, uint16_t hysterisis, float delay);
  121. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000GetValues)
  122. (int16_t handle, uint16_t * values, uint32_t * noOfValues, uint16_t * overflow, uint32_t * triggerIndex);
  123. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000GetTriggerTimeOffsetNs) (int16_t handle, int64_t * time);
  124. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000GetSingle) (int16_t handle, PL1000_INPUTS channel, uint16_t *value);
  125. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000OpenUnitAsync) (int16_t * status);
  126. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000OpenUnitProgress) (int16_t * handle, int16_t * progress, int16_t * complete);
  127. PREF0 PREF1 PICO_STATUS PREF2 PREF3 (pl1000PingUnit) (int16_t handle);
  128. #endif