MRPT  1.9.9
xssyncsetting.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #ifndef XSSYNCSETTINGS_H
10 #define XSSYNCSETTINGS_H
11 
12 #include "pstdint.h"
13 #include "xssyncfunction.h"
14 #include "xssyncline.h"
15 #include "xssyncpolarity.h"
16 #include "xstypesconfig.h"
17 
18 struct XsSyncSetting;
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #else
24 #define XSSYNCSETTINGS_INITIALIZER \
25  { \
26  XSL_Invalid, XSF_Invalid, XSP_None, 1, 0, 0, 0, 0, 0 \
27  }
28 #endif
29 
31  const struct XsSyncSetting* thisPtr);
33  const struct XsSyncSetting* thisPtr);
35  struct XsSyncSetting* a, struct XsSyncSetting* b);
36 
37 #ifdef __cplusplus
38 } // extern "C"
39 #endif
40 
41 /*! \brief A structure for storing all xsens sync settings */
43 {
44  XsSyncLine m_line; /*!< The sync lines enabled. \see XsSyncLine. */
45  XsSyncFunction m_function; /*!< The action to be performed, when an input
46  sync line changes \see XsSyncFunction. */
47  XsSyncPolarity m_polarity; /*!< The edge on which the action is performed,
48  \see XsSyncPolarity. */
49  uint32_t m_pulseWidth; /*!< The time to keep the line polarity before
50  toggling back, in microseconds. */
51  int32_t m_offset; /*!< The time between reception of a line change and the
52  execution of the sync action, in microseconds. */
53  uint16_t m_skipFirst; /*!< The number of frames to skip before executing the
54  action. */
55  uint16_t
56  m_skipFactor; /*!< The number of frames to skip between 2 actions. */
57  uint16_t m_clockPeriod; /*!< The frequency of the external clock in
58  milliseconds, only valid when action is
59  STE_ResetTimer. */
60  uint8_t
61  m_triggerOnce; /*!< Whether the action is repeated for each frame. */
62 
63 #ifdef __cplusplus
64  //! \brief Default constructor, initializes to the given (default) settings
65  explicit XsSyncSetting(
67  XsSyncPolarity polarity = XSP_RisingEdge, uint32_t pulseWidth = 1000,
68  int32_t offset = 0, uint16_t skipFirst = 0, uint16_t skipFactor = 0,
69  uint16_t clockPeriod = 0, uint8_t triggerOnce = 0)
70  : m_line(line),
71  m_function(function),
72  m_polarity(polarity),
73  m_pulseWidth(pulseWidth),
75  m_skipFirst(skipFirst),
76  m_skipFactor(skipFactor),
77  m_clockPeriod(clockPeriod),
78  m_triggerOnce(triggerOnce)
79  {
80  }
81 
82  //! \brief Construct a XsSyncSetting as a copy of \a other.
83  XsSyncSetting(const XsSyncSetting& other)
84  {
85  memcpy(this, &other, sizeof(XsSyncSetting));
86  }
87 
88  //! \brief Copy values of \a other into this.
89  const XsSyncSetting& operator=(const XsSyncSetting& other)
90  {
91  if (this != &other) memcpy(this, &other, sizeof(XsSyncSetting));
92  return *this;
93  }
94 
95  //! \brief \copybrief XsSyncSetting_isInput
96  inline bool isInput() const { return 0 != XsSyncSetting_isInput(this); }
97  //! \brief \copybrief XsSyncSetting_isOutput
98  inline bool isOutput() const { return 0 != XsSyncSetting_isOutput(this); }
99  /*! \brief Swap the contents with \a other
100  */
101  inline void swap(XsSyncSetting& other) { XsSyncSetting_swap(this, &other); }
102  /*! \brief Return true if \a other is identical to this
103  */
104  inline bool operator==(const XsSyncSetting& other) const
105  {
106  return (this == &other) ||
107  (m_line == other.m_line && m_function == other.m_function &&
108  m_polarity == other.m_polarity &&
109  m_pulseWidth == other.m_pulseWidth &&
110  m_offset == other.m_offset &&
111  m_skipFirst == other.m_skipFirst &&
112  m_skipFactor == other.m_skipFactor &&
113  m_clockPeriod == other.m_clockPeriod &&
114  m_triggerOnce == other.m_triggerOnce);
115  }
116 #endif
117 };
118 
120 
121 #endif // file guard
uint8_t m_triggerOnce
Definition: xssyncsetting.h:61
unsigned __int16 uint16_t
Definition: rptypes.h:47
XSTYPES_DLL_API int XsSyncSetting_isOutput(const struct XsSyncSetting *thisPtr)
uint16_t m_skipFirst
Definition: xssyncsetting.h:53
GLintptr offset
Definition: glext.h:3936
React to a rising edge on input.
A structure for storing all xsens sync settings.
Definition: xssyncsetting.h:42
unsigned char uint8_t
Definition: rptypes.h:44
uint16_t m_clockPeriod
Definition: xssyncsetting.h:57
GLubyte GLubyte b
Definition: glext.h:6372
struct XsSyncSetting XsSyncSetting
XsSyncPolarity
Signal polarity.
XsSyncFunction m_function
Definition: xssyncsetting.h:45
XsSyncLine m_line
Definition: xssyncsetting.h:44
bool operator==(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
Definition: TCamera.cpp:202
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
__int32 int32_t
Definition: rptypes.h:49
int32_t m_offset
Definition: xssyncsetting.h:51
Invalid action.
XsSyncFunction
Actions to be taken on input triggers.
uint32_t m_pulseWidth
Definition: xssyncsetting.h:49
unsigned __int32 uint32_t
Definition: rptypes.h:50
XSTYPES_DLL_API int XsSyncSetting_isInput(const struct XsSyncSetting *thisPtr)
XsSyncLine
Synchronization line identifiers.
Definition: xssyncline.h:16
GLubyte GLubyte GLubyte a
Definition: glext.h:6372
XsSyncPolarity m_polarity
Definition: xssyncsetting.h:47
void memcpy(void *dest, size_t destSize, const void *src, size_t copyCount) noexcept
An OS and compiler independent version of "memcpy".
Definition: os.cpp:358
XSTYPES_DLL_API void XsSyncSetting_swap(struct XsSyncSetting *a, struct XsSyncSetting *b)
uint16_t m_skipFactor
Definition: xssyncsetting.h:56



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019