MIP_SDK  v3.0.0
MicroStrain Communications Library for embedded systems
data_system.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
8 
9 namespace mip::metadata
10 {
11 
12 
13 template<>
14 struct MetadataFor<data_system::BuiltInTest>
15 {
17 
18  static constexpr inline ParameterInfo parameters[] = {
19  {
20  /* .name = */ "result",
21  /* .docs = */ "Device-specific bitfield (128 bits). See device user manual.\nBits are least-significant-byte first. For example, bit 0 is\nlocated at bit 0 of result[0], bit 1 is located at bit 1 of result[0],\nbit 8 is located at bit 0 of result[1], and bit 127 is located at bit\n7 of result[15].",
22  /* .type = */ {Type::U8, nullptr},
23  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::result>,
24  /* .attributes = */ {true, false, false, false, false},
25  /* .count = */ 16,
26  /* .condition = */ {},
27  },
28  };
29 
30  static constexpr inline FieldInfo value = {
31  /* .name = */ "data_system::BuiltInTest",
32  /* .title = */ "built_in_test",
33  /* .docs = */ "Contains the continuous built-in-test (BIT) results.\n\nDue to the large size of this field, it is recommended to stream it at\na low rate or poll it on demand.\n\nThese bits are 'sticky' until the next output message. If a fault occurs\nin between scheduled messages or while the device is idle, the next\npacket with this field will have the corresponding flags set. The flag\nis then cleared unless the fault persists.\n\nUnlike the commanded BIT, some bits may be 1 in certain\nnon-fault situations, so simply checking if the result is all 0s is\nnot very useful. For example, on devices with a built-in GNSS receiver,\na 'solution fault' bit may be set before the receiver has obtained\na position fix. Consult the device manual to determine which bits are\nof interest for your application.\n\nAll unspecified bits are reserved for future use and must be ignored.\n",
34  /* .parameters = */ parameters,
35  /* .descriptor = */ type::DESCRIPTOR,
36  /* .functions = */ NO_FUNCTIONS,
37  /* .proprietary = */ false,
38  /* .response = */ nullptr,
39  };
40 };
41 
42 template<>
43 struct MetadataFor<data_system::TimeSyncStatus>
44 {
46 
47  static constexpr inline ParameterInfo parameters[] = {
48  {
49  /* .name = */ "time_sync",
50  /* .docs = */ "True if sync with the PPS signal is currently valid. False if PPS\nfeature is disabled or a PPS signal is not detected.",
51  /* .type = */ {Type::BOOL, nullptr},
52  /* .accessor = */ nullptr, //utils::access<type, bool, &type::time_sync>,
53  /* .attributes = */ {true, false, false, false, false},
54  /* .count = */ 1,
55  /* .condition = */ {},
56  },
57  {
58  /* .name = */ "last_pps_rcvd",
59  /* .docs = */ "Elapsed time in seconds since last PPS was received, with a maximum\nvalue of 255.",
60  /* .type = */ {Type::U8, nullptr},
61  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::last_pps_rcvd>,
62  /* .attributes = */ {true, false, false, false, false},
63  /* .count = */ 1,
64  /* .condition = */ {},
65  },
66  };
67 
68  static constexpr inline FieldInfo value = {
69  /* .name = */ "data_system::TimeSyncStatus",
70  /* .title = */ "time_sync_status",
71  /* .docs = */ "Indicates whether a sync has been achieved using the PPS signal.",
72  /* .parameters = */ parameters,
73  /* .descriptor = */ type::DESCRIPTOR,
74  /* .functions = */ NO_FUNCTIONS,
75  /* .proprietary = */ false,
76  /* .response = */ nullptr,
77  };
78 };
79 
80 template<>
81 struct MetadataFor<data_system::GpioState>
82 {
84 
85  static constexpr inline ParameterInfo parameters[] = {
86  {
87  /* .name = */ "states",
88  /* .docs = */ "Bitfield containing the states for each GPIO pin.<br/>\nBit 0 (0x01): pin 1<br/>\nBit 1 (0x02): pin 2<br/>\nBit 2 (0x04): pin 3<br/>\nBit 3 (0x08): pin 4<br/>\nBits for pins that don't exist will read as 0.",
89  /* .type = */ {Type::U8, nullptr},
90  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::states>,
91  /* .attributes = */ {true, false, false, false, false},
92  /* .count = */ 1,
93  /* .condition = */ {},
94  },
95  };
96 
97  static constexpr inline FieldInfo value = {
98  /* .name = */ "data_system::GpioState",
99  /* .title = */ "gpio_state",
100  /* .docs = */ "Indicates the state of all of the user GPIO pins.\n\nThis message can be used to correlate external signals\nwith the device time or other data quantities. It should\ngenerally be used with slow GPIO signals as brief pulses\nshorter than the scheduled data rate will be missed.\n\nTo synchronize with faster signals and pulses, or for more accurate timestamping,\nutilize the event system and set the GPIO feature to TIMESTAMP in the 3DM GPIO\nConfiguration command (0x0C,0x41).\n\nThese GPIO states are sampled within one base period\nof the system data descriptor set.\n\nTo obtain valid readings, the desired pin(s) must be configured to the GPIO feature\n(either input or output behavior) using the 3DM GPIO Configuration command\n(0x0C,0x41). Other gpio features may work on some devices but this is not guaranteed.\nConsult the factory before producing a design relying on reading pins configured\nto other feature types.",
101  /* .parameters = */ parameters,
102  /* .descriptor = */ type::DESCRIPTOR,
103  /* .functions = */ NO_FUNCTIONS,
104  /* .proprietary = */ false,
105  /* .response = */ nullptr,
106  };
107 };
108 
109 template<>
110 struct MetadataFor<data_system::GpioAnalogValue>
111 {
113 
114  static constexpr inline ParameterInfo parameters[] = {
115  {
116  /* .name = */ "gpio_id",
117  /* .docs = */ "GPIO pin number starting with 1.",
118  /* .type = */ {Type::U8, nullptr},
119  /* .accessor = */ nullptr, //utils::access<type, uint8_t, &type::gpio_id>,
120  /* .attributes = */ {true, false, false, false, false},
121  /* .count = */ 1,
122  /* .condition = */ {},
123  },
124  {
125  /* .name = */ "value",
126  /* .docs = */ "Value of the GPIO line in scaled volts.",
127  /* .type = */ {Type::FLOAT, nullptr},
128  /* .accessor = */ nullptr, //utils::access<type, float, &type::value>,
129  /* .attributes = */ {true, false, false, false, false},
130  /* .count = */ 1,
131  /* .condition = */ {},
132  },
133  };
134 
135  static constexpr inline FieldInfo value = {
136  /* .name = */ "data_system::GpioAnalogValue",
137  /* .title = */ "gpio_analog_value",
138  /* .docs = */ "Indicates the analog value of the given user GPIO.\nThe pin must be configured for analog input.",
139  /* .parameters = */ parameters,
140  /* .descriptor = */ type::DESCRIPTOR,
141  /* .functions = */ NO_FUNCTIONS,
142  /* .proprietary = */ false,
143  /* .response = */ nullptr,
144  };
145 };
146 
147 
148 static constexpr inline std::initializer_list<const FieldInfo*> DATA_SYSTEM = {
153 };
154 
155 
156 } // namespace mip::metadata
157 
mip::metadata
Definition: commands_3dm.hpp:9
mip::metadata::MetadataFor
Definition: mip_metadata.hpp:15
mip::metadata::MetadataFor< data_system::TimeSyncStatus >::value
static constexpr FieldInfo value
Definition: data_system.hpp:68
mip::metadata::MetadataFor< data_system::GpioAnalogValue >::value
static constexpr FieldInfo value
Definition: data_system.hpp:135
mip::metadata::ParameterInfo
Definition: mip_structures.hpp:127
mip_metadata.hpp
mip::metadata::Type::FLOAT
@ FLOAT
mip::metadata::MetadataFor< data_system::GpioState >::value
static constexpr FieldInfo value
Definition: data_system.hpp:97
mip::metadata::Type::BOOL
@ BOOL
mip::metadata::FieldInfo
Definition: mip_structures.hpp:182
mip::metadata::Type::U8
@ U8
mip::metadata::MetadataFor< data_system::BuiltInTest >::value
static constexpr FieldInfo value
Definition: data_system.hpp:30
mip::data_system::TimeSyncStatus
Definition: data_system.hpp:110
mip::data_system::BuiltInTest
Definition: data_system.hpp:73
mip::data_system::GpioAnalogValue
Definition: data_system.hpp:204
mip::data_system::GpioState
Definition: data_system.hpp:166
data_system.hpp
common.hpp