PER Firmware
Loading...
Searching...
No Matches
nav_relposned.h
Go to the documentation of this file.
1
10#ifndef NAV_RELPOSNED_H
11#define NAV_RELPOSNED_H
12
13#include "ubx_common.h"
14#include <string.h>
15
17 .sync_word = {UBX_SYNC_B0, UBX_SYNC_B1},
18 .message_class = 0x01,
19 .message_id = 0x3C,
20 .payload_length = 64
21};
22
24
41
42typedef struct {
43 uint8_t version;
44 uint8_t reserved0;
45 uint16_t refStationId;
46 uint32_t iTOW;
47
48 int32_t relPosN;
49 int32_t relPosE;
50 int32_t relPosD;
51 int32_t relPosLength;
53 uint8_t reserved1[4];
54
55 int8_t relPosHPN;
56 int8_t relPosHPE;
57 int8_t relPosHPD;
59
60 uint32_t accN;
61 uint32_t accE;
62 uint32_t accD;
63 uint32_t accLength;
64 uint32_t accHeading;
65 uint8_t reserved2[4];
66
69
70static_assert(sizeof(NAV_RELPOSNED_payload_t) == NAV_RELPOSNED_HEADER.payload_length, "NAV_RELPOSNED_payload_t size must be 64 bytes");
71static_assert(offsetof(NAV_RELPOSNED_payload_t, version) == 0);
72static_assert(offsetof(NAV_RELPOSNED_payload_t, reserved0) == 1);
73static_assert(offsetof(NAV_RELPOSNED_payload_t, refStationId) == 2);
74static_assert(offsetof(NAV_RELPOSNED_payload_t, iTOW) == 4);
75static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosN) == 8);
76static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosE) == 12);
77static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosD) == 16);
78static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosLength) == 20);
79static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosHeading) == 24);
80static_assert(offsetof(NAV_RELPOSNED_payload_t, reserved1) == 28);
81static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosHPN) == 32);
82static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosHPE) == 33);
83static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosHPD) == 34);
84static_assert(offsetof(NAV_RELPOSNED_payload_t, relPosHPLength) == 35);
85static_assert(offsetof(NAV_RELPOSNED_payload_t, accN) == 36);
86static_assert(offsetof(NAV_RELPOSNED_payload_t, accE) == 40);
87static_assert(offsetof(NAV_RELPOSNED_payload_t, accD) == 44);
88static_assert(offsetof(NAV_RELPOSNED_payload_t, accLength) == 48);
89static_assert(offsetof(NAV_RELPOSNED_payload_t, accHeading) == 52);
90static_assert(offsetof(NAV_RELPOSNED_payload_t, reserved2) == 56);
91static_assert(offsetof(NAV_RELPOSNED_payload_t, flags) == 60);
92
93static inline bool NAV_RELPOSNED_decode(
94 const volatile uint8_t *rx_buffer,
96) {
97 ubx_header_t header; // create copy to avoid alignment issues
98 memcpy(&header, (const void *)rx_buffer, sizeof(ubx_header_t));
99
101 return false;
102 }
103
104 if (!UBX_is_valid_checksum((const uint8_t *)rx_buffer, NAV_RELPOSNED_HEADER.payload_length)) {
105 return false;
106 }
107
108 memcpy(nav_relposned, (const void *)(rx_buffer + UBX_HEADER_LENGTH), sizeof(NAV_RELPOSNED_payload_t));
109
110 return true;
111}
112
113#endif // NAV_RELPOSNED_H
NAV_RELPOSNED_payload_t nav_relposned
Definition gps.c:14
static constexpr ubx_header_t NAV_RELPOSNED_HEADER
Definition nav_relposned.h:16
static bool NAV_RELPOSNED_decode(const volatile uint8_t *rx_buffer, NAV_RELPOSNED_payload_t *nav_relposned)
Definition nav_relposned.h:93
static constexpr size_t NAV_RELPOSNED_BUFFER_SIZE
Definition nav_relposned.h:23
NAV_RELPOSNED_flags_t
Definition nav_relposned.h:25
@ NAV_RELPOSNED_FLAGS_CARR_SOLN_FLOAT
Definition nav_relposned.h:32
@ NAV_RELPOSNED_FLAGS_CARR_SOLN_NONE
Definition nav_relposned.h:31
@ NAV_RELPOSNED_FLAGS_CARR_SOLN_FIXED
Definition nav_relposned.h:33
@ NAV_RELPOSNED_FLAGS_IS_MOVING
Definition nav_relposned.h:35
@ NAV_RELPOSNED_FLAGS_GNSS_FIX_OK
Definition nav_relposned.h:26
@ NAV_RELPOSNED_FLAGS_DIFF_SOLN
Definition nav_relposned.h:27
@ NAV_RELPOSNED_FLAGS_REL_POS_VALID
Definition nav_relposned.h:28
@ NAV_RELPOSNED_FLAGS_REF_POS_MISS
Definition nav_relposned.h:36
@ NAV_RELPOSNED_FLAGS_REF_OBS_MISS
Definition nav_relposned.h:37
@ NAV_RELPOSNED_FLAGS_CARR_SOLN_MASK
Definition nav_relposned.h:30
@ NAV_RELPOSNED_FLAGS_NORMALIZED
Definition nav_relposned.h:39
@ NAV_RELPOSNED_FLAGS_HEADING_VALID
Definition nav_relposned.h:38
Definition nav_relposned.h:42
uint16_t refStationId
Definition nav_relposned.h:45
int32_t relPosLength
Definition nav_relposned.h:51
int32_t relPosD
Definition nav_relposned.h:50
uint32_t iTOW
Definition nav_relposned.h:46
int32_t relPosN
Definition nav_relposned.h:48
int8_t relPosHPN
Definition nav_relposned.h:55
int8_t relPosHPLength
Definition nav_relposned.h:58
NAV_RELPOSNED_flags_t flags
Definition nav_relposned.h:67
uint8_t version
Definition nav_relposned.h:43
uint32_t accD
Definition nav_relposned.h:62
int8_t relPosHPD
Definition nav_relposned.h:57
uint32_t accN
Definition nav_relposned.h:60
uint32_t accLength
Definition nav_relposned.h:63
uint8_t reserved0
Definition nav_relposned.h:44
uint32_t accE
Definition nav_relposned.h:61
int8_t relPosHPE
Definition nav_relposned.h:56
int32_t relPosE
Definition nav_relposned.h:49
int32_t relPosHeading
Definition nav_relposned.h:52
uint32_t accHeading
Definition nav_relposned.h:64
Definition ubx_common.h:19
uint16_t payload_length
Definition ubx_common.h:23
UBX common definitions and utility functions.
static constexpr size_t UBX_OVERHEAD
Definition ubx_common.h:28
static constexpr uint8_t UBX_SYNC_B0
Definition ubx_common.h:17
static constexpr uint8_t UBX_SYNC_B1
Definition ubx_common.h:18
static bool UBX_is_matching_header(const ubx_header_t *header, const ubx_header_t *expected)
Definition ubx_common.h:30
static constexpr size_t UBX_HEADER_LENGTH
Definition ubx_common.h:16
static bool UBX_is_valid_checksum(const uint8_t *rx_buffer, const size_t payload_length)
Definition ubx_common.h:41