Skyward boardcore
Loading...
Searching...
No Matches
VN100SpiDefs.h
Go to the documentation of this file.
1/* Copyright (c) 2024 Skyward Experimental Rocketry
2 * Author: Fabrizio Monti
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#pragma once
24
25namespace Boardcore
26{
27
28namespace VN100SpiDefs
29{
30
34enum Registers : uint8_t
35{
39 REG_SYNC = 32,
41};
42
46enum Commands : uint8_t
47{
50};
51
72
77struct __attribute__((packed)) SynchronizationData
78{
79 uint8_t syncInMode;
80 uint8_t syncInEdge;
81 uint16_t syncInSkipFactor;
84 const uint32_t RESERVED = 0;
85 uint8_t syncOutMode;
86 uint8_t syncOutPolarity;
88 uint16_t syncOutSkipFactor;
91 uint32_t
92 syncOutPulseWidth;
93 const uint32_t RESERVED2 = 0;
94};
95
100struct __attribute__((packed)) RawImuQuatData
101{
102 float quatX;
103 float quatY;
104 float quatZ;
105 float quatW;
106 float magX;
107 float magY;
108 float magZ;
109 float accX;
110 float accY;
111 float accZ;
112 float gyrX;
113 float gyrY;
114 float gyrZ;
115};
116
121struct __attribute__((packed)) RawTempPressData
122{
123 float magX;
124 float magY;
125 float magZ;
126 float accX;
127 float accY;
128 float accZ;
129 float gyrX;
130 float gyrY;
131 float gyrZ;
132 float temp;
133 float press;
134};
135
139const char* const MODEL_NUMBER = "VN-100";
140
145const int MODEL_NUMBER_SIZE = 24;
146
151const uint32_t SYNC_OUT_PULSE_WIDTH = 1000000;
152
153} // namespace VN100SpiDefs
154
155} // namespace Boardcore
const char *const MODEL_NUMBER
The expected model number to be red from the sensor.
Registers
Internal registers definitions.
@ REG_MODEL_NUMBER
WhoAmI register.
@ REG_SYNC
Used to set data ready interrupt.
@ REG_TEMP_PRESS_DATA
Temperature and pressure data register.
const int MODEL_NUMBER_SIZE
Size of the buffer used to retrieve the model number from the sensor. It corresponds to the size of t...
struct __attribute__((packed)) SynchronizationData
Data format of the synchronization control register, used for read and write operations.
VNErrors
Error codes of the sensor.
const uint32_t SYNC_OUT_PULSE_WIDTH
Width of the SyncOut pulse in nanoseconds. Now is set to 1 millisecond.
Commands
Commands available for the sensor.
This file includes all the types the logdecoder script will decode.